Skip to content

Commit

Permalink
Merge pull request ARMmbed#35 from LiyouZhou/update_var_name
Browse files Browse the repository at this point in the history
Change variable name
  • Loading branch information
pan- committed Dec 14, 2015
2 parents dfd6fe9 + d60ad7e commit bd0ddf4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions BLE_GAPButton/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

DigitalOut led1(LED1, 1);
InterruptIn button(BUTTON1);
uint8_t count;
uint8_t cnt;

// Change your device name below
const char DEVICE_NAME[] = "GAPButton";
Expand Down Expand Up @@ -80,7 +80,7 @@ void updatePayload(void)
uint8_t service_data[3];
service_data[0] = GAPButtonUUID & 0xff;
service_data[1] = GAPButtonUUID >> 8;
service_data[2] = count; // Put the button click count in the third byte
service_data[2] = cnt; // Put the button click count in the third byte
ble_error_t err = BLE::Instance().gap().updateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA, (uint8_t *)service_data, sizeof(service_data));
if (err != BLE_ERROR_NONE) {
print_error(err, "Updating payload failed");
Expand All @@ -89,7 +89,7 @@ void updatePayload(void)

void buttonPressedCallback(void)
{
++count;
++cnt;

// Calling BLE api in interrupt context may cause race conditions
// Using minar to schedule calls to BLE api for safety
Expand Down Expand Up @@ -139,7 +139,7 @@ void bleInitComplete(BLE::InitializationCompleteCallbackContext *context)
uint8_t service_data[3];
service_data[0] = GAPButtonUUID & 0xff;
service_data[1] = GAPButtonUUID >> 8;
service_data[2] = count; // Put the button click count in the third byte
service_data[2] = cnt; // Put the button click count in the third byte
err = ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::SERVICE_DATA, (uint8_t *)service_data, sizeof(service_data));
if (err != BLE_ERROR_NONE) {
print_error(err, "Setting service data failed");
Expand All @@ -161,7 +161,7 @@ void bleInitComplete(BLE::InitializationCompleteCallbackContext *context)

void app_start(int, char**)
{
count = 0;
cnt = 0;
ble_error_t err = BLE::Instance().init(bleInitComplete);
if (err != BLE_ERROR_NONE) {
print_error(err, "BLE initialisation failed");
Expand Down

0 comments on commit bd0ddf4

Please sign in to comment.