bluetooth2 2.0.0.0
main.c File Reference

Bluetooth2 Click Example. More...

#include "board.h"
#include "log.h"
#include "bluetooth2.h"

Macros

#define PROCESS_BUFFER_SIZE   200
 
#define RSP_OK   "OK."
 
#define RSP_READY   "READY."
 
#define RSP_RING   "RING"
 
#define RSP_NO_CARRIER   "NO CARRIER"
 
#define DEVICE_NAME   "Bluetooth2 Click"
 
#define TEXT_TO_SEND   "MikroE - Bluetooth2 click\r\n"
 
#define SENDING_FREQ   5000
 

Functions

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

Detailed Description

Bluetooth2 Click Example.

Description

This example reads and processes data from Bluetooth2 clicks.

The demo application is composed of two sections :

Application Init

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

Application Task

Logs all the received messages/responses on the USB UART, and if there's any device connected to the click board the module sends a desired message every 5 seconds back to it.

Additional Function

  • static void bluetooth2_clear_app_buf ( void )
  • static err_t bluetooth2_process ( void )
  • static err_t bluetooth2_display_rsp ( uint16_t timeout )
Note
We have used the Serial Bluetooth Terminal smartphone application for the test. A smartphone and the click board must be paired in order to exchange messages with each other.
Author
Stefan Filipovic

Macro Definition Documentation

◆ DEVICE_NAME

#define DEVICE_NAME   "Bluetooth2 Click"

◆ PROCESS_BUFFER_SIZE

#define PROCESS_BUFFER_SIZE   200

◆ RSP_NO_CARRIER

#define RSP_NO_CARRIER   "NO CARRIER"

◆ RSP_OK

#define RSP_OK   "OK."

◆ RSP_READY

#define RSP_READY   "READY."

◆ RSP_RING

#define RSP_RING   "RING"

◆ SENDING_FREQ

#define SENDING_FREQ   5000

◆ TEXT_TO_SEND

#define TEXT_TO_SEND   "MikroE - Bluetooth2 click\r\n"

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 )