diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-11-19 20:02:14 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2011-11-19 20:02:14 +0100 |
commit | 307cfe164910eccc70c086c083595d637c7fb987 (patch) | |
tree | f9845dc9647518840faf469580f581cf65d9fced /bma150.h | |
parent | c265553652444293f90189c7481fb7eb16f28115 (diff) |
Moved driver related files to a subdirectory.
Diffstat (limited to 'bma150.h')
-rw-r--r-- | bma150.h | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/bma150.h b/bma150.h deleted file mode 100644 index 2e043ff..0000000 --- a/bma150.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef BMA150_H -#define BMA150_H - -#include "i2c.h" - -class BMA150 { - private: - I2C& i2c; - - public: - int16_t x, y, z; - - BMA150(I2C& i2c_bus) : i2c(i2c_bus) { - - } - - void init() { - uint8_t temp; - i2c.read_reg(0x38, 0x14, 1, &temp); - i2c.write_reg(0x38, 0x14, (temp & 0xe0) | 0x00 | 0x00); // 2g range, 25 Hz bandwidth - } - - void update() { - uint8_t buf[6]; - i2c.read_reg(0x38, 0x02, 6, buf); - - x = (buf[1] << 8 | buf[0]) - 0; - y = (buf[3] << 8 | buf[2]) - 0; - z = (buf[5] << 8 | buf[4]) - 0; - } -}; - -#endif |