![](/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
Diff: xDotBridge/src/main.cpp
- Revision:
- 22:9453658b8d4b
- Parent:
- 21:4be85f9c7dc7
- Child:
- 23:4ed894108882
--- a/xDotBridge/src/main.cpp Fri Dec 30 09:32:05 2016 -0700 +++ b/xDotBridge/src/main.cpp Fri Dec 30 11:46:31 2016 -0700 @@ -1,6 +1,8 @@ +#include "config.h" #include "dot_util.h" #include "RadioEvent.h" + ///////////////////////////////////////////////////////////////////////////// // -------------------- DOT LIBRARY REQUIRED ------------------------------// // * Because these example programs can be used for both mDot and xDot // @@ -25,13 +27,6 @@ Serial pc(USBTX, USBRX); -#if defined(TARGET_XDOT_L151CC) -I2C i2c(I2C_SDA, I2C_SCL); -ISL29011 lux(i2c); -#else -AnalogIn lux(XBEE_AD0); -#endif - int main() { // Custom event handler for automatically displaying RX data RadioEvent events; @@ -106,15 +101,9 @@ // display configuration display_config(); -#if defined(TARGET_XDOT_L151CC) - // configure the ISL29011 sensor on the xDot-DK for continuous ambient light sampling, 16 bit conversion, and maximum range - lux.setMode(ISL29011::ALS_CONT); - lux.setResolution(ISL29011::ADC_16BIT); - lux.setRange(ISL29011::RNG_64000); -#endif while (true) { - uint16_t light; + uint16_t seqNum; std::vector<uint8_t> tx_data; // join network if not joined @@ -122,21 +111,10 @@ join_network(); } -#if defined(TARGET_XDOT_L151CC) - // get the latest light sample and send it to the gateway - light = lux.getData(); tx_data.push_back((light >> 8) & 0xFF); tx_data.push_back(light & 0xFF); logInfo("light: %lu [0x%04X]", light, light); send_data(tx_data); -#else - // get some dummy data and send it to the gateway - light = lux.read_u16(); - tx_data.push_back((light >> 8) & 0xFF); - tx_data.push_back(light & 0xFF); - logInfo("light: %lu [0x%04X]", light, light); - send_data(tx_data); -#endif // the Dot can't sleep in PEER_TO_PEER mode // it must be waiting for data from the other Dot