Hover!( Microchip MGC3130 ) library. Now, it is development version. http://www.hoverlabs.co/#hover https://www.switch-science.com/catalog/2124/
MjHover.h
- Committer:
- matsujirushi
- Date:
- 2015-04-03
- Revision:
- 5:bd26aba87b9b
- Parent:
- 3:b03009537d66
- Child:
- 6:8d68ac1bab97
File content as of revision 5:bd26aba87b9b:
#ifndef MJ_HOVER_H #define MJ_HOVER_H #include "mbed.h" using namespace std; namespace matsujirushi { class MjHoverBase { public: MjHoverBase(I2C* i2c, uint8_t address, DigitalInOut* ts_n, DigitalInOut* reset_n); void Reset(); bool DataAvailable() const { return this->ts_n->read() ? false : true; } bool WriteMessage(uint8_t id, const uint8_t* payload, uint8_t payloadSize); bool ReadMessage(uint8_t* id, uint8_t* payload, uint8_t payloadSize, uint8_t* readPayloadSize); private: I2C *i2c; uint8_t address; DigitalInOut* ts_n; // I/O Transfer Status DigitalInOut* reset_n; // O Master Clear# void BeginRead() { this->ts_n->output(); this->ts_n->write(0); } void EndRead() { this->ts_n->input(); wait_us(100); } }; class MjHover : public MjHoverBase { public: MjHover(I2C* i2c, uint8_t address, DigitalInOut* ts_n, DigitalInOut* reset_n); void begin(); void setRelease(); bool getStatus(); uint8_t getEvent(); static const char* getEventString(uint8_t eventByte); }; } // namespace matsujirushi #endif