Skip to content

SPBTLE RF

Frederic Pillon edited this page May 28, 2024 · 2 revisions

SPBTLE-RF

Arduino library to support the Bluetooth (V4.1 compliant) SPBTLE-RF module.

API

BLE module

  • SPBTLERFClass(SPIClass*, uint8_t, uint8_t, uint8_t, uint8_t): class constructor
    Params pointer to SPI interface
    Params BLE module CS pin
    Params BLE module IRQ pin
    Params BLE module reset pin
    Params (optional) BLE module led pin

  • begin: enable the BLE module
    Return SPBTLERF_OK in case of success, an error code otherwise

  • end: disable the BLE module

  • update: update the BLE stack. Must be call as soon as possible.

Beacon service

  • begin(uint8_t*, char*): enable the Beacon service in URL mode
    Params pointer to the address of the module to be set
    Params URL to be set
    Return SPBTLERF_OK in case of success, an error code otherwise

  • begin(uint8_t*, uint8_t*, uint8_t*): enable the Beacon service in UID mode
    Params pointer to the address of the module to be set
    Params pointer to ID to be set
    Params pointer to name space to be set
    Return SPBTLERF_OK in case of success, an error code otherwise

Sensor service

  • begin(const char*, uint8_t*): enable the Sensor service
    Params pointer to name space to be set
    Params pointer to the address of the module to be set
    Return SPBTLERF_OK in case of success, an error code otherwise

  • setConnectable: put the device in connectable mode

  • isConnected: check if the device is connected
    Return true if connected or false otherwise

  • Add_Acc_Service: add accelerometer service
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Free_Fall_Notify: send a notification for a free fall detection
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Acc_Update(AxesRaw_t*): update accelerometer values
    Params pointer to structure containing accelerometer values in mg
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Add_Environmental_Sensor_Service: add environmental service
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Temp_Update(int16_t): update temperature value
    Params new temperature value
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Press_Update(uint32_t): update pressure value
    Params new pressure value
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Humidity_Update(uint16_t): update humidity value
    Params new humidity value
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Add_Time_Service: add time service
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Update_Time_Characteristics: update seconds and minutes values

  • Seconds_Update: update seconds value
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Minutes_Notify: send a notification for a minute
    Return SPBTLERF_OK in case of success, an error code otherwise

  • Add_LED_Service: add LED service
    Return SPBTLERF_OK in case of success, an error code otherwise

  • LED_State: read the LED state
    Return led state (true or false)

Note

This library provides a basic BLE class to enable or disable the Bluetooth Low Energy module and 2 profiles as examples. You can use the BLE stack to create your own profile.

Examples

  • DISCO_IOT_BeaconDemo: enable a Beacon service (UID or URL)
  • DISCO_IOT_SensorDemo: enable an environmental sensor service (accelerometer, temperature, humidity, pressure and time)

Source

You can find the source files at
https://github.com/stm32duino/SPBTLE-RF

Documentation

The SPBTLE-RF module datasheet is available at
http://www.st.com/content/st_com/en/products/wireless-connectivity/bluetooth-bluetooth-low-energy/spbtle-rf.html

Clone this wiki locally