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
Revision 12:c4090cb58976, committed 2015-12-08
- Comitter:
- arch
- Date:
- Tue Dec 08 08:34:22 2015 +0000
- Parent:
- 11:c8cbc4bc2c17
- Commit message:
- fix USBTX/USBRX pins config
Changed in this revision
ble_micro_test.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c8cbc4bc2c17 -r c4090cb58976 ble_micro_test.cpp --- 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; }
diff -r c8cbc4bc2c17 -r c4090cb58976 main.cpp --- a/main.cpp Tue Dec 08 06:02:25 2015 +0000 +++ b/main.cpp Tue Dec 08 08:34:22 2015 +0000 @@ -84,6 +84,7 @@ if (current_test_status == 3) { current_test_status = 0; + test_output_result(0); test_save_result(0); } @@ -132,8 +133,14 @@ { int io_status; int vcc_status; + saved_test_result = test_is_passed(); if (!saved_test_result) { + { + uart = new Serial(p20, p21); // release USBTX and USBRX + uart->baud(38400); + } + io_status = test_check_io(); vcc_status = test_check_vcc(); @@ -149,12 +156,13 @@ } } else { - //test_output_result(0); + test_output_result(0); + uart = new Serial(p8, p7); + uart->baud(38400); } - uart = new Serial(p8, p7); - uart->baud(38400); + ble.init(); ble.gap().onConnection(connectionCallback); @@ -183,7 +191,7 @@ if (current_test_status == 0) { LOG("from scan to connected: %d", device_connected_time - device_scan_time); } else if (current_test_status == 3) { - test_output_result(current_test_status); + test_output_result(3); } } }