Appiko
|
Hardware abstraction layer of the Two Wire Interface in Master mode. This driver is completely event driven and non-blocking, suitable for low power applications. More...
Data Structures | |
struct | hal_twim_init_config_t |
Structure for the TWI master driver initialization. More... | |
Macros | |
#define | TWIM_USED HAL_TWIM_PERIPH_USED |
Enumerations | |
enum | hal_twim_freq_t { HAL_TWI_FREQ_100K = TWI_FREQUENCY_FREQUENCY_K100, HAL_TWI_FREQ_250K = TWI_FREQUENCY_FREQUENCY_K250, HAL_TWI_FREQ_400K = TWI_FREQUENCY_FREQUENCY_K400 } |
Defines for TWI master clock frequency. More... | |
enum | twim_transfer_t { TWIM_TX, TWIM_RX, TWIM_TX_RX } |
Defines for the types of transfers possible. More... | |
enum | twim_err_t { TWIM_ERR_NONE, TWIM_ERR_ADRS_NACK, TWIM_ERR_DATA_NACK } |
Defines for the types of errors possible during TWI transactions. More... | |
enum | twim_ret_status { TWIM_STARTED, TWIM_BUSY, TWIM_UNINIT } |
Defines for the return values for the transfer calls. More... | |
Functions | |
void | hal_twim_init (hal_twim_init_config_t *config) |
Function for initializing and enabling one of the TWIM peripheral. More... | |
void | hal_twim_uninit (void) |
Function for uninitializing and disabling one of the TWIM peripheral. | |
twim_ret_status | hal_twim_tx (uint8_t *tx_ptr, uint32_t tx_len) |
Start a Tx only TWI transfer. More... | |
twim_ret_status | hal_twim_rx (uint8_t *rx_ptr, uint32_t rx_len) |
Start a Rx only TWI transfer. More... | |
twim_ret_status | hal_twim_tx_rx (uint8_t *tx_ptr, uint32_t tx_len, uint8_t *rx_ptr, uint32_t rx_len) |
Start a Tx TWI transfer followed by a Rx by repeated start. More... | |
uint32_t | hal_twim_get_current_adrs (void) |
Get the current specified address of the I2C slave. More... | |
Masks for specifying which events calls the handler. These need to be | |
#define | TWIM_TX_DONE_MSK (1<<TWIM_TX) |
#define | TWIM_RX_DONE_MSK (1<<TWIM_RX) |
#define | TWIM_TX_RX_DONE_MSK (1<<TWIM_TX_RX) |
#define TWIM_USED HAL_TWIM_PERIPH_USED |
Specify which TWIM peripheral is used for this HAL module
Definition at line 48 of file hal_twim.h.
enum hal_twim_freq_t |
Enumerator | |
---|---|
HAL_TWI_FREQ_100K | 100 kbps |
HAL_TWI_FREQ_250K | 250 kbps |
HAL_TWI_FREQ_400K | 400 kbps |
Definition at line 52 of file hal_twim.h.
enum twim_err_t |
Definition at line 69 of file hal_twim.h.
enum twim_ret_status |
Enumerator | |
---|---|
TWIM_STARTED | Transfer successfully started. |
TWIM_BUSY | A transfer is already happening. |
TWIM_UNINIT | The TWIM peripheral is not initialized. |
Definition at line 77 of file hal_twim.h.
enum twim_transfer_t |
Enumerator | |
---|---|
TWIM_TX | Only a Tx transfer. |
TWIM_RX | Only a Rx transfer. |
TWIM_TX_RX | A Tx transfer followed by Rx with a repeated start. |
Definition at line 61 of file hal_twim.h.
uint32_t hal_twim_get_current_adrs | ( | void | ) |
Definition at line 266 of file hal_twim.c.
void hal_twim_init | ( | hal_twim_init_config_t * | config | ) |
config | Pointer to the initialization configuration parameters |
Definition at line 100 of file hal_twim.c.
References hal_twim_init_config_t::address, hal_twim_init_config_t::evt_handler, hal_twim_init_config_t::evt_mask, hal_twim_init_config_t::frequency, hal_twim_init_config_t::irq_priority, hal_twim_init_config_t::scl, and hal_twim_init_config_t::sda.
twim_ret_status hal_twim_rx | ( | uint8_t * | rx_ptr, |
uint32_t | rx_len | ||
) |
rx_ptr | Pointer to the data to be received |
rx_len | Length of the data to be received |
Definition at line 210 of file hal_twim.c.
References TWIM_RX, and TWIM_STARTED.
twim_ret_status hal_twim_tx | ( | uint8_t * | tx_ptr, |
uint32_t | tx_len | ||
) |
tx_ptr | Pointer to the data to be transferred |
tx_len | Length of the data to be transferred |
Definition at line 184 of file hal_twim.c.
References TWIM_STARTED, and TWIM_TX.
twim_ret_status hal_twim_tx_rx | ( | uint8_t * | tx_ptr, |
uint32_t | tx_len, | ||
uint8_t * | rx_ptr, | ||
uint32_t | rx_len | ||
) |
tx_ptr | Pointer to the data to be transferred |
tx_len | Length of the data to be transferred |
rx_ptr | Pointer to the data to be received |
rx_len | Length of the data to be received |
Definition at line 236 of file hal_twim.c.
References TWIM_STARTED, and TWIM_TX_RX.