diff options
| author | Tim Redfern <tim@eclectronics.org> | 2011-12-19 18:20:33 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2011-12-19 18:20:33 +0000 |
| commit | e9a73bbb3c14af340999f70146747787785f4fee (patch) | |
| tree | a125452f7d641673286542497da051b810427880 /ESS1995test_328p/electic.h | |
initial commit
Diffstat (limited to 'ESS1995test_328p/electic.h')
| -rw-r--r-- | ESS1995test_328p/electic.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/ESS1995test_328p/electic.h b/ESS1995test_328p/electic.h new file mode 100644 index 0000000..326f900 --- /dev/null +++ b/ESS1995test_328p/electic.h @@ -0,0 +1,72 @@ +/* + ESS1995 communications test + + should the bitfields be parsed in the MCU or the app? + + the device needs to be able to do the ranging itself. + + data format- + + ACK is necessary + + write per read? or is it a delay thing + + +*/ + +#include <WProgram.h> //main Arduino header file +#include "adapticsBT.h" + +#define DATA_NEW 2 +#define SCLK 3 +#define SDATA 4 +#define CS 5 + +//feedback leds +#define OUTPUT1 12 +#define OUTPUT2 13 + +#define WRITE_ID 0b11001000 +#define READ_ID 0b11001001 + +//clock delays are doubled for 8MHZ chip - CPUSPD isnt working +//6 and 3 = 83kHz, doesn't work with ISP plugged in +//500Hz works with ISP (sometimes) + +#define CLOCK_DELAY 20 +#define START_DELAY 10 + +const uint16_t ELECTIC_ID = 0xF0; +uint8_t packetSize = 7; +bool connected=false; + +uint8_t data[10]; + +//default write values +uint8_t CB_SHBP = 0b0; +uint8_t CB_function = 0b0000; //0b0000 voltage mode +uint8_t CB_VARCrange = 0b000; //0b001 6v +uint8_t CB_FREQrange = 0b000; +uint8_t CB_BUZfreq = 0b000; +uint8_t CB_ADCrate = 0b00; //0b11 fastest 50hz +uint8_t CB_ACmode = 0b0; +uint8_t CB_PEAKmode = 0b0; +uint8_t CB_PCALmode = 0b0; +uint8_t CB_LPFbw = 0b000; +uint8_t CB_EXTdiode = 0b0; +uint8_t CB_OPconf = 0b00; +uint8_t CB_FREQinprest = 0b0; +uint8_t CB_ADPext = 0b0; +uint8_t CB_DCfs = 0b0; + + +void SCLKcycle_W(); +void SCLKcycle_R(); +void startRead(); +void startWrite(); +void writeByte(uint8_t data); +void writeStartBit(); +void writeStopBit(); +uint8_t readByte(); +void writeDMM(); +int main(); |
