BM78 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 BM78 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 BM78 Click driver.
Standard key functions :
bm78_cfg_setup
Config Object Initialization function.
void bm78_cfg_setup(bm78_cfg_t *cfg)
BM78 configuration object setup function.
BM78 Click configuration object.
Definition: bm78.h:165
bm78_init
Initialization function.
err_t bm78_init(bm78_t *ctx, bm78_cfg_t *cfg)
BM78 initialization function.
BM78 Click context object.
Definition: bm78.h:141
Example key functions :
bm78_eeprom_send_cmd
This function is used to send specific EEPROM command by using UART serial interface.
err_t bm78_eeprom_send_cmd(bm78_t *ctx, uint16_t op_code, uint8_t *param, uint8_t len)
BM78 EEPROM send command function.
bm78_eeprom_write
This function is used to write data into the EEPROM location specified by the address parameter.
err_t bm78_eeprom_write(bm78_t *ctx, uint16_t address, uint8_t *data_in, uint8_t len)
BM78 EEPROM write function.
bm78_flash_eeprom
This function is used write default configuration into the EEPROM.
err_t bm78_flash_eeprom(bm78_t *ctx)
BM78 EEPROM flash function.
Example Description
This example demonstrates the use of BM78 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 and performs the click default configuration by writing it into the EEPROM.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( UART_ERROR ==
bm78_init( &bm78, &bm78_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
uint8_t tmp_data[ 16 ];
Delay_ms( 100 );
log_printf( &logger, " = = = = = = = = = = = = = = = = = \r\n" );
log_printf( &logger, " Place Click into Write EEPROM mode \r\n" );
log_printf( &logger, " By setting MODE SEL in the following configuration \r\n" );
log_printf( &logger, " | 1 | 2 | 3 | \r\n" );
log_printf( &logger, " | H | L | L | \r\n" );
log_printf( &logger, " = = = = = = = = = = = = = = = = = \r\n" );
log_printf( &logger, " Send YES once you placed Click into Write EEPROM mode \r\n" );
#define WANTED_ANSWER "YES/r/n"
log_printf( &logger, " = = = = = = = = = = = = = = = = = \r\n" );
while ( 1 )
{
log_read( &logger, &tmp_data, 5 );
{
break;
}
else
{
log_printf( &logger, " Send YES once you placed Click into Write EEPROM mode \r\n" );
}
}
log_printf( &logger, " Writing into the EEPROM \r\n" );
{
log_error( &logger, " EEPROM Flash failed. " );
log_printf( &logger, " Check Selected Click mode. \r\n" );
for ( ; ; );
}
log_printf( &logger, " = = = = = = = = = = = = = = = = = \r\n" );
log_printf( &logger, " Place Click into Application mode \r\n" );
log_printf( &logger, " By setting MODE SEL in the following configuration \r\n" );
log_printf( &logger, " | 1 | 2 | 3 | \r\n" );
log_printf( &logger, " | L | L | L | \r\n" );
log_printf( &logger, " = = = = = = = = = = = = = = = = = \r\n" );
log_printf( &logger, " Send YES once you placed Click into Application mode \r\n" );
log_printf( &logger, " = = = = = = = = = = = = = = = = = \r\n" );
while ( 1 )
{
log_read( &logger, &tmp_data, 5 );
{
break;
}
else
{
log_printf( &logger, " Send YES once you placed Click into Application mode \r\n" );
}
}
log_info( &logger, " Application Task " );
log_printf( &logger, " Connect to the device using the Serial Bluetooth Terminal App \r\n\r\n" );
}
@ BM78_ERROR
Definition: bm78.h:193
#define BM78_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: bm78.h:124
err_t bm78_generic_read(bm78_t *ctx, uint8_t *data_out, uint16_t len)
BM78 data reading function.
void bm78_hw_reset(bm78_t *ctx)
BM78 Hardware reset function.
void application_init(void)
Definition: main.c:70
Application Task
Reads and processes all incoming data from the Serial Bluetooth Terminal smartphone application and displays them on the USB UART.
{
if (
BM78_OK == bm78_process( &bm78 ) )
{
bm78_log_app_buf( );
bm78_clear_app_buf( );
}
}
@ BM78_OK
Definition: bm78.h:192
void application_task(void)
Definition: main.c:158
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.
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.BM78
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.