rn4870
2.0.0.0
|
Functions | |
void | rn4870_cfg_setup (rn4870_cfg_t *cfg) |
Config Object Initialization function. More... | |
RN4870_RETVAL | rn4870_init (rn4870_t *ctx, rn4870_cfg_t *cfg) |
Initialization function. More... | |
void | rn4870_default_cfg (rn4870_t *ctx) |
Click Default Configuration function. More... | |
void | rn4870_reset (rn4870_t *ctx) |
Hardware reset function. More... | |
void | rn4870_generic_write (rn4870_t *ctx, char *data_buf, uint16_t len) |
Generic write function. More... | |
int16_t | rn4870_generic_read (rn4870_t *ctx, char *data_buf, uint16_t max_len) |
Generic read function. More... | |
void | rn4870_uart_write (rn4870_t *ctx, uint8_t *tx_data) |
UART write function. More... | |
void | rn4870_initialize (rn4870_t *ctx, char *dev_addr) |
Initialization RN4870 module. More... | |
void | rn4870_connect (rn4870_t *ctx, char *dev_addr) |
Connecting to slave device. More... | |
void | rn4870_disconnect (rn4870_t *ctx) |
Disconnecting from slave device. More... | |
void | rn4870_send (rn4870_t *ctx, uint8_t msg_type, uint16_t data_type, uint8_t dev_id, uint8_t *tx_data) |
Send message function. More... | |
void | rn4870_receive (rn4870_t *ctx, char character) |
Receiving character function. More... | |
uint8_t | rn4870_read (rn4870_t *ctx, uint8_t *rx_data) |
Read received message function. More... | |
uint8_t | rn4870_get_interrupt (rn4870_t *ctx) |
Get interrupt state function. More... | |
void | rn4870_set_rst (rn4870_t *ctx) |
Set states of RST pin to high function. More... | |
void | rn4870_clear_rst (rn4870_t *ctx) |
Clear states of RST pin function. More... | |
void | rn4870_set_rts (rn4870_t *ctx) |
Set states of RTS pin function. More... | |
void | rn4870_clear_rts (rn4870_t *ctx) |
Clear states of RTS pin function. More... | |
void | rn4870_set_pwm (rn4870_t *ctx) |
Set states of PWM pin function. More... | |
void | rn4870_clear_pwm (rn4870_t *ctx) |
Clear states of PWM pin function. More... | |
void rn4870_cfg_setup | ( | rn4870_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
This function initializes click configuration structure to init state.
void rn4870_clear_pwm | ( | rn4870_t * | ctx | ) |
Clear states of PWM pin function.
ctx | Click object. |
The function clear states of PWM pin by sets states of PWM pin to low.
void rn4870_clear_rst | ( | rn4870_t * | ctx | ) |
Clear states of RST pin function.
ctx | Click object. |
The function clear states of RST pin by sets states of RST pin to low.
void rn4870_clear_rts | ( | rn4870_t * | ctx | ) |
Clear states of RTS pin function.
ctx | Click object. |
The function clear states of RTS pin by sets states of CS pin to low.
void rn4870_connect | ( | rn4870_t * | ctx, |
char * | dev_addr | ||
) |
Connecting to slave device.
ctx | Click object. |
dev_addr | Pointer to the memory location where slave device with be stored |
The function connects to slave device with desired register address by secures the connection and entering data stream mode.
void rn4870_default_cfg | ( | rn4870_t * | ctx | ) |
Click Default Configuration function.
ctx | Click object. |
This function executes default configuration for Rn4870 click.
void rn4870_disconnect | ( | rn4870_t * | ctx | ) |
Disconnecting from slave device.
ctx | Click object. |
The function disconnects from slave device by enters CMD mode and kills connection.
int16_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. |
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. |
This function write buffer of specific length
uint8_t rn4870_get_interrupt | ( | rn4870_t * | ctx | ) |
Get interrupt state function.
ctx | Click object. |
The function gets interrupt state by return status of INT pin.
RN4870_RETVAL rn4870_init | ( | rn4870_t * | ctx, |
rn4870_cfg_t * | cfg | ||
) |
Initialization function.
ctx | Click object. |
cfg | Click configuration structure. |
This function initializes all necessary pins and peripherals used for this click.
void rn4870_initialize | ( | rn4870_t * | ctx, |
char * | dev_addr | ||
) |
Initialization RN4870 module.
ctx | Click object. |
dev_addr | Pointer to the memory location where dev_addr be stored |
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_read | ( | rn4870_t * | ctx, |
uint8_t * | rx_data | ||
) |
Read received message function.
ctx | Click object. |
rx_data | pointer to the memory location where the read text data is stored |
<pre> |
|
The function check message from if data received ( if flag was set ), stores received message to rx_data pointer to the memory location where the read text data is stored and replaces '*' - character with end of string - '0x00'.
void rn4870_receive | ( | rn4870_t * | ctx, |
char | character | ||
) |
Receiving character function.
ctx | Click object. |
character | Received character |
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. |
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_send | ( | rn4870_t * | ctx, |
uint8_t | msg_type, | ||
uint16_t | data_type, | ||
uint8_t | dev_id, | ||
uint8_t * | tx_data | ||
) |
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 |
The function sends message to slave device.
void rn4870_set_pwm | ( | rn4870_t * | ctx | ) |
Set states of PWM pin function.
ctx | Click object. |
The function set states of PWM pin by sets states of PWM pin to high.
void rn4870_set_rst | ( | rn4870_t * | ctx | ) |
Set states of RST pin to high function.
ctx | Click object. |
The function set states of RST pin to high.
void rn4870_set_rts | ( | rn4870_t * | ctx | ) |
Set states of RTS pin function.
ctx | Click object. |
The function set states of RST pin by sets states of CS pin to high.
void rn4870_uart_write | ( | rn4870_t * | ctx, |
uint8_t * | tx_data | ||
) |
UART write function.
ctx | Click object. |
tx_data | Tx buffer |
This function is for UART writing