-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
196 changed files
with
9,183 additions
and
1,311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
https://github.com/ARMmbed/cordio-ble-x-nucleo-idb0xa1/#51f60dfea514e35e5aa13c8e24005ecadc24a9f5 | ||
https://github.com/ARMmbed/cordio-ble-x-nucleo-idb0xa1/#811f3fea7aa8083c0bbf378e1b51a8b131d7efcc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* mbed Microcontroller Library | ||
* Copyright (c) 2018 ARM Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <mbed.h> | ||
#include "ble/BLE.h" | ||
|
||
inline void print_error(ble_error_t error, const char* msg) | ||
{ | ||
printf("%s: ", msg); | ||
switch(error) { | ||
case BLE_ERROR_NONE: | ||
printf("BLE_ERROR_NONE: No error"); | ||
break; | ||
case BLE_ERROR_BUFFER_OVERFLOW: | ||
printf("BLE_ERROR_BUFFER_OVERFLOW: The requested action would cause a buffer overflow and has been aborted"); | ||
break; | ||
case BLE_ERROR_NOT_IMPLEMENTED: | ||
printf("BLE_ERROR_NOT_IMPLEMENTED: Requested a feature that isn't yet implement or isn't supported by the target HW"); | ||
break; | ||
case BLE_ERROR_PARAM_OUT_OF_RANGE: | ||
printf("BLE_ERROR_PARAM_OUT_OF_RANGE: One of the supplied parameters is outside the valid range"); | ||
break; | ||
case BLE_ERROR_INVALID_PARAM: | ||
printf("BLE_ERROR_INVALID_PARAM: One of the supplied parameters is invalid"); | ||
break; | ||
case BLE_STACK_BUSY: | ||
printf("BLE_STACK_BUSY: The stack is busy"); | ||
break; | ||
case BLE_ERROR_INVALID_STATE: | ||
printf("BLE_ERROR_INVALID_STATE: Invalid state"); | ||
break; | ||
case BLE_ERROR_NO_MEM: | ||
printf("BLE_ERROR_NO_MEM: Out of Memory"); | ||
break; | ||
case BLE_ERROR_OPERATION_NOT_PERMITTED: | ||
printf("BLE_ERROR_OPERATION_NOT_PERMITTED"); | ||
break; | ||
case BLE_ERROR_INITIALIZATION_INCOMPLETE: | ||
printf("BLE_ERROR_INITIALIZATION_INCOMPLETE"); | ||
break; | ||
case BLE_ERROR_ALREADY_INITIALIZED: | ||
printf("BLE_ERROR_ALREADY_INITIALIZED"); | ||
break; | ||
case BLE_ERROR_UNSPECIFIED: | ||
printf("BLE_ERROR_UNSPECIFIED: Unknown error"); | ||
break; | ||
case BLE_ERROR_INTERNAL_STACK_FAILURE: | ||
printf("BLE_ERROR_INTERNAL_STACK_FAILURE: internal stack faillure"); | ||
break; | ||
} | ||
printf("\r\n"); | ||
} | ||
|
||
/** print device address to the terminal */ | ||
inline void print_address(const Gap::Address_t &addr) | ||
{ | ||
printf("%02x:%02x:%02x:%02x:%02x:%02x\r\n", | ||
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]); | ||
} | ||
|
||
inline void print_mac_address() | ||
{ | ||
/* Print out device MAC address to the console*/ | ||
Gap::AddressType_t addr_type; | ||
Gap::Address_t address; | ||
BLE::Instance().gap().getAddress(&addr_type, address); | ||
printf("DEVICE MAC ADDRESS: "); | ||
print_address(address); | ||
} | ||
|
||
inline const char* phy_to_string(Gap::Phy_t phy) { | ||
switch(phy.value()) { | ||
case Gap::Phy_t::LE_1M: | ||
return "LE 1M"; | ||
case Gap::Phy_t::LE_2M: | ||
return "LE 2M"; | ||
case Gap::Phy_t::LE_CODED: | ||
return "LE coded"; | ||
default: | ||
return "invalid PHY"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
https://github.com/ARMmbed/mbed-os/#c966348d3f9ca80843be7cdc9b748f06ea73ced0 | ||
https://github.com/ARMmbed/mbed-os/#c966348d3f9ca80843be7cdc9b748f06ea73ced0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
https://github.com/ARMmbed/cordio-ble-x-nucleo-idb0xa1/#51f60dfea514e35e5aa13c8e24005ecadc24a9f5 | ||
https://github.com/ARMmbed/cordio-ble-x-nucleo-idb0xa1/#811f3fea7aa8083c0bbf378e1b51a8b131d7efcc |
Oops, something went wrong.