FF1705 support added
Dependencies: libxDot-dev-mbed5-deprecated ISL29011
Fork of Dot-Examples by
Dot-Examples rev. 31:7ec180e84cb6 have been tested with xdot-library 3.0.0-19-gb6c0ba2 and mbed-os-5.6.2
Revision 26:79d1af6752dd, committed 2017-09-06
- Comitter:
- gorazdko
- Date:
- Wed Sep 06 08:12:24 2017 +0000
- Parent:
- 25:c30633bcf302
- Child:
- 27:c817ae2629e5
- Commit message:
- FF1705 support added in all examples
Changed in this revision
--- a/examples/src/auto_ota_example.cpp Wed Sep 06 07:14:24 2017 +0000
+++ b/examples/src/auto_ota_example.cpp Wed Sep 06 08:12:24 2017 +0000
@@ -42,7 +42,8 @@
Serial pc(USBTX, USBRX);
-#if defined(TARGET_XDOT_L151CC)
+#ifdef TARGET_FF1705_L151CC
+uint16_t lux[3]={1,2,3};
I2C i2c(I2C_SDA, I2C_SCL);
ISL29011 lux(i2c);
#else
@@ -135,7 +136,18 @@
join_network();
}
-#if defined(TARGET_XDOT_L151CC)
+#ifdef TARGET_FF1705_L151CC
+ // get some dummy data and send it to the gateway
+ static int cnt = 0;
+ light = lux[cnt++];
+ if (cnt >= sizeof(lux)) cnt=0;
+
+ tx_data.push_back((light >> 8) & 0xFF);
+ tx_data.push_back(light & 0xFF);
+ logInfo("light: %lu [0x%04X]", light, light);
+ send_data(tx_data);
+
+#elif 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);
--- a/examples/src/class_c_example.cpp Wed Sep 06 07:14:24 2017 +0000
+++ b/examples/src/class_c_example.cpp Wed Sep 06 08:12:24 2017 +0000
@@ -36,7 +36,9 @@
Serial pc(USBTX, USBRX);
-#if defined(TARGET_XDOT_L151CC)
+#ifdef TARGET_FF1705_L151CC
+uint16_t lux[3]={1,2,3};
+#elif defined(TARGET_XDOT_L151CC)
I2C i2c(I2C_SDA, I2C_SCL);
ISL29011 lux(i2c);
#else
@@ -135,7 +137,18 @@
join_network();
}
-#if defined(TARGET_XDOT_L151CC)
+#ifdef TARGET_FF1705_L151CC
+ // get some dummy data and send it to the gateway
+ static int cnt = 0;
+ light = lux[cnt++];
+ if (cnt >= sizeof(lux)) cnt=0;
+
+ tx_data.push_back((light >> 8) & 0xFF);
+ tx_data.push_back(light & 0xFF);
+ logInfo("light: %lu [0x%04X]", light, light);
+ send_data(tx_data);
+
+#elif 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);
--- a/examples/src/manual_example.cpp Wed Sep 06 07:14:24 2017 +0000
+++ b/examples/src/manual_example.cpp Wed Sep 06 08:12:24 2017 +0000
@@ -39,7 +39,10 @@
Serial pc(USBTX, USBRX);
-#if defined(TARGET_XDOT_L151CC)
+
+#ifdef TARGET_FF1705_L151CC
+uint16_t lux[3]={1,2,3};
+#elif defined(TARGET_XDOT_L151CC)
I2C i2c(I2C_SDA, I2C_SCL);
ISL29011 lux(i2c);
#else
@@ -131,7 +134,18 @@
uint16_t light;
std::vector<uint8_t> tx_data;
-#if defined(TARGET_XDOT_L151CC)
+#ifdef TARGET_FF1705_L151CC
+ // get some dummy data and send it to the gateway
+ static int cnt = 0;
+ light = lux[cnt++];
+ if (cnt >= sizeof(lux)) cnt=0;
+
+ tx_data.push_back((light >> 8) & 0xFF);
+ tx_data.push_back(light & 0xFF);
+ logInfo("light: %lu [0x%04X]", light, light);
+ send_data(tx_data);
+
+#elif 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);
--- a/examples/src/ota_example.cpp Wed Sep 06 07:14:24 2017 +0000
+++ b/examples/src/ota_example.cpp Wed Sep 06 08:12:24 2017 +0000
@@ -42,7 +42,9 @@
Serial pc(USBTX, USBRX);
-#if defined(TARGET_XDOT_L151CC)
+#ifdef TARGET_FF1705_L151CC
+uint16_t lux[3]={1,2,3};
+#elif defined(TARGET_XDOT_L151CC)
I2C i2c(I2C_SDA, I2C_SCL);
ISL29011 lux(i2c);
#else
@@ -139,7 +141,18 @@
join_network();
}
-#if defined(TARGET_XDOT_L151CC)
+#ifdef TARGET_FF1705_L151CC
+ // get some dummy data and send it to the gateway
+ static int cnt = 0;
+ light = lux[cnt++];
+ if (cnt >= sizeof(lux)) cnt=0;
+
+ tx_data.push_back((light >> 8) & 0xFF);
+ tx_data.push_back(light & 0xFF);
+ logInfo("light: %lu [0x%04X]", light, light);
+ send_data(tx_data);
+
+#elif 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);
--- a/examples/src/peer_to_peer_example.cpp Wed Sep 06 07:14:24 2017 +0000
+++ b/examples/src/peer_to_peer_example.cpp Wed Sep 06 08:12:24 2017 +0000
@@ -29,7 +29,7 @@
Serial pc(USBTX, USBRX);
#ifdef TARGET_FF1705_L151CC
-uint8_t lux[3]={1,2,3};
+uint16_t lux[3]={1,2,3};
#elif defined(TARGET_XDOT_L151CC)
I2C i2c(I2C_SDA, I2C_SCL);
ISL29011 lux(i2c);
@@ -173,9 +173,16 @@
}
#ifdef TARGET_FF1705_L151CC
+ // get some dummy data and send it to the gateway
static int cnt = 0;
light = lux[cnt++];
- if (cnt > sizeof(lux)) cnt=0;
+ if (cnt >= sizeof(lux)) cnt=0;
+
+ tx_data.push_back((light >> 8) & 0xFF);
+ tx_data.push_back(light & 0xFF);
+ logInfo("light: %lu [0x%04X]", light, light);
+ send_data(tx_data);
+
#elif defined(TARGET_XDOT_L151CC)
// get the latest light sample and send it to the gateway
light = lux.getData();
