Fork to see if I can get working

Dependencies:   BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated

Fork of xDotBridge_update_test20180823 by Matt Briggs

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nBitAnalogLadder.h Source File

nBitAnalogLadder.h

00001 /*
00002  * nBitAnalogLadder.h
00003  *
00004  * This library converts analog voltage to to a bit value.  This is a table based implementation
00005  * so the thresholds are hard-coded and can be adjusted.
00006  *
00007  */
00008 
00009 #include <stdint.h>
00010 
00011 #ifndef XDOTBRIDGE_INC_NBITANALOGLADDER_H_
00012 #define XDOTBRIDGE_INC_NBITANALOGLADDER_H_
00013 
00014 const uint8_t TABLE_MIN_IDX = 0;
00015 const uint8_t TABLE_MAX_IDX = 1;
00016 const float NOM_VCC = 3.3;  // Used so table values can be in voltage not relative values
00017 
00018 // Use voltage values in numerator
00019 const float tenValueTable [][2] = {
00020         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 0
00021         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 1
00022         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 2
00023         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 3
00024         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 4
00025         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 5
00026         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 6
00027         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 7
00028         {0.0/NOM_VCC, 0.1/NOM_VCC}, // 8
00029         {0.0/NOM_VCC, 0.1/NOM_VCC}  // 9
00030 };
00031 
00032 uint8_t convAnalogLadder (const float &analogV, const float valueTable[][2], uint8_t nVals);
00033 
00034 #endif /* XDOTBRIDGE_INC_NBITANALOGLADDER_H_ */