![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fork to see if I can get working
Dependencies: BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated
Fork of xDotBridge_update_test20180823 by
xDotBridge/inc/nBitAnalogLadder.h
- Committer:
- mbriggs_vortex
- Date:
- 2017-11-29
- Revision:
- 100:0882cf295f8e
- Parent:
- 33:c7bb3fbc024a
File content as of revision 100:0882cf295f8e:
/* * nBitAnalogLadder.h * * This library converts analog voltage to to a bit value. This is a table based implementation * so the thresholds are hard-coded and can be adjusted. * */ #include <stdint.h> #ifndef XDOTBRIDGE_INC_NBITANALOGLADDER_H_ #define XDOTBRIDGE_INC_NBITANALOGLADDER_H_ const uint8_t TABLE_MIN_IDX = 0; const uint8_t TABLE_MAX_IDX = 1; const float NOM_VCC = 3.3; // Used so table values can be in voltage not relative values // Use voltage values in numerator const float tenValueTable [][2] = { {0.0/NOM_VCC, 0.1/NOM_VCC}, // 0 {0.0/NOM_VCC, 0.1/NOM_VCC}, // 1 {0.0/NOM_VCC, 0.1/NOM_VCC}, // 2 {0.0/NOM_VCC, 0.1/NOM_VCC}, // 3 {0.0/NOM_VCC, 0.1/NOM_VCC}, // 4 {0.0/NOM_VCC, 0.1/NOM_VCC}, // 5 {0.0/NOM_VCC, 0.1/NOM_VCC}, // 6 {0.0/NOM_VCC, 0.1/NOM_VCC}, // 7 {0.0/NOM_VCC, 0.1/NOM_VCC}, // 8 {0.0/NOM_VCC, 0.1/NOM_VCC} // 9 }; uint8_t convAnalogLadder (const float &analogV, const float valueTable[][2], uint8_t nVals); #endif /* XDOTBRIDGE_INC_NBITANALOGLADDER_H_ */