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 smoothAnalogRead(int pin1);
172  //@I Data output functions
184  void dataLineBegin();
191  void dataLineAdd(int value);
198  void dataLineAdd(long value);
205  void dataLineAdd(float value);
211  void dataLineEnd();
219  void dataDownload();
221  //@I communication functions
239  void communicate();
241  //@I misc function
246  void setID(long ID);
251  long getID();
255  void printBuffer();
260  bool usbConnected();
265  void blinks(int n);
266 };
267 
268 
void communicate()
Definition: SODA.cpp:444
void getTime()
Definition: SODA.cpp:99
int getStandby()
Definition: SODA.cpp:281
void setTime()
Definition: SODA.cpp:69
long getID()
Definition: SODA.cpp:512
int checkTime(int place)
Definition: SODA.cpp:187
void begin()
Definition: SODA.cpp:17
void printBuffer()
Definition: SODA.cpp:60
void dataLineBegin()
Definition: SODA.cpp:355
void dataLineAdd(int value)
Definition: SODA.cpp:372
void setWake(int val, int valType)
Definition: SODA.cpp:213
void setID(long ID)
Definition: SODA.cpp:505
Definition: SODA.h:63
void setStandby(unsigned char val)
Definition: SODA.cpp:262
void dataDownload()
Definition: SODA.cpp:425
void serialSetTime()
Definition: SODA.cpp:159
void turnOff()
Definition: SODA.cpp:252
int smoothAnalogRead(int pin1)
Definition: SODA.cpp:337
long adcRead(int ch, int bit, int gain)
Definition: SODA.cpp:292
bool usbConnected()
Definition: SODA.cpp:522
float getClockTemp()
Definition: SODA.cpp:193
void bufferTime()
Definition: SODA.cpp:132
void updateTime(int val, int place)
Definition: SODA.cpp:181
void blinks(int n)
Definition: SODA.cpp:527
void dataLineEnd()
Definition: SODA.cpp:410