b102c 2.1.0.0
Main Page

B102C click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Ilic
  • Date : Feb 2024.
  • Type : UART type

Software Support

We provide a library for the B102C Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for B102C Click driver.

Standard key functions :

Example key functions :

  • b102c_send_cmd This function sends a specified command to the B102C Click module.
    void b102c_send_cmd ( b102c_t *ctx, uint8_t *cmd );
    void b102c_send_cmd(b102c_t *ctx, uint8_t *cmd)
    B102C send command function.
  • b102c_send_cmd_with_params This function sends a command with specified parameter to the click module.
    void b102c_send_cmd_with_params ( b102c_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf );
    void b102c_send_cmd_with_params(b102c_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
    B102C send command function with parameter.
  • b102c_send_cmd_params_check This function checks the command that is sent.
    void b102c_send_cmd_params_check ( b102c_t *ctx, uint8_t *at_cmd_buf );
    void b102c_send_cmd_params_check(b102c_t *ctx, uint8_t *at_cmd_buf)
    B102C check the command parameters.

Example Description

This example demonstrates the use of B102C click board by processing

the incoming data and displaying them on the USB UART.

The demo application is composed of two sections :

Application Init

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

void application_init ( void )
{
log_cfg_t log_cfg;
b102c_cfg_t b102c_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
b102c_cfg_setup( &b102c_cfg );
B102C_MAP_MIKROBUS( b102c_cfg, MIKROBUS_1 );
if ( UART_ERROR == b102c_init( &b102c, &b102c_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
Delay_ms( 100 );
log_printf( &logger, " Software reset. \r\n" );
app_error_flag = b102c_rsp_check( &b102c, B102C_RSP_READY );
log_printf( &logger, " Factory reset. \r\n" );
app_error_flag = b102c_rsp_check( &b102c, B102C_RSP_READY );
log_printf( &logger, " Set device name. \r\n" );
#define DEVICE_NAME "B102C Click"
app_error_flag = b102c_rsp_check( &b102c, B102C_RSP_OK );
log_printf( &logger, " Set Auto broadcast mode. \r\n" );
#define AUTO_BRODCAST "1"
app_error_flag = b102c_rsp_check( &b102c, B102C_RSP_OK );
log_info( &logger, " Application Task " );
log_printf( &logger, " Connect to device. " );
}
#define B102C_CMD_ADVMOD
Definition: b102c.h:75
#define B102C_RSP_READY
Definition: b102c.h:99
#define B102C_CMD_NAME
Definition: b102c.h:72
#define B102C_CMD_RESET
Definition: b102c.h:70
#define B102C_RSP_OK
B102C response.
Definition: b102c.h:97
#define B102C_CMD_DEFAULT
Definition: b102c.h:86
#define B102C_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: b102c.h:132
void application_init(void)
Definition: main.c:91
#define AUTO_BRODCAST
#define DEVICE_NAME

Application Task

Reads and processes all incoming data and displays them on the USB UART.

void application_task ( void )
{
if ( B102C_OK == b102c_process( &b102c ) )
{
b102c_log_app_buf( );
b102c_clear_app_buf( );
}
}
@ B102C_OK
Definition: b102c.h:186
void application_task(void)
Definition: main.c:141

Note

For communication with B102C click use the android application on the link: https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.B102C

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.