ble6 2.0.0.0
main.c File Reference

BLE 6 Click Example. More...

#include "board.h"
#include "log.h"
#include "ble6.h"

Macros

#define PROCESS_BUFFER_SIZE   256
 

Functions

void ble6_module_init (void)
 BLE 6 module initialisation.
 
void ble6_event_handler (void)
 BLE 6 event handler.
 
void ble6_display_log (void)
 BLE 6 display log.
 
void ble6_aci_gap_init (void)
 BLE 6 aci gap initialisation.
 
void ble6_le_meta_event (void)
 BLE 6 le meta event.
 
void ble6_handler (void)
 BLE 6 handler.
 
void ble6_response_handler (void)
 BLE 6 response handler.
 
void ble6_local_version_info (void)
 BLE 6 local version info.
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 
void ble6_connect_handler (void)
 

Variables

uint8_t app_buf [PROCESS_BUFFER_SIZE]
 
uint8_t rx_response [PROCESS_BUFFER_SIZE]
 
uint8_t device_connected_flag = 0
 
uint8_t hci_le_meta_event_connect [5] = { 0x04, 0x3E, 0x13, 0x01, 0x00 }
 
uint8_t hci_le_serverwrite_event [1] = { 0x04 }
 
uint8_t hci_read_local_version_information [4] = { 0x01, 0x01, 0x10, 0x00 }
 
uint8_t hci_info_confirm [4] = { 0xFF, 0x01, 0x00, 0x00 }
 
uint8_t aci_hal_get_fw_version [4] = { 0x01, 0x01, 0xFC, 0x00 }
 
uint8_t hci_reset [4] = { 0x01, 0x03, 0x0C, 0x00 }
 
uint8_t aci_hal_write_config_data [12]
 
uint8_t aci_hal_set_tx_power_level [6] = { 0x01, 0x0F, 0xFC, 0x02, 0x01, 0x04 }
 
uint8_t aci_gatt_init [4] = { 0x01, 0x01, 0xFD, 0x00 }
 
uint8_t aci_gap_init [7] = { 0x01, 0x8A, 0xFC, 0x03, 0x0F, 0x00, 0x0B }
 
uint8_t aci_gatt_update_value [21]
 
uint8_t hci_le_set_scan_response_data [36]
 
uint8_t aci_gap_set_discoverable [30]
 

Detailed Description

BLE 6 Click Example.

Description

This example reads and processes data from BLE 6 clicks.

The demo application is composed of two sections :

Application Init

Initialization driver enables - UART, sets handlers initialize and enable UART interrupt, reset and configures BLE module, initialize BLE Server Profile ( Services and Characteristics ).

Application Task

The app starts by checking the system ready flag and returns the Bluetooth device address. After that, the chain of commands creates Primary Server Profiles: Device Information, Generic Access and Custom Service to Start Advertising. For transmit messages, we use Generic Access Primary Service with Write permissions of the characteristic Element. In this example, transmitting message is limited to a maximum of 11 characters. Results are being sent to the Usart Terminal where you can track their changes.

Additional Function

  • void ble6_module_init ( void );
  • void ble6_event_handler ( void );
  • void ble6_display_log ( void );
  • void ble6_aci_gap_init ( void );
  • void ble6_le_meta_event ( void );
  • void ble6_handler ( void );
  • void ble6_response_handler ( void );
  • void ble6_local_version_info ( void );
Note
For communication with BLE 6 click use the android application on the link: https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner
Author
Stefan Ilic

Macro Definition Documentation

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   256

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 )

◆ ble6_aci_gap_init()

void ble6_aci_gap_init ( void )

BLE 6 aci gap initialisation.

This function is used for aci gap initialisation of BLE 6 Click.

◆ ble6_connect_handler()

void ble6_connect_handler ( void )

◆ ble6_display_log()

void ble6_display_log ( void )

BLE 6 display log.

This function is used for displaying log of BLE 6 Click.

◆ ble6_event_handler()

void ble6_event_handler ( void )

BLE 6 event handler.

This function is used for checking conncection of BLE 6 Click.

◆ ble6_handler()

void ble6_handler ( void )

BLE 6 handler.

This function is used for getting data of BLE 6 Click.

◆ ble6_le_meta_event()

void ble6_le_meta_event ( void )

BLE 6 le meta event.

This function is used for low energy events of BLE 6 Click.

◆ ble6_local_version_info()

void ble6_local_version_info ( void )

BLE 6 local version info.

This function is used for displaying local version info of BLE 6 Click.

◆ ble6_module_init()

void ble6_module_init ( void )

BLE 6 module initialisation.

This function is used for initialisation of BLE 6 Click.

◆ ble6_response_handler()

void ble6_response_handler ( void )

BLE 6 response handler.

This function is used for displaying data response of BLE 6 Click.

◆ main()

int main ( void )

Variable Documentation

◆ aci_gap_init

uint8_t aci_gap_init[7] = { 0x01, 0x8A, 0xFC, 0x03, 0x0F, 0x00, 0x0B }

◆ aci_gap_set_discoverable

uint8_t aci_gap_set_discoverable[30]
Initial value:
=
{
0x01, 0x83, 0xFC, 0x19, 0x00, 0x00, 0x08, 0x00, 0x09, 0x00, 0x00, 0x0C, 0x09,
'B', 'L', 'E', ' ', '6', ' ', 'c', 'l', 'i', 'c', 'k', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

◆ aci_gatt_init

uint8_t aci_gatt_init[4] = { 0x01, 0x01, 0xFD, 0x00 }

◆ aci_gatt_update_value

uint8_t aci_gatt_update_value[21]
Initial value:
=
{
0x01, 0x06, 0xFD, 0x11, 0x05, 0x00, 0x06, 0x00, 0x00, 0x0B,
'B', 'L', 'E', ' ', '6', ' ', 'c', 'l', 'i', 'c', 'k'
}

◆ aci_hal_get_fw_version

uint8_t aci_hal_get_fw_version[4] = { 0x01, 0x01, 0xFC, 0x00 }

◆ aci_hal_set_tx_power_level

uint8_t aci_hal_set_tx_power_level[6] = { 0x01, 0x0F, 0xFC, 0x02, 0x01, 0x04 }

◆ aci_hal_write_config_data

uint8_t aci_hal_write_config_data[12]
Initial value:
=
{
0x01, 0x0C, 0xFC, 0x08, 0x00, 0x06, 0x03, 0xEE, 0x00, 0xE1, 0x80, 0x02
}

◆ app_buf

uint8_t app_buf[PROCESS_BUFFER_SIZE]

◆ device_connected_flag

uint8_t device_connected_flag = 0

◆ hci_info_confirm

uint8_t hci_info_confirm[4] = { 0xFF, 0x01, 0x00, 0x00 }

◆ hci_le_meta_event_connect

uint8_t hci_le_meta_event_connect[5] = { 0x04, 0x3E, 0x13, 0x01, 0x00 }

◆ hci_le_serverwrite_event

uint8_t hci_le_serverwrite_event[1] = { 0x04 }

◆ hci_le_set_scan_response_data

uint8_t hci_le_set_scan_response_data[36]
Initial value:
=
{
0x01, 0x09, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}

◆ hci_read_local_version_information

uint8_t hci_read_local_version_information[4] = { 0x01, 0x01, 0x10, 0x00 }

◆ hci_reset

uint8_t hci_reset[4] = { 0x01, 0x03, 0x0C, 0x00 }

◆ rx_response

uint8_t rx_response[PROCESS_BUFFER_SIZE]