diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-04-11 05:44:51 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-04-11 05:44:51 +0200 |
commit | c6ac90fc731d8411380f582be3b91ce4e93f61fc (patch) | |
tree | e5fc2017a6e27e3669a81f595df551cc91af7549 /i2csensor.h | |
parent | 14f24f2a98a63a5c5525fd196df46100b4ef626d (diff) |
Create I2CSensor class and subclasses for each sensor.
Diffstat (limited to 'i2csensor.h')
-rw-r--r-- | i2csensor.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/i2csensor.h b/i2csensor.h new file mode 100644 index 0000000..1878e16 --- /dev/null +++ b/i2csensor.h @@ -0,0 +1,26 @@ +#ifndef I2CSENSOR_H +#define I2CSENSOR_H + +#include <stdint.h> + +#include <ch.h> +#include <hal.h> + +class I2CSensor { + private: + static I2CSlaveConfig i2c_slave_conf; + + public: + static void enable_bus(); + + protected: + uint8_t i2c_address; + + void write(uint8_t reg, uint8_t value); + void read(uint8_t reg, size_t len); + + static uint8_t rxdata[8]; + static uint8_t txdata[2]; +}; + +#endif |