Common TWI functions.
More...
|
ret_code_t | twi_init (void) |
| Initialize TWI. More...
|
|
ret_code_t | twi_perform (nrf_drv_twi_config_t const *p_bus_config, nrf_twi_mngr_transfer_t const *p_transfers, uint8_t transfer_count) |
| Perform a single synchronous TWI transaction. More...
|
|
ret_code_t | twi_register_bulk_write (nrf_drv_twi_config_t const *p_bus_config, uint8_t device_addr, const uint8_t p_reg_val_array[][2], unsigned int reg_val_array_size, bool perform_verification) |
| Writes to multiple registers of the TWI device. More...
|
|
ret_code_t | twi_register_read (nrf_drv_twi_config_t const *p_bus_config, uint8_t device_addr, uint8_t register_addr, uint8_t *p_value) |
| Reads from the register of the TWI device. More...
|
|
ret_code_t | twi_register_write (nrf_drv_twi_config_t const *p_bus_config, uint8_t device_addr, uint8_t register_addr, uint8_t value) |
| Writes to the register of the TWI device. More...
|
|
ret_code_t | twi_schedule (nrf_twi_mngr_transaction_t const *p_transaction) |
| Perform a single synchronous TWI transaction. More...
|
|
Common TWI functions.
ret_code_t twi_init |
( |
void |
| ) |
|
Initialize TWI.
Function fills in bus configuration with correct data and initializes TWI manager.
- Returns
- NRF_SUCCESS on success, otherwise an error code.
ret_code_t twi_perform |
( |
nrf_drv_twi_config_t const * |
p_bus_config, |
|
|
nrf_twi_mngr_transfer_t const * |
p_transfers, |
|
|
uint8_t |
transfer_count |
|
) |
| |
Perform a single synchronous TWI transaction.
- Parameters
-
[in] | p_bus_config | Required TWI bus configuration. |
[in] | p_transfers | Pointer to an array of transfers to be performed. |
| transfer_count | Number of transfers to be performed. |
- Returns
- NRF_SUCCESS on success, otherwise an error code.
ret_code_t twi_register_bulk_write |
( |
nrf_drv_twi_config_t const * |
p_bus_config, |
|
|
uint8_t |
device_addr, |
|
|
const uint8_t |
p_reg_val_array[][2], |
|
|
unsigned int |
reg_val_array_size, |
|
|
bool |
perform_verification |
|
) |
| |
Writes to multiple registers of the TWI device.
- Parameters
-
[in] | p_bus_config | Required TWI bus configuration. |
[in] | device_addr | Device address. |
[in] | p_reg_val_array | Array of the { register address, value } pairs. |
[in] | reg_val_array_size | Number of the { register address, value } pairs to write. |
[in] | perform_verification | If true, then the register content will be verified after write. |
- Returns
- NRF_SUCCESS on success, otherwise an error code.
ret_code_t twi_register_read |
( |
nrf_drv_twi_config_t const * |
p_bus_config, |
|
|
uint8_t |
device_addr, |
|
|
uint8_t |
register_addr, |
|
|
uint8_t * |
p_value |
|
) |
| |
Reads from the register of the TWI device.
- Parameters
-
[in] | p_bus_config | Required TWI bus configuration. |
[in] | device_addr | Device address. |
[in] | register_addr | Register address. |
[out] | p_value | Pointer to the variable to which the register value will be written. |
- Returns
- NRF_SUCCESS on success, otherwise an error code.
ret_code_t twi_register_write |
( |
nrf_drv_twi_config_t const * |
p_bus_config, |
|
|
uint8_t |
device_addr, |
|
|
uint8_t |
register_addr, |
|
|
uint8_t |
value |
|
) |
| |
Writes to the register of the TWI device.
- Parameters
-
[in] | p_bus_config | Required TWI bus configuration. |
[in] | device_addr | Device address. |
[in] | register_addr | Register address. |
[in] | value | Data to write. |
- Returns
- NRF_SUCCESS on success, otherwise an error code.
ret_code_t twi_schedule |
( |
nrf_twi_mngr_transaction_t const * |
p_transaction | ) |
|
Perform a single synchronous TWI transaction.
- Parameters
-
[in] | p_transaction | Transaction to be scheduled by TWI master. |
- Returns
- NRF_SUCCESS on success, otherwise an error code.