![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tp2
Dependencies: BLE_API mbed nRF51822
Fork of nRF51822_SimpleControls by
Diff: main.cpp
- Revision:
- 2:bbcdd23ba9ba
- Parent:
- 1:f03072e32ed3
- Child:
- 3:823f105078c7
diff -r f03072e32ed3 -r bbcdd23ba9ba main.cpp --- a/main.cpp Fri Oct 31 14:42:08 2014 +0000 +++ b/main.cpp Mon Jul 27 06:51:28 2015 +0000 @@ -18,9 +18,9 @@ */ #include "mbed.h" -#include "BLEDevice.h" +#include "ble/BLE.h" #include "Servo.h" - +#include "GattCallbackParamTypes.h" #define BLE_UUID_TXRX_SERVICE 0x0000 /**< The UUID of the Nordic UART Service. */ #define BLE_UUID_TX_CHARACTERISTIC 0x0002 /**< The UUID of the TX Characteristic. */ @@ -34,7 +34,7 @@ #define SERVO_PIN P0_14 //D10 #define ANALOG_IN_PIN P0_6 //A5 -BLEDevice ble; +BLE ble; DigitalOut LED_SET(DIGITAL_OUT_PIN); DigitalIn BUTTON(DIGITAL_IN_PIN); @@ -78,12 +78,12 @@ ble.startAdvertising(); } -void WrittenHandler(const GattCharacteristicWriteCBParams *Handler) +void WrittenHandler(const GattWriteCallbackParams *Handler) { uint8_t buf[TXRX_BUF_LEN]; uint16_t bytesRead, index; - if (Handler->charHandle == txCharacteristic.getValueAttribute().getHandle()) + if (Handler->handle == txCharacteristic.getValueAttribute().getHandle()) { ble.readCharacteristicValue(txCharacteristic.getValueAttribute().getHandle(), buf, &bytesRead); memset(txPayload, 0, TXRX_BUF_LEN);