bletiny 2.0.0.0
BLE TINY Click Driver

API for configuring and manipulating BLE TINY Click driver. More...

Topics

 BLE TINY Commands List
 List of commands of BLE TINY Click driver.
 
 BLE TINY Device Settings
 Settings for registers of BLE TINY Click driver.
 
 BLE TINY MikroBUS Map
 MikroBUS pin mapping of BLE TINY Click driver.
 

Functions

void bletiny_cfg_setup (bletiny_cfg_t *cfg)
 BLE TINY configuration object setup function.
 
err_t bletiny_init (bletiny_t *ctx, bletiny_cfg_t *cfg)
 BLE TINY initialization function.
 
err_t bletiny_default_cfg (bletiny_t *ctx)
 BLE TINY default configuration function.
 
err_t bletiny_generic_write (bletiny_t *ctx, char *data_buf, uint16_t len)
 BLE TINY data writing function.
 
err_t bletiny_generic_read (bletiny_t *ctx, char *data_buf, uint16_t max_len)
 BLE TINY data reading function.
 
void bletiny_send_cmd (bletiny_t *ctx, char *cmd)
 Send command function.
 
void bletiny_spi_config (bletiny_t *ctx, uint8_t speed, uint8_t mode)
 Configure Click board for SPI master communication.
 
err_t bletiny_spi_write (bletiny_t *ctx, char *data_buf, uint8_t len)
 Send command to write data to slave device via SPI communication.
 
err_t bletiny_spi_read (bletiny_t *ctx, char *data_buf, uint8_t len)
 Send command to read data from slave device via SPI communication.
 
err_t bletiny_spi_write_then_read (bletiny_t *ctx, uint8_t *data_write, uint8_t write_len, char *data_read, uint8_t read_len)
 Send command to write data to and then read data from slave device via SPI communication.
 
void bletiny_i2c_config (bletiny_t *ctx, uint8_t speed, uint8_t reg_len)
 Configure Click board for I2C master communication.
 
err_t bletiny_i2c_write (bletiny_t *ctx, uint8_t slave_address, uint16_t reg, uint8_t reg_data)
 Send command to write data to reg address of slave device via I2C communication.
 
err_t bletiny_i2c_read (bletiny_t *ctx, uint8_t slave_address, uint16_t reg, uint8_t *data_buf, uint8_t len)
 Send command to read data from slave device via I2C communication.
 

Detailed Description

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

◆ bletiny_cfg_setup()

void bletiny_cfg_setup ( bletiny_cfg_t * cfg)

BLE TINY configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ bletiny_default_cfg()

err_t bletiny_default_cfg ( bletiny_t * ctx)

BLE TINY default configuration function.

This function executes a default configuration of BLE TINY click board.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ bletiny_generic_read()

err_t bletiny_generic_read ( bletiny_t * ctx,
char * data_buf,
uint16_t max_len )

BLE TINY data reading function.

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

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[out]data_buf: Output read data.
[in]max_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.

◆ bletiny_generic_write()

err_t bletiny_generic_write ( bletiny_t * ctx,
char * data_buf,
uint16_t len )

BLE TINY data writing function.

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

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[in]data_buf: 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.

◆ bletiny_i2c_config()

void bletiny_i2c_config ( bletiny_t * ctx,
uint8_t speed,
uint8_t reg_len )

Configure Click board for I2C master communication.

Configure Click board pins for I2C communication and sets I2C communication parameters.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[in]speed: Clock speed.
[in]reg_len: I2C slave register length.
Returns
Nothing.

◆ bletiny_i2c_read()

err_t bletiny_i2c_read ( bletiny_t * ctx,
uint8_t slave_address,
uint16_t reg,
uint8_t * data_buf,
uint8_t len )

Send command to read data from slave device via I2C communication.

Send command over UART to read len bytes of reg address from attached Click board.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[in]slave_address: Slave address to send.
[in]reg: Register address of slave.
[out]data_buf: Read data.
[in]len: Number of bytes to read.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.

◆ bletiny_i2c_write()

err_t bletiny_i2c_write ( bletiny_t * ctx,
uint8_t slave_address,
uint16_t reg,
uint8_t reg_data )

Send command to write data to reg address of slave device via I2C communication.

Send command over UART to write reg_data to reg address of attached Click board.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[in]slave_address: Slave address to send.
[in]reg: Register address of slave.
[in]reg_data: Data to write to reg.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.

◆ bletiny_init()

err_t bletiny_init ( bletiny_t * ctx,
bletiny_cfg_t * cfg )

BLE TINY initialization function.

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

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

◆ bletiny_send_cmd()

void bletiny_send_cmd ( bletiny_t * ctx,
char * cmd )

Send command function.

This function sends the specified command to the click module.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[in]cmd: Command variable.
Returns
Nothing.

◆ bletiny_spi_config()

void bletiny_spi_config ( bletiny_t * ctx,
uint8_t speed,
uint8_t mode )

Configure Click board for SPI master communication.

Configure Click board pins for SPI communication and sets SPI communication parameters.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[in]speed: Clock speed.
[in]mode: SPI mode.
Returns
Nothing.

◆ bletiny_spi_read()

err_t bletiny_spi_read ( bletiny_t * ctx,
char * data_buf,
uint8_t len )

Send command to read data from slave device via SPI communication.

Send command over UART to read len bytes of data_buf from attached Click board.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[out]data_buf: Read data.
[in]len: Number of bytes to read.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.

◆ bletiny_spi_write()

err_t bletiny_spi_write ( bletiny_t * ctx,
char * data_buf,
uint8_t len )

Send command to write data to slave device via SPI communication.

Send command over UART to write len bytes from data_buf to attached Click board.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[in]data_buf: Data to write.
[in]len: Number of bytes to write from data_buf.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.

◆ bletiny_spi_write_then_read()

err_t bletiny_spi_write_then_read ( bletiny_t * ctx,
uint8_t * data_write,
uint8_t write_len,
char * data_read,
uint8_t read_len )

Send command to write data to and then read data from slave device via SPI communication.

Send command over UART to write write_len bytes from data_write, and then to read read_len bytes of data_read from attached Click board.

Parameters
[in]ctx: Click context object. See bletiny_t object definition for detailed explanation.
[out]data_write: Data to write.
[in]write_len: Number of bytes to write from data_write.
[out]data_read: Read data.
[in]read_len: Number of bytes to read.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.