![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
test firmware for BLE Micro V1.3 1. test io, vcc and ble 2. act as a UART to BLE bridge
Dependencies: BLE_API Buffer mbed
Fork of BLE_LEDBlinker by
Diff: ble_micro_test.cpp
- Revision:
- 12:c4090cb58976
- Parent:
- 11:c8cbc4bc2c17
--- a/ble_micro_test.cpp Tue Dec 08 06:02:25 2015 +0000 +++ b/ble_micro_test.cpp Tue Dec 08 08:34:22 2015 +0000 @@ -84,34 +84,30 @@ { // 10x2 pins const uint32_t mask = ((uint32_t)1 << 11) - 1; - const uint32_t zebra = 0x5555 & mask; BusInOut group1(p18, p17, p23, p24, p0, p2, p3, p4, p9, p10); BusInOut group2(p25, p28, p29, p30, p5, p6, p7, p8, p12, p13); group1.input(); group2.output(); - - group2.write(zebra); - if ((group1.read() & mask) != zebra) { - return -1; - } - - group2.write(~zebra & mask); - if ((group1.read() & mask) != (~zebra & mask)) { - return -1; + + + for (int i = 0; i < 10; i++) { + uint32_t out = 1 << i; + group2.write(out); + if ((group1.read() & mask) != out) { + return -1; + } } group2.input(); group1.output(); - group1.write(zebra); - if ((group2.read() & mask) != zebra) { - return -1; - } - - group1.write(~zebra & mask); - if ((group2.read() & mask) != (~zebra & mask)) { - return -1; + for (int i = 0; i < 10; i++) { + uint32_t out = 1 << i; + group1.write(out); + if ((group2.read() & mask) != out) { + return -1; + } } group1.input(); @@ -128,7 +124,8 @@ sum += vcc.read(); } - if (((sum / 3.0) * 3.3) < 3.0) { // vcc should be more than 3.0V + float val = ((sum / 3.0) * 3.3); + if (val < 2.65 || val > 2.95) { // 2.8V return -1; }