nanobeacon 2.1.0.0
NanoBeacon Click Driver

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

Topics

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

Functions

void nanobeacon_cfg_setup (nanobeacon_cfg_t *cfg)
 NanoBeacon configuration object setup function.
 
err_t nanobeacon_init (nanobeacon_t *ctx, nanobeacon_cfg_t *cfg)
 NanoBeacon initialization function.
 
err_t nanobeacon_generic_write (nanobeacon_t *ctx, uint8_t *data_in, uint16_t len)
 NanoBeacon data writing function.
 
err_t nanobeacon_generic_read (nanobeacon_t *ctx, uint8_t *data_out, uint16_t len)
 NanoBeacon data reading function.
 
uint8_t nanobeacon_get_an_pin (nanobeacon_t *ctx)
 NanoBeacon get an pin function.
 
void nanobeacon_set_en_pin (nanobeacon_t *ctx, uint8_t state)
 NanoBeacon set EN pin function.
 
void nanobeacon_set_dq_pin (nanobeacon_t *ctx, uint8_t state)
 NanoBeacon set DQ pin function.
 
void nanobeacon_restart_device (nanobeacon_t *ctx)
 NanoBeacon restart device function.
 
err_t nanobeacon_send_packet (nanobeacon_t *ctx, nanobeacon_packet_t pkt_in)
 NanoBeacon send packet function.
 
err_t nanobeacon_read_packet (nanobeacon_t *ctx, nanobeacon_packet_t *pkt_out)
 NanoBeacon read packet function.
 
err_t nanobeacon_check_communication (nanobeacon_t *ctx)
 NanoBeacon check communication function.
 
err_t nanobeacon_write_reg (nanobeacon_t *ctx, uint16_t address, uint32_t data_in)
 NanoBeacon write reg function.
 
err_t nanobeacon_read_reg (nanobeacon_t *ctx, uint16_t address, uint32_t *data_out)
 NanoBeacon read reg function.
 
err_t nanobeacon_write_mem (nanobeacon_t *ctx, uint16_t address, uint32_t data_in)
 NanoBeacon write mem function.
 
err_t nanobeacon_read_mem (nanobeacon_t *ctx, uint16_t address, uint32_t *data_out)
 NanoBeacon read mem function.
 
err_t nanobeacon_write_efuse (nanobeacon_t *ctx, uint8_t aid, uint16_t data_in)
 NanoBeacon write efuse function.
 
err_t nanobeacon_read_efuse (nanobeacon_t *ctx, uint8_t aid, uint16_t *data_out)
 NanoBeacon read efuse function.
 
err_t nanobeacon_set_advertising (uint8_t *mac_address, uint16_t interval, uint8_t *adv_raw_data, uint8_t len)
 NanoBeacon set advertising function.
 
err_t nanobeacon_load_adv_to_ram (nanobeacon_t *ctx)
 NanoBeacon load adv to ram function.
 
err_t nanobeacon_start_advertising (nanobeacon_t *ctx)
 NanoBeacon start advertising function.
 

Detailed Description

API for configuring and manipulating NanoBeacon 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

◆ nanobeacon_cfg_setup()

void nanobeacon_cfg_setup ( nanobeacon_cfg_t * cfg)

NanoBeacon configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ nanobeacon_check_communication()

err_t nanobeacon_check_communication ( nanobeacon_t * ctx)

NanoBeacon check communication function.

This function checks the communication by sending the ready request command.

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

◆ nanobeacon_generic_read()

err_t nanobeacon_generic_read ( nanobeacon_t * ctx,
uint8_t * data_out,
uint16_t len )

NanoBeacon data reading function.

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

Parameters
[in]ctx: Click context object. See nanobeacon_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.

◆ nanobeacon_generic_write()

err_t nanobeacon_generic_write ( nanobeacon_t * ctx,
uint8_t * data_in,
uint16_t len )

NanoBeacon data writing function.

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

Parameters
[in]ctx: Click context object. See nanobeacon_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.

◆ nanobeacon_get_an_pin()

uint8_t nanobeacon_get_an_pin ( nanobeacon_t * ctx)

NanoBeacon get an pin function.

This function returns the AN pin logic state.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ nanobeacon_init()

err_t nanobeacon_init ( nanobeacon_t * ctx,
nanobeacon_cfg_t * cfg )

NanoBeacon initialization function.

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

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

◆ nanobeacon_load_adv_to_ram()

err_t nanobeacon_load_adv_to_ram ( nanobeacon_t * ctx)

NanoBeacon load adv to ram function.

This function loads advertising data to RAM.

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

◆ nanobeacon_read_efuse()

err_t nanobeacon_read_efuse ( nanobeacon_t * ctx,
uint8_t aid,
uint16_t * data_out )

NanoBeacon read efuse function.

This function reads data from the selected efuse aid.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[in]aid: 1-byte efuse aid.
[out]data_out: 2-byte data read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nanobeacon_read_mem()

err_t nanobeacon_read_mem ( nanobeacon_t * ctx,
uint16_t address,
uint32_t * data_out )

NanoBeacon read mem function.

This function reads data from the selected memory address.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[in]address: 2-byte memory address.
[out]data_out: 4-byte data read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nanobeacon_read_packet()

err_t nanobeacon_read_packet ( nanobeacon_t * ctx,
nanobeacon_packet_t * pkt_out )

NanoBeacon read packet function.

This function reads a response data packet by using UART serial interface.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[out]pkt_out: Response data packet. See nanobeacon_packet_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nanobeacon_read_reg()

err_t nanobeacon_read_reg ( nanobeacon_t * ctx,
uint16_t address,
uint32_t * data_out )

NanoBeacon read reg function.

This function reads data from the selected register address.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[in]address: 2-byte register address.
[out]data_out: 4-byte data read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nanobeacon_restart_device()

void nanobeacon_restart_device ( nanobeacon_t * ctx)

NanoBeacon restart device function.

This function restarts the device by toggling the EN pin.

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

◆ nanobeacon_send_packet()

err_t nanobeacon_send_packet ( nanobeacon_t * ctx,
nanobeacon_packet_t pkt_in )

NanoBeacon send packet function.

This function sends a command data packet by using UART serial interface.

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

◆ nanobeacon_set_advertising()

err_t nanobeacon_set_advertising ( uint8_t * mac_address,
uint16_t interval,
uint8_t * adv_raw_data,
uint8_t len )

NanoBeacon set advertising function.

This function sets the device MAC address, interval and advertising raw data.

Parameters
[in]mac_address: 6-byte device MAC address (should not be set to all zeros or ones).
[in]interval: Broadcast interval in milliseconds.
[in]adv_raw_data: Advertising raw data buffer (up to 31 bytes).
[in]len: Lenght of advertising raw data buffer.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nanobeacon_set_dq_pin()

void nanobeacon_set_dq_pin ( nanobeacon_t * ctx,
uint8_t state )

NanoBeacon set DQ pin function.

This function sets the DQ pin logic state.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ nanobeacon_set_en_pin()

void nanobeacon_set_en_pin ( nanobeacon_t * ctx,
uint8_t state )

NanoBeacon set EN pin function.

This function sets the EN pin logic state.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ nanobeacon_start_advertising()

err_t nanobeacon_start_advertising ( nanobeacon_t * ctx)

NanoBeacon start advertising function.

This function starts the advertising.

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

◆ nanobeacon_write_efuse()

err_t nanobeacon_write_efuse ( nanobeacon_t * ctx,
uint8_t aid,
uint16_t data_in )

NanoBeacon write efuse function.

This function writes a desired data to the selected efuse aid.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[in]aid: 1-byte efuse aid.
[in]data_in: 2-byte data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nanobeacon_write_mem()

err_t nanobeacon_write_mem ( nanobeacon_t * ctx,
uint16_t address,
uint32_t data_in )

NanoBeacon write mem function.

This function writes a desired data to the selected memory address.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[in]address: 2-byte memory address.
[in]data_in: 4-byte data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nanobeacon_write_reg()

err_t nanobeacon_write_reg ( nanobeacon_t * ctx,
uint16_t address,
uint32_t data_in )

NanoBeacon write reg function.

This function writes a desired data to the selected register address.

Parameters
[in]ctx: Click context object. See nanobeacon_t object definition for detailed explanation.
[in]address: 2-byte register address.
[in]data_in: 4-byte data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.