Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Sensors/I2C_Sensor.h
- Committer:
- maetugr
- Date:
- 2012-10-27
- Revision:
- 14:cf260677ecde
- Child:
- 15:753c5d6a63b3
File content as of revision 14:cf260677ecde:
#ifndef I2C_Sensor_H
#define I2C_Sensor_H
class I2C_Sensor
{
public:
I2C_Sensor(PinName sda, PinName scl, int8_t address);
float data[3];
void read();
void calibrate();
protected:
// I2C functions
void writeRegister(char address, char data);
void readMultiRegister(char address, char* output, int size);
private:
I2C i2c; // I2C-Bus
int8_t i2c_address; // address
// raw data and function to measure it
int raw[3];
void readraw();
LocalFileSystem local; // file access to save calibration values
};
#endif
