RCELE 85 / ADT7320_SPI

Dependents:   GRPEACH_SHM_FINAL

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ADT7320_SPI.h Source File

ADT7320_SPI.h

00001 #ifndef ADT7320_SPI_H
00002 #define ADT7320_SPI_H
00003  
00004 /**
00005  * Includes
00006  */
00007 #include "mbed.h"
00008 
00009 
00010 class ADT7320_SPI {
00011  
00012  public:
00013 
00014     /**
00015      * Constructor.
00016      *
00017      * @param mosi mbed pin to use for SDA line of I2C interface.
00018      * @param sck mbed pin to use for SCL line of I2C interface.
00019      */
00020     ADT7320_SPI(PinName mosi, PinName miso, PinName sclk, PinName cs);
00021     float readTemp(void);
00022     /**
00023      * Get the output of all three axes.
00024      *
00025      * @param Pointer to a buffer to hold the accelerometer value for the
00026      *        x-axis, y-axis and z-axis [in that order].
00027      */
00028      
00029  
00030  private:
00031 
00032     SPI spi_;
00033     DigitalOut cs_;
00034     unsigned int readRegister(uint8_t thisRegister, int bytesToRead );
00035     /**
00036      * Read one byte from a register on the device.
00037      *
00038      * @param: - the address to be read from
00039      *
00040      * @return: the value of the data read
00041      */
00042     
00043 
00044     /**
00045      * Write one byte to a register on the device.
00046      *
00047      * @param:
00048         - address of the register to write to.
00049         - the value of the data to store
00050      */
00051   
00052    
00053 };
00054  
00055 #endif