SODA Arudino library
 All Classes Files Functions Variables Macros Pages
SODA.h
Go to the documentation of this file.
1 
22 //The output filename can be changed by changing the character string below
23 #ifndef FILENAME
24 #define FILENAME "DATA.CSV"
25 #endif
26 //Note that the SD functions can be removed by uncommenting the line below:
27 //#define NO_SD
28 #ifndef __SODA__h
29 #define __SODA__h
30 #include <Arduino.h>
31 #include <Wire.h>
32 //clock values
33 #define CLOCK_I2C_ADDR 0x68
34 #define CLOCK_CONTROL_ADDR 0x0E
35 #define CLOCK_TEMPERATURE_ADDR 0x11
36 #define CLOCK_TIME_CAL_ADDR 0x00
37 #define CLOCK_SETUP 0x5 //allow interrupts on alarm1
38 #define CLOCK_ALARM1_ADDR 0x07
39 #define CLOCK_ALARM_STATUS 0x0F
40 //ADC values
41 #define ADC_I2C_ADDR 0x6E
42 #define ADC_CONTROL 0x00
43 #define ADC_BASE 0x80 //one shot conversion model
44 #define ADC_CH1 0x00
45 #define ADC_CH2 0x20
46 #define ADC_CH3 0x40
47 #define ADC_CH4 0x60
48 #define ADC_18BITS 0x0C
49 #define ADC_16BITS 0x08
50 #define ADC_14BITS 0x04
51 #define ADC_12BITS 0x00
52 #define ADC_GAIN1 0x00
53 #define ADC_GAIN2 0x01
54 #define ADC_GAIN4 0x02
55 #define ADC_GAIN8 0x03
56 //MISC Values
57 #define LEDPIN 13 // LED connected to digital pin 13
58 #endif
59 
63 class SODA
64 {
65  private:
66  void setAddress(uint8_t,uint8_t,uint8_t);
67  unsigned char getAddress(uint8_t,uint8_t);
68  int dectobcd(int val);
69  int bcdtodec(int val);
70  void runSD(int);
71  void parseCommand(char);
72  unsigned char standby;
73  //variables
74  // static char buffer[];
75  // static int timeArray[];
76  public:
80  void begin();
82  //@I Clock Functions
90  void updateTime(int val,int place);
97  int checkTime(int place);
104  void setTime();
110  void getTime();
116  void bufferTime();
123  void serialSetTime();
128  float getClockTemp();
136  void setWake(int val,int valType);
141  void turnOff();
147  void setStandby(unsigned char val);
153  int getStandby();
155  //@I ADC Functions
164  long adcRead(int ch, int bit, int gain);
170  int tcReadK(int ch);
176  int smoothAnalogRead(int pin1);
178  //@I Data output functions
190  void dataLineBegin();
197  void dataLineAdd(int value);
204  void dataLineAdd(long value);
211  void dataLineAdd(float value);
217  void dataLineEnd();
225  void dataDownload();
227  //@I communication functions
245  void communicate();
247  //@I misc function
252  void setID(long ID);
257  long getID();
261  void printBuffer();
266  bool usbConnected();
271  void blinks(int n);
272 };
273 
274 
void communicate()
Definition: SODA.cpp:473
void getTime()
Definition: SODA.cpp:98
int getStandby()
Definition: SODA.cpp:280
void setTime()
Definition: SODA.cpp:68
long getID()
Definition: SODA.cpp:541
int checkTime(int place)
Definition: SODA.cpp:186
void begin()
Definition: SODA.cpp:16
void printBuffer()
Definition: SODA.cpp:59
void dataLineBegin()
Definition: SODA.cpp:384
void dataLineAdd(int value)
Definition: SODA.cpp:401
void setWake(int val, int valType)
Definition: SODA.cpp:212
int tcReadK(int ch)
Definition: SODA.cpp:334
void setID(long ID)
Definition: SODA.cpp:534
Definition: SODA.h:63
void setStandby(unsigned char val)
Definition: SODA.cpp:261
void dataDownload()
Definition: SODA.cpp:454
void serialSetTime()
Definition: SODA.cpp:158
void turnOff()
Definition: SODA.cpp:251
int smoothAnalogRead(int pin1)
Definition: SODA.cpp:366
long adcRead(int ch, int bit, int gain)
Definition: SODA.cpp:291
bool usbConnected()
Definition: SODA.cpp:551
float getClockTemp()
Definition: SODA.cpp:192
void bufferTime()
Definition: SODA.cpp:131
void updateTime(int val, int place)
Definition: SODA.cpp:180
void blinks(int n)
Definition: SODA.cpp:556
void dataLineEnd()
Definition: SODA.cpp:439