rn4870 2.0.0.0
|
Functions | |
void | rn4870_cfg_setup (rn4870_cfg_t *cfg) |
Config Object Initialization function. | |
RN4870_RETVAL | rn4870_init (rn4870_t *ctx, rn4870_cfg_t *cfg) |
Initialization function. | |
void | rn4870_reset (rn4870_t *ctx) |
Hardware reset function. | |
void | rn4870_generic_write (rn4870_t *ctx, char *data_buf, uint16_t len) |
Generic write function. | |
int32_t | rn4870_generic_read (rn4870_t *ctx, char *data_buf, uint16_t max_len) |
Generic read function. | |
uint8_t | rn4870_int_get (rn4870_t *ctx) |
Get interrupt state function. | |
void | rn4870_rst_set (rn4870_t *ctx, uint8_t pin_state) |
Set states of RST pin to desired state. | |
void | rn4870_cs_set (rn4870_t *ctx, uint8_t pin_state) |
Set states of CS pin to desired state. | |
void | rn4870_uart_write (rn4870_t *ctx, uint8_t *wr_buf) |
UART write function. | |
void | rn4870_initialize (rn4870_t *ctx, char *p_addr) |
Initialization RN4870 module. | |
void | rn4870_connect (rn4870_t *ctx, char *p_addr) |
Connecting to slave device. | |
void | rn4870_send (rn4870_t *ctx, uint8_t msg_type, uint16_t data_type, uint8_t id, uint8_t *payload) |
Send message function. | |
void | rn4870_disconnect (rn4870_t *ctx) |
Disconnecting from slave device. | |
void | rn4870_receive (rn4870_t *ctx, char tmp) |
Receiving character function. | |
uint8_t | rn4870_read (rn4870_t *ctx, uint8_t *process_buffer) |
Reading received message. | |
void rn4870_cfg_setup | ( | rn4870_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
void rn4870_connect | ( | rn4870_t * | ctx, |
char * | p_addr ) |
Connecting to slave device.
ctx | Click object. |
dev_addr | Pointer to the memory location where slave device with be stored |
@description The function connects to slave device with desired register address by secures the connection and entering data stream mode.
void rn4870_cs_set | ( | rn4870_t * | ctx, |
uint8_t | pin_state ) |
Set states of CS pin to desired state.
ctx | Click object. |
pin_state | State of pin to be set. |
@description The function set states of CS pin desired state.
void rn4870_disconnect | ( | rn4870_t * | ctx | ) |
Disconnecting from slave device.
ctx | Click object. |
@description The function disconnects from slave device by enters CMD mode and kills connection.
int32_t rn4870_generic_read | ( | rn4870_t * | ctx, |
char * | data_buf, | ||
uint16_t | max_len ) |
Generic read function.
ctx | Click object. |
data_buf | Buffer to be write. |
max_len | Length of data to be read. |
@description This function read buffer of maximum length
void rn4870_generic_write | ( | rn4870_t * | ctx, |
char * | data_buf, | ||
uint16_t | len ) |
Generic write function.
ctx | Click object. |
data_buf | Buffer to be write. |
len | Length of data to be write. |
@description This function write buffer of specific length
RN4870_RETVAL rn4870_init | ( | rn4870_t * | ctx, |
rn4870_cfg_t * | cfg ) |
Initialization function.
ctx | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
void rn4870_initialize | ( | rn4870_t * | ctx, |
char * | p_addr ) |
Initialization RN4870 module.
ctx | Click object. |
dev_addr | Pointer to the memory location where dev_addr be stored |
@description The function initializes RN4870 Bluetooth� 4.2 low energy module by resets the RN4870 module, disable I2C communications pins, reboots the device for change to take effect, enters CMD mode again, and sets the address of the device.
uint8_t rn4870_int_get | ( | rn4870_t * | ctx | ) |
Get interrupt state function.
ctx | Click object. |
@description The function gets interrupt state by return status of INT pin.
uint8_t rn4870_read | ( | rn4870_t * | ctx, |
uint8_t * | process_buffer ) |
Reading received message.
ctx | Click object. |
process_buffer | Buffer for storing received message |
@description This function gets message from 'void rn4870_receive function if flag was set This function replaces '*' (character with end of string) with '0x00' and stores received message to process_buffer
void rn4870_receive | ( | rn4870_t * | ctx, |
char | tmp ) |
Receiving character function.
ctx | Click object. |
tmp | Received character |
@description The function receives character by waits for '#' - character to start parsing message, waits for '*' - character to stop parsing message and sets flag if whole and properly formated message is received.
void rn4870_reset | ( | rn4870_t * | ctx | ) |
Hardware reset function.
ctx | Click object. |
@description The function Hardware reset - resets the RN4870 Bluetooth� 4.2 low energy module by cleared to '0' RST state pin, wait for 100 ms, set to '1' RST state pin and wait for 200 ms.
void rn4870_rst_set | ( | rn4870_t * | ctx, |
uint8_t | pin_state ) |
Set states of RST pin to desired state.
ctx | Click object. |
pin_state | State of pin to be set. |
@description The function set states of RST desired state.
void rn4870_send | ( | rn4870_t * | ctx, |
uint8_t | msg_type, | ||
uint16_t | data_type, | ||
uint8_t | id, | ||
uint8_t * | payload ) |
Send message function.
ctx | Click object. |
msg_type | 8-bit message type ( e.g. message - 'M' = 0x4D ) |
data_type | 16-bit data type ( e.g. sensor 1 - S1 = 0x5331 ) |
dev_id | 8-bit device id ( e.g. slave - 'S' = 0x53 ) |
tx_data | Pointer to the memory location where the text data is stored |
@description The function sends message to slave device.
void rn4870_uart_write | ( | rn4870_t * | ctx, |
uint8_t * | wr_buf ) |
UART write function.
ctx | Click object. |
tx_data | Tx buffer |
@description This function is for UART writing