bm78  2.1.0.0
Modules | Functions
BM78 Click Driver

API for configuring and manipulating BM78 Click driver. More...

Modules

 BM78 Device Settings
 Settings for registers of BM78 Click driver.
 
 BM78 MikroBUS Map
 MikroBUS pin mapping of BM78 Click driver.
 

Functions

void bm78_cfg_setup (bm78_cfg_t *cfg)
 BM78 configuration object setup function. More...
 
err_t bm78_init (bm78_t *ctx, bm78_cfg_t *cfg)
 BM78 initialization function. More...
 
err_t bm78_generic_write (bm78_t *ctx, uint8_t *data_in, uint16_t len)
 BM78 data writing function. More...
 
err_t bm78_generic_read (bm78_t *ctx, uint8_t *data_out, uint16_t len)
 BM78 data reading function. More...
 
void bm78_set_rst_pin (bm78_t *ctx, uint8_t pin_state)
 BM78 set RST pin function. More...
 
void bm78_set_cts_pin (bm78_t *ctx, uint8_t pin_state)
 BM78 set CTS pin function. More...
 
uint8_t bm78_get_st1_pin (bm78_t *ctx)
 BM78 get ST1 pin function. More...
 
uint8_t bm78_get_st2_pin (bm78_t *ctx)
 BM78 get ST2 pin function. More...
 
uint8_t bm78_get_rts_pin (bm78_t *ctx)
 BM78 get RTS pin function. More...
 
void bm78_hw_reset (bm78_t *ctx)
 BM78 Hardware reset function. More...
 
err_t bm78_eeprom_send_cmd (bm78_t *ctx, uint16_t op_code, uint8_t *param, uint8_t len)
 BM78 EEPROM send command function. More...
 
err_t bm78_eeprom_get_event (bm78_t *ctx, uint8_t *ev_type, uint8_t *len, uint8_t *data_rx)
 BM78 EEPROM get event function. More...
 
err_t bm78_reset_cmd (bm78_t *ctx)
 BM78 reset function. More...
 
err_t bm78_eeprom_write_number (bm78_t *ctx)
 BM78 write EEPROM number function. More...
 
err_t bm78_eeprom_write (bm78_t *ctx, uint16_t address, uint8_t *data_in, uint8_t len)
 BM78 EEPROM write function. More...
 
err_t bm78_eeprom_read (bm78_t *ctx, uint16_t address, uint8_t *data_out, uint8_t len)
 BM78 EEPROM read function. More...
 
err_t bm78_flash_eeprom (bm78_t *ctx)
 BM78 EEPROM flash function. More...
 

Detailed Description

API for configuring and manipulating BM78 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ bm78_cfg_setup()

void bm78_cfg_setup ( bm78_cfg_t cfg)

BM78 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See bm78_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ bm78_eeprom_get_event()

err_t bm78_eeprom_get_event ( bm78_t ctx,
uint8_t *  ev_type,
uint8_t *  len,
uint8_t *  data_rx 
)

BM78 EEPROM get event function.

This function is used to get event data by using UART serial interface.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
[out]ev_type: Event type.
[out]len: Number of bytes that are read.
[out]data_rx: Output read data.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_eeprom_read()

err_t bm78_eeprom_read ( bm78_t ctx,
uint16_t  address,
uint8_t *  data_out,
uint8_t  len 
)

BM78 EEPROM read function.

This function is used to read back the data from the EEPROM location specified by the address paramete.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
[in]address: Start writing address.
[in]data_out: Read data.
[in]len: Number of bytes to be read.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_eeprom_send_cmd()

err_t bm78_eeprom_send_cmd ( bm78_t ctx,
uint16_t  op_code,
uint8_t *  param,
uint8_t  len 
)

BM78 EEPROM send command function.

This function is used to send specific EEPROM command by using UART serial interface.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
[in]op_code: Specific 16-bit operation code.
[in]param: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_eeprom_write()

err_t bm78_eeprom_write ( bm78_t ctx,
uint16_t  address,
uint8_t *  data_in,
uint8_t  len 
)

BM78 EEPROM write function.

This function is used to write data into the EEPROM location specified by the address parameter.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
[in]address: Start writing address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_eeprom_write_number()

err_t bm78_eeprom_write_number ( bm78_t ctx)

BM78 write EEPROM number function.

This function is used to specify the size of the EEPROM write operation.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
For the BM78 module Write number parameter is fixed as 0x08.

◆ bm78_flash_eeprom()

err_t bm78_flash_eeprom ( bm78_t ctx)

BM78 EEPROM flash function.

This function is used write default configuration into the EEPROM.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_generic_read()

err_t bm78_generic_read ( bm78_t ctx,
uint8_t *  data_out,
uint16_t  len 
)

BM78 data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_generic_write()

err_t bm78_generic_write ( bm78_t ctx,
uint8_t *  data_in,
uint16_t  len 
)

BM78 data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
[in]data_in: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_get_rts_pin()

uint8_t bm78_get_rts_pin ( bm78_t ctx)

BM78 get RTS pin function.

This function is used to get RTS pin state.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
Returns
  • 1 - Pin state high,
  • 0 - Pin state low.
Note
None.

◆ bm78_get_st1_pin()

uint8_t bm78_get_st1_pin ( bm78_t ctx)

BM78 get ST1 pin function.

This function is used to get ST1 pin state.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
Returns
  • 1 - Pin state high,
  • 0 - Pin state low.
Note
None.

◆ bm78_get_st2_pin()

uint8_t bm78_get_st2_pin ( bm78_t ctx)

BM78 get ST2 pin function.

This function is used to get ST2 pin state.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
Returns
  • 1 - Pin state high,
  • 0 - Pin state low.
Note
None.

◆ bm78_hw_reset()

void bm78_hw_reset ( bm78_t ctx)

BM78 Hardware reset function.

This function is used to perform hardware reset.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ bm78_init()

err_t bm78_init ( bm78_t ctx,
bm78_cfg_t cfg 
)

BM78 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See bm78_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See bm78_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_reset_cmd()

err_t bm78_reset_cmd ( bm78_t ctx)

BM78 reset function.

This function is used to reset device to enable the EEPROM operation.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ bm78_set_cts_pin()

void bm78_set_cts_pin ( bm78_t ctx,
uint8_t  pin_state 
)

BM78 set CTS pin function.

This function is used to set CTS pin state.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
[in]pin_state: Selected pin state.
Returns
Nothing.
Note
None.

◆ bm78_set_rst_pin()

void bm78_set_rst_pin ( bm78_t ctx,
uint8_t  pin_state 
)

BM78 set RST pin function.

This function is used to set RST pin state.

Parameters
[in]ctx: Click context object. See bm78_t object definition for detailed explanation.
[in]pin_state: Selected pin state.
Returns
Nothing.
Note
None.