ECE 4180 Lab 2 IMU code template
Dependencies: 4DGL-uLCD-SE LSM9DS0 mbed
Revision 2:4d1fd40fbf43, committed 2015-01-26
- Comitter:
- aswild
- Date:
- Mon Jan 26 06:32:58 2015 +0000
- Parent:
- 1:ae1cefe9aa38
- Child:
- 3:6d7606db18e1
- Commit message:
- Doxygen for LSM9DS0
Changed in this revision
LSM9DS0.cpp | Show annotated file Show diff for this revision Revisions of this file |
LSM9DS0.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/LSM9DS0.cpp Mon Jan 26 06:23:41 2015 +0000 +++ b/LSM9DS0.cpp Mon Jan 26 06:32:58 2015 +0000 @@ -6,8 +6,6 @@ // xmAddress and gAddress will store the 7-bit I2C address, if using I2C. xmAddress = xmAddr; gAddress = gAddr; - -// i2c_ = new I2Cdev(sda, scl); } uint16_t LSM9DS0::begin(gyro_scale gScl, accel_scale aScl, mag_scale mScl, @@ -419,42 +417,26 @@ { // Whether we're using I2C or SPI, write a byte using the // accelerometer-specific I2C address or SPI CS pin. - return I2CwriteByte(xmAddress, subAddress, data); + return I2CwriteByte(xmAddress, subAddress, data); } uint8_t LSM9DS0::gReadByte(uint8_t subAddress) { - return I2CreadByte(gAddress, subAddress); + return I2CreadByte(gAddress, subAddress); } -//void LSM9DS0::gReadBytes(uint8_t subAddress, uint8_t * dest, uint8_t count) -//{ -// // Whether we're using I2C or SPI, read multiple bytes using the -// // gyro-specific I2C address. -// I2CreadBytes(gAddress, subAddress, dest, count); -//} - uint8_t LSM9DS0::xmReadByte(uint8_t subAddress) { // Whether we're using I2C or SPI, read a byte using the // accelerometer-specific I2C address. - return I2CreadByte(xmAddress, subAddress); + return I2CreadByte(xmAddress, subAddress); } -//void LSM9DS0::xmReadBytes(uint8_t subAddress, uint8_t * dest, uint8_t count) -//{ -// // read multiple bytes using the -// // accelerometer-specific I2C address. -// I2CreadBytes(xmAddress, subAddress, dest, count); -//} -// - void LSM9DS0::I2CwriteByte(char address, char subAddress, char data) { char cmd[2] = {subAddress, data}; i2c.write(address<<1, cmd, 2); -// i2c_->writeByte(address,subAddress,data); } uint8_t LSM9DS0::I2CreadByte(char address, char subAddress) @@ -463,15 +445,6 @@ i2c.write(address<<1, &subAddress, 1, true); i2c.read(address<<1, &data, 1); -// I2CreadBytes(address, subAddress, &data, 1); return data; -} - -//void LSM9DS0::I2CreadBytes(uint8_t address, uint8_t subAddress, uint8_t * dest, -// uint8_t count) -//{ -// i2c_->readBytes(address, subAddress, count, dest); -//} - - +} \ No newline at end of file
--- a/LSM9DS0.h Mon Jan 26 06:23:41 2015 +0000 +++ b/LSM9DS0.h Mon Jan 26 06:32:58 2015 +0000 @@ -1,10 +1,9 @@ -//Most of the Credit goes to jimblom +// Most of the Credit goes to jimblom +// Modifications by Allen Wild #ifndef _LSM9DS0_H__ #define _LSM9DS0_H__ #include "mbed.h" -//#include "I2Cdev.h" - //////////////////////////// // LSM9DS0 Gyro Registers // @@ -99,14 +98,16 @@ class LSM9DS0 { public: - // gyro_scale defines the possible full-scale ranges of the gyroscope: + + /// gyro_scale defines the possible full-scale ranges of the gyroscope: enum gyro_scale { G_SCALE_245DPS, // 00: +/- 245 degrees per second G_SCALE_500DPS, // 01: +/- 500 dps G_SCALE_2000DPS, // 10: +/- 2000 dps }; - // accel_scale defines all possible FSR's of the accelerometer: + + /// accel_scale defines all possible FSR's of the accelerometer: enum accel_scale { A_SCALE_2G, // 000: +/- 2g @@ -115,7 +116,8 @@ A_SCALE_8G, // 011: +/- 8g A_SCALE_16G // 100: +/- 16g }; - // mag_scale defines all possible FSR's of the magnetometer: + + /// mag_scale defines all possible FSR's of the magnetometer: enum mag_scale { M_SCALE_2GS, // 00: +/- 2Gs @@ -123,7 +125,8 @@ M_SCALE_8GS, // 10: +/- 8Gs M_SCALE_12GS, // 11: +/- 12Gs }; - // gyro_odr defines all possible data rate/bandwidth combos of the gyro: + + /// gyro_odr defines all possible data rate/bandwidth combos of the gyro: enum gyro_odr { // ODR (Hz) --- Cutoff G_ODR_95_BW_125 = 0x0, // 95 12.5 @@ -142,7 +145,8 @@ G_ODR_760_BW_50 = 0xE, // 760 50 G_ODR_760_BW_100 = 0xF, // 760 100 }; - // accel_oder defines all possible output data rates of the accelerometer: + + /// accel_oder defines all possible output data rates of the accelerometer: enum accel_odr { A_POWER_DOWN, // Power-down mode (0x0) @@ -157,7 +161,7 @@ A_ODR_800, // 800 Hz (9) A_ODR_1600 // 1600 Hz (0xA) }; - // accel_oder defines all possible output data rates of the magnetometer: + /// accel_oder defines all possible output data rates of the magnetometer: enum mag_odr { M_ODR_3125, // 3.125 Hz (0x00) @@ -188,277 +192,271 @@ float gbias[3]; - // LSM9DS0 -- LSM9DS0 class constructor - // The constructor will set up a handful of private variables, and set the - // communication mode as well. - // Input: - // - interface = Either MODE_SPI or MODE_I2C, whichever you're using - // to talk to the IC. - // - gAddr = If MODE_I2C, this is the I2C address of the gyroscope. - // If MODE_SPI, this is the chip select pin of the gyro (CSG) - // - xmAddr = If MODE_I2C, this is the I2C address of the accel/mag. - // If MODE_SPI, this is the cs pin of the accel/mag (CSXM) + /** LSM9DS0 -- LSM9DS0 class constructor + * The constructor will set up a handful of private variables, and set the + * communication mode as well. + * Input: + * - interface = Either MODE_SPI or MODE_I2C, whichever you're using + * to talk to the IC. + * - gAddr = If MODE_I2C, this is the I2C address of the gyroscope. + * If MODE_SPI, this is the chip select pin of the gyro (CSG) + * - xmAddr = If MODE_I2C, this is the I2C address of the accel/mag. + * If MODE_SPI, this is the cs pin of the accel/mag (CSXM) + */ LSM9DS0(PinName sda, PinName scl, uint8_t gAddr, uint8_t xmAddr); - // begin() -- Initialize the gyro, accelerometer, and magnetometer. - // This will set up the scale and output rate of each sensor. It'll also - // "turn on" every sensor and every axis of every sensor. - // Input: - // - gScl = The scale of the gyroscope. This should be a gyro_scale value. - // - aScl = The scale of the accelerometer. Should be a accel_scale value. - // - mScl = The scale of the magnetometer. Should be a mag_scale value. - // - gODR = Output data rate of the gyroscope. gyro_odr value. - // - aODR = Output data rate of the accelerometer. accel_odr value. - // - mODR = Output data rate of the magnetometer. mag_odr value. - // Output: The function will return an unsigned 16-bit value. The most-sig - // bytes of the output are the WHO_AM_I reading of the accel. The - // least significant two bytes are the WHO_AM_I reading of the gyro. - // All parameters have a defaulted value, so you can call just "begin()". - // Default values are FSR's of: +/- 245DPS, 2g, 2Gs; ODRs of 95 Hz for - // gyro, 100 Hz for accelerometer, 100 Hz for magnetometer. - // Use the return value of this function to verify communication. + /** begin() -- Initialize the gyro, accelerometer, and magnetometer. + * This will set up the scale and output rate of each sensor. It'll also + * "turn on" every sensor and every axis of every sensor. + * Input: + * - gScl = The scale of the gyroscope. This should be a gyro_scale value. + * - aScl = The scale of the accelerometer. Should be a accel_scale value. + * - mScl = The scale of the magnetometer. Should be a mag_scale value. + * - gODR = Output data rate of the gyroscope. gyro_odr value. + * - aODR = Output data rate of the accelerometer. accel_odr value. + * - mODR = Output data rate of the magnetometer. mag_odr value. + * Output: The function will return an unsigned 16-bit value. The most-sig + * bytes of the output are the WHO_AM_I reading of the accel. The + * least significant two bytes are the WHO_AM_I reading of the gyro. + * All parameters have a defaulted value, so you can call just "begin()". + * Default values are FSR's of: +/- 245DPS, 2g, 2Gs; ODRs of 95 Hz for + * gyro, 100 Hz for accelerometer, 100 Hz for magnetometer. + * Use the return value of this function to verify communication. + */ uint16_t begin(gyro_scale gScl = G_SCALE_245DPS, accel_scale aScl = A_SCALE_2G, mag_scale mScl = M_SCALE_2GS, gyro_odr gODR = G_ODR_95_BW_125, accel_odr aODR = A_ODR_50, mag_odr mODR = M_ODR_50); - // readGyro() -- Read the gyroscope output registers. - // This function will read all six gyroscope output registers. - // The readings are stored in the class' gx_raw, gy_raw, and gz_raw variables. Read - // those _after_ calling readGyro(). + /** readGyro() -- Read the gyroscope output registers. + * This function will read all six gyroscope output registers. + * The readings are stored in the class' gx_raw, gy_raw, and gz_raw variables. Read + * those _after_ calling readGyro(). + */ void readGyro(); - // readAccel() -- Read the accelerometer output registers. - // This function will read all six accelerometer output registers. - // The readings are stored in the class' ax_raw, ay_raw, and az_raw variables. Read - // those _after_ calling readAccel(). + /** readAccel() -- Read the accelerometer output registers. + * This function will read all six accelerometer output registers. + * The readings are stored in the class' ax_raw, ay_raw, and az_raw variables. Read + * those _after_ calling readAccel(). + */ void readAccel(); - // readMag() -- Read the magnetometer output registers. - // This function will read all six magnetometer output registers. - // The readings are stored in the class' mx_raw, my_raw, and mz_raw variables. Read - // those _after_ calling readMag(). + /** readMag() -- Read the magnetometer output registers. + * This function will read all six magnetometer output registers. + * The readings are stored in the class' mx_raw, my_raw, and mz_raw variables. Read + * those _after_ calling readMag(). + */ void readMag(); - // readTemp() -- Read the temperature output register. - // This function will read two temperature output registers. - // The combined readings are stored in the class' temperature variables. Read - // those _after_ calling readTemp(). + /** readTemp() -- Read the temperature output register. + * This function will read two temperature output registers. + * The combined readings are stored in the class' temperature variables. Read + * those _after_ calling readTemp(). + */ void readTemp(); - // setGyroScale() -- Set the full-scale range of the gyroscope. - // This function can be called to set the scale of the gyroscope to - // 245, 500, or 200 degrees per second. - // Input: - // - gScl = The desired gyroscope scale. Must be one of three possible - // values from the gyro_scale enum. + /** setGyroScale() -- Set the full-scale range of the gyroscope. + * This function can be called to set the scale of the gyroscope to + * 245, 500, or 200 degrees per second. + * Input: + * - gScl = The desired gyroscope scale. Must be one of three possible + * values from the gyro_scale enum. + */ void setGyroScale(gyro_scale gScl); - // setAccelScale() -- Set the full-scale range of the accelerometer. - // This function can be called to set the scale of the accelerometer to - // 2, 4, 6, 8, or 16 g's. - // Input: - // - aScl = The desired accelerometer scale. Must be one of five possible - // values from the accel_scale enum. + /** setAccelScale() -- Set the full-scale range of the accelerometer. + * This function can be called to set the scale of the accelerometer to + * 2, 4, 6, 8, or 16 g's. + * Input: + * - aScl = The desired accelerometer scale. Must be one of five possible + * values from the accel_scale enum. + */ void setAccelScale(accel_scale aScl); - // setMagScale() -- Set the full-scale range of the magnetometer. - // This function can be called to set the scale of the magnetometer to - // 2, 4, 8, or 12 Gs. - // Input: - // - mScl = The desired magnetometer scale. Must be one of four possible - // values from the mag_scale enum. + /** setMagScale() -- Set the full-scale range of the magnetometer. + * This function can be called to set the scale of the magnetometer to + * 2, 4, 8, or 12 Gs. + * Input: + * - mScl = The desired magnetometer scale. Must be one of four possible + * values from the mag_scale enum. + */ void setMagScale(mag_scale mScl); - // setGyroODR() -- Set the output data rate and bandwidth of the gyroscope - // Input: - // - gRate = The desired output rate and cutoff frequency of the gyro. - // Must be a value from the gyro_odr enum (check above, there're 14). + /** setGyroODR() -- Set the output data rate and bandwidth of the gyroscope + * Input: + * - gRate = The desired output rate and cutoff frequency of the gyro. + * Must be a value from the gyro_odr enum (check above, there're 14). + */ void setGyroODR(gyro_odr gRate); - // setAccelODR() -- Set the output data rate of the accelerometer - // Input: - // - aRate = The desired output rate of the accel. - // Must be a value from the accel_odr enum (check above, there're 11). + /** setAccelODR() -- Set the output data rate of the accelerometer + * Input: + * - aRate = The desired output rate of the accel. + * Must be a value from the accel_odr enum (check above, there're 11). + */ void setAccelODR(accel_odr aRate); - // setMagODR() -- Set the output data rate of the magnetometer - // Input: - // - mRate = The desired output rate of the mag. - // Must be a value from the mag_odr enum (check above, there're 6). + /** setMagODR() -- Set the output data rate of the magnetometer + * Input: + * - mRate = The desired output rate of the mag. + * Must be a value from the mag_odr enum (check above, there're 6). + */ void setMagODR(mag_odr mRate); - // configGyroInt() -- Configure the gyro interrupt output. - // Triggers can be set to either rising above or falling below a specified - // threshold. This function helps setup the interrupt configuration and - // threshold values for all axes. - // Input: - // - int1Cfg = A 8-bit value that is sent directly to the INT1_CFG_G - // register. This sets AND/OR and high/low interrupt gen for each axis - // - int1ThsX = 16-bit interrupt threshold value for x-axis - // - int1ThsY = 16-bit interrupt threshold value for y-axis - // - int1ThsZ = 16-bit interrupt threshold value for z-axis - // - duration = Duration an interrupt holds after triggered. This value - // is copied directly into the INT1_DURATION_G register. - // Before using this function, read about the INT1_CFG_G register and - // the related INT1* registers in the LMS9DS0 datasheet. + /** configGyroInt() -- Configure the gyro interrupt output. + * Triggers can be set to either rising above or falling below a specified + * threshold. This function helps setup the interrupt configuration and + * threshold values for all axes. + * Input: + * - int1Cfg = A 8-bit value that is sent directly to the INT1_CFG_G + * register. This sets AND/OR and high/low interrupt gen for each axis + * - int1ThsX = 16-bit interrupt threshold value for x-axis + * - int1ThsY = 16-bit interrupt threshold value for y-axis + * - int1ThsZ = 16-bit interrupt threshold value for z-axis + * - duration = Duration an interrupt holds after triggered. This value + * is copied directly into the INT1_DURATION_G register. + * Before using this function, read about the INT1_CFG_G register and + * the related INT1* registers in the LMS9DS0 datasheet. + */ void configGyroInt(uint8_t int1Cfg, uint16_t int1ThsX = 0, uint16_t int1ThsY = 0, uint16_t int1ThsZ = 0, uint8_t duration = 0); void calcBias(); - // return a comass heading (in degrees) using X/Y magnetometer data + * return a comass heading (in degrees) using X/Y magnetometer data float calcHeading(); private: - // xmAddress and gAddress store the I2C address - // for each sensor. + /** xmAddress and gAddress store the I2C address + * for each sensor. + */ uint8_t xmAddress, gAddress; - // gScale, aScale, and mScale store the current scale range for each - // sensor. Should be updated whenever that value changes. + /** gScale, aScale, and mScale store the current scale range for each + * sensor. Should be updated whenever that value changes. + */ gyro_scale gScale; accel_scale aScale; mag_scale mScale; - // gRes, aRes, and mRes store the current resolution for each sensor. - // Units of these values would be DPS (or g's or Gs's) per ADC tick. - // This value is calculated as (sensor scale) / (2^15). + /** gRes, aRes, and mRes store the current resolution for each sensor. + * Units of these values would be DPS (or g's or Gs's) per ADC tick. + * This value is calculated as (sensor scale) / (2^15). + */ float gRes, aRes, mRes; - // initGyro() -- Sets up the gyroscope to begin reading. - // This function steps through all five gyroscope control registers. - // Upon exit, the following parameters will be set: - // - CTRL_REG1_G = 0x0F: Normal operation mode, all axes enabled. - // 95 Hz ODR, 12.5 Hz cutoff frequency. - // - CTRL_REG2_G = 0x00: HPF set to normal mode, cutoff frequency - // set to 7.2 Hz (depends on ODR). - // - CTRL_REG3_G = 0x88: Interrupt enabled on INT_G (set to push-pull and - // active high). Data-ready output enabled on DRDY_G. - // - CTRL_REG4_G = 0x00: Continuous update mode. Data LSB stored in lower - // address. Scale set to 245 DPS. SPI mode set to 4-wire. - // - CTRL_REG5_G = 0x00: FIFO disabled. HPF disabled. + /** initGyro() -- Sets up the gyroscope to begin reading. + * This function steps through all five gyroscope control registers. + * Upon exit, the following parameters will be set: + * - CTRL_REG1_G = 0x0F: Normal operation mode, all axes enabled. + * 95 Hz ODR, 12.5 Hz cutoff frequency. + * - CTRL_REG2_G = 0x00: HPF set to normal mode, cutoff frequency + * set to 7.2 Hz (depends on ODR). + * - CTRL_REG3_G = 0x88: Interrupt enabled on INT_G (set to push-pull and + * active high). Data-ready output enabled on DRDY_G. + * - CTRL_REG4_G = 0x00: Continuous update mode. Data LSB stored in lower + * address. Scale set to 245 DPS. SPI mode set to 4-wire. + * - CTRL_REG5_G = 0x00: FIFO disabled. HPF disabled. + */ void initGyro(); - // initAccel() -- Sets up the accelerometer to begin reading. - // This function steps through all accelerometer related control registers. - // Upon exit these registers will be set as: - // - CTRL_REG0_XM = 0x00: FIFO disabled. HPF bypassed. Normal mode. - // - CTRL_REG1_XM = 0x57: 100 Hz data rate. Continuous update. - // all axes enabled. - // - CTRL_REG2_XM = 0x00: +/- 2g scale. 773 Hz anti-alias filter BW. - // - CTRL_REG3_XM = 0x04: Accel data ready signal on INT1_XM pin. + /** initAccel() -- Sets up the accelerometer to begin reading. + * This function steps through all accelerometer related control registers. + * Upon exit these registers will be set as: + * - CTRL_REG0_XM = 0x00: FIFO disabled. HPF bypassed. Normal mode. + * - CTRL_REG1_XM = 0x57: 100 Hz data rate. Continuous update. + * all axes enabled. + * - CTRL_REG2_XM = 0x00: +/- 2g scale. 773 Hz anti-alias filter BW. + * - CTRL_REG3_XM = 0x04: Accel data ready signal on INT1_XM pin. + */ void initAccel(); - // initMag() -- Sets up the magnetometer to begin reading. - // This function steps through all magnetometer-related control registers. - // Upon exit these registers will be set as: - // - CTRL_REG4_XM = 0x04: Mag data ready signal on INT2_XM pin. - // - CTRL_REG5_XM = 0x14: 100 Hz update rate. Low resolution. Interrupt - // requests don't latch. Temperature sensor disabled. - // - CTRL_REG6_XM = 0x00: +/- 2 Gs scale. - // - CTRL_REG7_XM = 0x00: Continuous conversion mode. Normal HPF mode. - // - INT_CTRL_REG_M = 0x09: Interrupt active-high. Enable interrupts. + /** initMag() -- Sets up the magnetometer to begin reading. + * This function steps through all magnetometer-related control registers. + * Upon exit these registers will be set as: + * - CTRL_REG4_XM = 0x04: Mag data ready signal on INT2_XM pin. + * - CTRL_REG5_XM = 0x14: 100 Hz update rate. Low resolution. Interrupt + * requests don't latch. Temperature sensor disabled. + * - CTRL_REG6_XM = 0x00: +/- 2 Gs scale. + * - CTRL_REG7_XM = 0x00: Continuous conversion mode. Normal HPF mode. + * - INT_CTRL_REG_M = 0x09: Interrupt active-high. Enable interrupts. + */ void initMag(); - // gReadByte() -- Reads a byte from a specified gyroscope register. - // Input: - // - subAddress = Register to be read from. - // Output: - // - An 8-bit value read from the requested address. + /** gReadByte() -- Reads a byte from a specified gyroscope register. + * Input: + * - subAddress = Register to be read from. + * Output: + * - An 8-bit value read from the requested address. + */ uint8_t gReadByte(uint8_t subAddress); - // gReadBytes() -- Reads a number of bytes -- beginning at an address - // and incrementing from there -- from the gyroscope. - // Input: - // - subAddress = Register to be read from. - // - * dest = A pointer to an array of uint8_t's. Values read will be - // stored in here on return. - // - count = The number of bytes to be read. - // Output: No value is returned, but the `dest` array will store - // the data read upon exit. -// void gReadBytes(uint8_t subAddress, uint8_t * dest, uint8_t count); - - // gWriteByte() -- Write a byte to a register in the gyroscope. - // Input: - // - subAddress = Register to be written to. - // - data = data to be written to the register. + /** gWriteByte() -- Write a byte to a register in the gyroscope. + * Input: + * - subAddress = Register to be written to. + * - data = data to be written to the register. + */ void gWriteByte(uint8_t subAddress, uint8_t data); - // xmReadByte() -- Read a byte from a register in the accel/mag sensor - // Input: - // - subAddress = Register to be read from. - // Output: - // - An 8-bit value read from the requested register. + /** xmReadByte() -- Read a byte from a register in the accel/mag sensor + * Input: + * - subAddress = Register to be read from. + * Output: + * - An 8-bit value read from the requested register. + */ uint8_t xmReadByte(uint8_t subAddress); - // xmReadBytes() -- Reads a number of bytes -- beginning at an address - // and incrementing from there -- from the accelerometer/magnetometer. - // Input: - // - subAddress = Register to be read from. - // - * dest = A pointer to an array of uint8_t's. Values read will be - // stored in here on return. - // - count = The number of bytes to be read. - // Output: No value is returned, but the `dest` array will store - // the data read upon exit. -// void xmReadBytes(uint8_t subAddress, uint8_t * dest, uint8_t count); - - // xmWriteByte() -- Write a byte to a register in the accel/mag sensor. - // Input: - // - subAddress = Register to be written to. - // - data = data to be written to the register. + /** xmWriteByte() -- Write a byte to a register in the accel/mag sensor. + * Input: + * - subAddress = Register to be written to. + * - data = data to be written to the register. + */ void xmWriteByte(uint8_t subAddress, uint8_t data); - // calcgRes() -- Calculate the resolution of the gyroscope. - // This function will set the value of the gRes variable. gScale must - // be set prior to calling this function. + /** calcgRes() -- Calculate the resolution of the gyroscope. + * This function will set the value of the gRes variable. gScale must + * be set prior to calling this function. + */ void calcgRes(); - // calcmRes() -- Calculate the resolution of the magnetometer. - // This function will set the value of the mRes variable. mScale must - // be set prior to calling this function. + /** calcmRes() -- Calculate the resolution of the magnetometer. + * This function will set the value of the mRes variable. mScale must + * be set prior to calling this function. + */ void calcmRes(); - // calcaRes() -- Calculate the resolution of the accelerometer. - // This function will set the value of the aRes variable. aScale must - // be set prior to calling this function. + /** calcaRes() -- Calculate the resolution of the accelerometer. + * This function will set the value of the aRes variable. aScale must + * be set prior to calling this function. + */ void calcaRes(); /////////////////// // I2C Functions // /////////////////// -// I2Cdev* i2c_; I2C i2c; - // I2CwriteByte() -- Write a byte out of I2C to a register in the device - // Input: - // - address = The 7-bit I2C address of the slave device. - // - subAddress = The register to be written to. - // - data = Byte to be written to the register. + /** I2CwriteByte() -- Write a byte out of I2C to a register in the device + * Input: + * - address = The 7-bit I2C address of the slave device. + * - subAddress = The register to be written to. + * - data = Byte to be written to the register. + */ void I2CwriteByte(char address, char subAddress, char data); - // I2CreadByte() -- Read a single byte from a register over I2C. - // Input: - // - address = The 7-bit I2C address of the slave device. - // - subAddress = The register to be read from. - // Output: - // - The byte read from the requested address. + /** I2CreadByte() -- Read a single byte from a register over I2C. + * Input: + * - address = The 7-bit I2C address of the slave device. + * - subAddress = The register to be read from. + * Output: + * - The byte read from the requested address. + */ uint8_t I2CreadByte(char address, char subAddress); - - // I2CreadBytes() -- Read a series of bytes, starting at a register via SPI - // Input: - // - address = The 7-bit I2C address of the slave device. - // - subAddress = The register to begin reading. - // - * dest = Pointer to an array where we'll store the readings. - // - count = Number of registers to be read. - // Output: No value is returned by the function, but the registers read are - // all stored in the *dest array given. -// void I2CreadBytes(uint8_t address, uint8_t subAddress, uint8_t * dest, uint8_t count); }; #endif // _LSM9DS0_H // -