![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CAN to BLE translator - and back
Dependencies: BLE_API CANnucleo X_NUCLEO_IDB0XA1 mbed
Diff: main.cpp
- Revision:
- 4:8c2cd88d2545
- Parent:
- 3:5bce2e8d2797
- Child:
- 5:9f30eba41c77
--- a/main.cpp Fri Apr 08 12:21:07 2016 +0000 +++ b/main.cpp Fri Apr 08 13:33:35 2016 +0000 @@ -96,11 +96,10 @@ can.attach(&onMsgReceived, CAN::RxIrq); // attach 'CAN receive-complete' interrupt handler while(true) { - if(ble.getGapState().connected) { + // if(ble.getGapState().connected) { + if(ble.gap().getState().connected) { stopTimer=0.2; symbol='!'; - - } else { stopTimer=3; ble.waitForEvent(); @@ -108,7 +107,8 @@ } if(timerA.read()>=stopTimer) { - BLExmit=ble.getGapState().connected; + // BLExmit=ble.getGapState().connected; + BLExmit=ble.gap().getState().connected; timerA.stop(); timerA.reset(); led=!led.read(); @@ -166,7 +166,7 @@ if (ble.getInstanceID() != BLE::DEFAULT_INSTANCE) { return; } - + ble.gap().onDisconnection(disconnectionCallback); /* Setup primary service. */