Speed testing IMUs
Dependencies: MadgwickAHRS mbed
Fork of IMU_serial by
Diff: TCA9548.h
- Revision:
- 0:80a695ae3cc3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TCA9548.h Wed Sep 28 23:59:57 2016 +0000 @@ -0,0 +1,58 @@ +#ifndef TCA9548_H +#define TCA9548_H + +// Includes +#include "mbed.h" + + +//Constants + + + +class TCA9548 +{ + //data members + protected: + + public: + + + private: + uint8_t addr; + + //functions + protected: + + public: + + TCA9548(uint8_t address = 0x70) + { + //MBED uses 8 bit address, most devices use 7 bit address, so need to shift + addr = address << 1; + } // end of constructor + + void setAddr(uint8_t address) + { + addr = address; + } // end of setAddr + + void addrSelect(uint8_t ch) + { + //address range is 0-7 + if (ch > 7) return; + char ch_s[1]; + ch_s[0] = 1 << ch; + + i2c.write(addr, ch_s, 1); + + } // end of addrSelect + + private: + +};// end of class + + + + + +#endif \ No newline at end of file