ble10 2.0.0.0
main.c File Reference

BLE 10 Click Example. More...

#include "board.h"
#include "log.h"
#include "ble10.h"
#include "conversions.h"
#include "generic_pointer.h"

Macros

#define PROCESS_BUFFER_SIZE   200
 
#define RSP_TIMEOUT   20000
 
#define RSP_OK   "OK"
 
#define RSP_ERROR   "ERROR"
 
#define EVT_DONE   "DONE"
 
#define EVT_RESET   "RESET"
 
#define EVT_GATT_VAL   "GATT_VAL"
 
#define DEVICE_NAME   "BLE 10 Click"
 
#define GET_TEMP_COMMAND   "get temp"
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

BLE 10 Click Example.

Description

This example reads and processes data from BLE 10 clicks.

The demo application is composed of two sections :

Application Init

Initializes the driver, then performs a factory reset and sets the local device name.

Application Task

Logs all the received events/responses on the USB UART. Then checks if there's a specific command string (defined by the GET_TEMP_COMMAND macro) received from the GATT Server, and if so, it executes temperature reading command and logs the results.

Additional Function

  • static void ble10_clear_app_buf ( void )
  • static err_t ble10_process ( void )
  • static err_t bluetooth2_display_rsp ( char *rsp_end )
Note
We have used the nRF Connect smartphone application for the test. Make sure to configure the GATT Server properly in the nRF Connect application, then you will be able to send a desired command from it, once you connect to the click board. You can use the Sample configuration for GATT Server which comes with the application installation and then send a command via Test Service from the Server.
Author
Stefan Filipovic

Macro Definition Documentation

◆ DEVICE_NAME

#define DEVICE_NAME   "BLE 10 Click"

◆ EVT_DONE

#define EVT_DONE   "DONE"

◆ EVT_GATT_VAL

#define EVT_GATT_VAL   "GATT_VAL"

◆ EVT_RESET

#define EVT_RESET   "RESET"

◆ GET_TEMP_COMMAND

#define GET_TEMP_COMMAND   "get temp"

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ RSP_ERROR

#define RSP_ERROR   "ERROR"

◆ RSP_OK

#define RSP_OK   "OK"

◆ RSP_TIMEOUT

#define RSP_TIMEOUT   20000

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )