Hardware Reference
In-Depth Information
mbed BLE API
As part of their objective to make developing embedded hardware using ARM Cortex
processors as easy as possible, ARM and its partner companies created an open source
development platform called mbed . mbed allows you to write code that is portable across
a variety of supported ARM processors and can take advantage of APIs and components
built to run on top of these processors.
You can also use mbed with free online collaborative development tools and a variety
of offline commercial and open source toolchains and IDEs. A considerable amount of
effort has been put into defining high-level APIs that abstract away most of the low-
level chip details that can consume a large part of the overall development budget. This
enables reuse of open source software components that have been shared in the com‐
munity and frees firmware engineers to focus more on project-specific code and less on
low-level implementation details around their particular choice of microcontroller
(MCU).
Most relevant to the purposes of this chapter, ARM recently added a BLE API to the
mbed platform, which allows you to implement a simple GATT server with a few BLE
services and characteristics (described in “Attribute and Data Hierarchy” on page 56 )
in a few dozen lines of code and a few hours of effort, without having to consider any
vendor-specific details about the stack or chipset.
mbed provides an easy way to get a proof-of-concept product off the ground, while still
working with a platform you can later move to production (exporting the code to offline
compilers if necessary). The high-level abstractions around BLE mean you don't have
to spend a lot of time learning about the specifics of your BLE SoC or module. For
example, instantiating a standard BLE service or characteristic takes just one line of
code:
GattService hrmService ( GattService :: UUID_HEART_RATE_SERVICE );
GattCharacteristic hrmRate ( GattCharacteristic :: UUID_HEART_RATE_MEASUREMENT_CHAR ,
2 , 3 , GattCharacteristic :: BLE_GATT_CHAR_PROPERTIES_NOTIFY );
GattCharacteristic hrmLocation
( GattCharacteristic :: UUID_BODY_SENSOR_LOCATION_CHAR ,
1 , 1 , GattCharacteristic :: BLE_GATT_CHAR_PROPERTIES_READ );
At the time of this writing, mbed's BLE API is still in beta and undergoing active de‐
velopment, but it currently covers most of the features you'll likely need for prototypes
and proof-of-concept products. For more information on mbed or examples and up‐
dates on its BLE API, see the mbed project website .
Embedded Toolchains
While mbed qualifies as a viable embedded development platform with a clear path
from prototype through to production, any vendor-nuetral high-level API or platform
Search WWH ::




Custom Search