Driver for KX134-1211 Accelerometer

Dependents:   KX134-1211 Examples

Revision:
1:c6e2a348da09
Parent:
0:01d5616ba355
--- a/KX134.h	Tue Sep 22 19:36:06 2020 -0400
+++ b/KX134.h	Sun Oct 25 15:47:36 2020 -0400
@@ -169,6 +169,8 @@
     // Set Output Data Rate from Hz
     void setOutputDataRateHz(uint32_t hz);
 
+    bool dataReady();
+
   private:
     // Mbed pin identities
     SPI _spi;
@@ -194,14 +196,14 @@
      * Note: the first byte read should return 0x0, so the data begins at
      * rx_buf[1]
      */
-    void readRegister(Register addr, char *rx_buf, int size = 2);
+    void readRegister(Register addr, uint8_t *rx_buf, int size = 2);
 
     /* Writes a given register a given number of bytes
      *
      * Note: the first byte read should return 0x0, so the data begins at
      * rx_buf[1]
      */
-    void writeRegister(Register addr, uint8_t *data, char *rx_buf,
+    void writeRegister(Register addr, uint8_t *data, uint8_t *rx_buf,
                        int size = 1);
 
     /* Writes a given register 1 byte (convenience function, calls
@@ -210,13 +212,18 @@
      * Note: the first byte read should return 0x0, so the data begins at
      * rx_buf[1]
      */
-    void writeRegisterOneByte(Register addr, uint8_t data, char *buf);
+    void writeRegisterOneByte(Register addr, uint8_t data, uint8_t *buf);
 
     /* Reads a value from a low and high address and combines them to create a
      * signed (2s complement) 16-bit integer
      */
     int16_t read16BitValue(Register lowAddr, Register highAddr);
 
+    /* Converts 2 8-bit unsigned integers to a single signed 16-bit (2s
+     * complement) integer
+     */
+    int16_t convertTo16BitValue(uint8_t low, uint8_t high);
+
     // Settings variables
 
     // CNTL1 vars
@@ -239,4 +246,4 @@
     bool registerWritingEnabled;
 };
 
-#endif // KX134_H
+#endif // KX134_H
\ No newline at end of file