Kazuaki Hongu / ADS1100
Revision:
0:b211ff96822b
Child:
2:7ee26d7e2997
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ADS1100.h	Thu May 31 04:28:43 2018 +0000
@@ -0,0 +1,45 @@
+ //**********************
+// ADS1100.h for mbed
+//
+// Each ADS1100 is marked with "ADx".
+// Please write the 'x' to the "addr" argument.
+//
+// (C)Copyright 2018 All rights reserved by K.Hongu
+//**********************
+
+#ifndef ADS1100_H_
+#define ADS1100_H_
+
+#define ADS1100_ADDR    0b1001
+
+typedef union {
+    uint8_t UC;   
+    struct {
+        unsigned char ST:1; //0
+        unsigned char RE:2; //must be 00
+        unsigned char SC:1; //0=continuous, 1=single
+        unsigned char DR:2; //00=128SPS, 01=32SPS, 10=16SPS, 11=8SPS
+        unsigned char PGA:2; //GAIN: 00=1, 01=2, 10=4, 11=8
+    } bit;
+} CONFIG;
+
+typedef union {
+    uint16_t S;
+    struct {
+        uint8_t UB; //upper Byte (8bit)
+        uint8_t LB; //lpper Byte (8bit)
+    }
+} RESULT;
+
+protected:
+    I2C _i2c;
+    CONFIG config;
+    RESULT result;
+    uint8_t buf[3];
+    uint8_t address;
+
+public:
+    ADS1100 (PinName sda, PinName scl, char addr);
+    ADS1100 (I2C& p_i2c, char addr);
+    void init();
+    uint16_t get();
\ No newline at end of file