Hover!( Microchip MGC3130 ) library. Now, it is development version. http://www.hoverlabs.co/#hover https://www.switch-science.com/catalog/2124/

Dependents:   MjHover_Hello

Revision:
3:b03009537d66
Parent:
2:46cf70365584
Child:
5:bd26aba87b9b
--- a/MjHover.h	Thu Apr 02 13:02:52 2015 +0000
+++ b/MjHover.h	Fri Apr 03 04:11:05 2015 +0000
@@ -7,6 +7,39 @@
 
 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();
+    }
+
+};
+
 class MjHover
 {
 public:
@@ -29,3 +62,5 @@
 
 #endif
 
+
+