Hardware access layer for managing the TWI peripheral. More...
Enumerations |
|
| enum |
nrf_twi_task_t
{
NRF_TWI_TASK_STARTRX = offsetof(NRF_TWI_Type, TASKS_STARTRX), NRF_TWI_TASK_STARTTX = offsetof(NRF_TWI_Type, TASKS_STARTTX), NRF_TWI_TASK_STOP = offsetof(NRF_TWI_Type, TASKS_STOP), NRF_TWI_TASK_SUSPEND = offsetof(NRF_TWI_Type, TASKS_SUSPEND), NRF_TWI_TASK_RESUME = offsetof(NRF_TWI_Type, TASKS_RESUME) } |
|
TWI tasks.
More...
|
|
| enum |
nrf_twi_event_t
{
NRF_TWI_EVENT_STOPPED = offsetof(NRF_TWI_Type, EVENTS_STOPPED), NRF_TWI_EVENT_RXDREADY = offsetof(NRF_TWI_Type, EVENTS_RXDREADY), NRF_TWI_EVENT_TXDSENT = offsetof(NRF_TWI_Type, EVENTS_TXDSENT), NRF_TWI_EVENT_ERROR = offsetof(NRF_TWI_Type, EVENTS_ERROR), NRF_TWI_EVENT_BB = offsetof(NRF_TWI_Type, EVENTS_BB), NRF_TWI_EVENT_SUSPENDED = offsetof(NRF_TWI_Type, EVENTS_SUSPENDED) } |
|
TWI events.
More...
|
|
| enum |
nrf_twi_short_mask_t
{
NRF_TWI_SHORT_BB_SUSPEND_MASK = TWI_SHORTS_BB_SUSPEND_Msk, NRF_TWI_SHORT_BB_STOP_MASK = TWI_SHORTS_BB_STOP_Msk } |
|
TWI shortcuts.
More...
|
|
| enum |
nrf_twi_int_mask_t
{
NRF_TWI_INT_STOPPED_MASK = TWI_INTENSET_STOPPED_Msk, NRF_TWI_INT_RXDREADY_MASK = TWI_INTENSET_RXDREADY_Msk, NRF_TWI_INT_TXDSENT_MASK = TWI_INTENSET_TXDSENT_Msk, NRF_TWI_INT_ERROR_MASK = TWI_INTENSET_ERROR_Msk, NRF_TWI_INT_BB_MASK = TWI_INTENSET_BB_Msk, NRF_TWI_INT_SUSPENDED_MASK = TWI_INTENSET_SUSPENDED_Msk } |
|
TWI interrupts.
More...
|
|
| enum |
nrf_twi_error_t
{
NRF_TWI_ERROR_ADDRESS_NACK = TWI_ERRORSRC_ANACK_Msk, NRF_TWI_ERROR_DATA_NACK = TWI_ERRORSRC_DNACK_Msk, NRF_TWI_ERROR_OVERRUN = TWI_ERRORSRC_OVERRUN_Msk } |
|
TWI error source.
More...
|
|
| enum |
nrf_twi_frequency_t
{
NRF_TWI_FREQ_100K = TWI_FREQUENCY_FREQUENCY_K100, NRF_TWI_FREQ_250K = TWI_FREQUENCY_FREQUENCY_K250, NRF_TWI_FREQ_400K = TWI_FREQUENCY_FREQUENCY_K400 } |
|
TWI master clock frequency.
More...
|
|
Functions |
|
| __STATIC_INLINE void | nrf_twi_task_trigger (NRF_TWI_Type *p_reg, nrf_twi_task_t task) |
|
Function for activating a specific TWI task.
More...
|
|
| __STATIC_INLINE uint32_t * | nrf_twi_task_address_get (NRF_TWI_Type *p_reg, nrf_twi_task_t task) |
|
Function for getting the address of a specific TWI task register.
More...
|
|
| __STATIC_INLINE void | nrf_twi_event_clear (NRF_TWI_Type *p_reg, nrf_twi_event_t event) |
|
Function for clearing a specific TWI event.
More...
|
|
| __STATIC_INLINE bool | nrf_twi_event_check (NRF_TWI_Type *p_reg, nrf_twi_event_t event) |
|
Function for checking the state of a specific event.
More...
|
|
| __STATIC_INLINE uint32_t * | nrf_twi_event_address_get (NRF_TWI_Type *p_reg, nrf_twi_event_t event) |
|
Function for getting the address of a specific TWI event register.
More...
|
|
| __STATIC_INLINE void | nrf_twi_shorts_enable (NRF_TWI_Type *p_reg, uint32_t shorts_mask) |
|
Function for enabling specified shortcuts.
More...
|
|
| __STATIC_INLINE void | nrf_twi_shorts_disable (NRF_TWI_Type *p_reg, uint32_t shorts_mask) |
|
Function for disabling specified shortcuts.
More...
|
|
| __STATIC_INLINE void | nrf_twi_int_enable (NRF_TWI_Type *p_reg, uint32_t int_mask) |
|
Function for enabling specified interrupts.
More...
|
|
| __STATIC_INLINE void | nrf_twi_int_disable (NRF_TWI_Type *p_reg, uint32_t int_mask) |
|
Function for disabling specified interrupts.
More...
|
|
| __STATIC_INLINE bool | nrf_twi_int_enable_check (NRF_TWI_Type *p_reg, nrf_twi_int_mask_t int_mask) |
|
Function for retrieving the state of a given interrupt.
More...
|
|
| __STATIC_INLINE void | nrf_twi_enable (NRF_TWI_Type *p_reg) |
|
Function for enabling the TWI peripheral.
More...
|
|
| __STATIC_INLINE void | nrf_twi_disable (NRF_TWI_Type *p_reg) |
|
Function for disabling the TWI peripheral.
More...
|
|
| __STATIC_INLINE void | nrf_twi_pins_set (NRF_TWI_Type *p_reg, uint32_t scl_pin, uint32_t sda_pin) |
|
Function for configuring TWI pins.
More...
|
|
| __STATIC_INLINE void | nrf_twi_frequency_set (NRF_TWI_Type *p_reg, nrf_twi_frequency_t frequency) |
|
Function for setting the TWI master clock frequency.
More...
|
|
| __STATIC_INLINE uint32_t | nrf_twi_errorsrc_get_and_clear (NRF_TWI_Type *p_reg) |
|
Function for checking the TWI error source.
More...
|
|
| __STATIC_INLINE void | nrf_twi_address_set (NRF_TWI_Type *p_reg, uint8_t address) |
|
Function for setting the address to be used in TWI transfers.
More...
|
|
| __STATIC_INLINE uint8_t | nrf_twi_rxd_get (NRF_TWI_Type *p_reg) |
|
Function for reading data received by TWI.
More...
|
|
| __STATIC_INLINE void | nrf_twi_txd_set (NRF_TWI_Type *p_reg, uint8_t data) |
|
Function for writing data to be transmitted by TWI.
More...
|
|
| __STATIC_INLINE void | nrf_twi_shorts_set (NRF_TWI_Type *p_reg, uint32_t shorts_mask) |
Detailed Description
Hardware access layer for managing the TWI peripheral.
Enumeration Type Documentation
| enum nrf_twi_error_t |
TWI error source.
| enum nrf_twi_event_t |
TWI events.
| enum nrf_twi_frequency_t |
| enum nrf_twi_int_mask_t |
TWI interrupts.
| enum nrf_twi_short_mask_t |
| enum nrf_twi_task_t |
Function Documentation
| __STATIC_INLINE void nrf_twi_address_set | ( | NRF_TWI_Type * | p_reg , |
| uint8_t | address | ||
| ) |
Function for setting the address to be used in TWI transfers.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] address Address to be used in transfers.
| __STATIC_INLINE void nrf_twi_disable | ( | NRF_TWI_Type * | p_reg | ) |
Function for disabling the TWI peripheral.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure.
| __STATIC_INLINE void nrf_twi_enable | ( | NRF_TWI_Type * | p_reg | ) |
Function for enabling the TWI peripheral.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure.
| __STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear | ( | NRF_TWI_Type * | p_reg | ) |
Function for checking the TWI error source.
The error flags are cleared after reading.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure.
- Returns
- Mask with error source flags.
| __STATIC_INLINE uint32_t* nrf_twi_event_address_get | ( | NRF_TWI_Type * | p_reg , |
| nrf_twi_event_t | event | ||
| ) |
Function for getting the address of a specific TWI event register.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] event Requested event.
- Returns
- Address of the specified event register.
| __STATIC_INLINE bool nrf_twi_event_check | ( | NRF_TWI_Type * | p_reg , |
| nrf_twi_event_t | event | ||
| ) |
Function for checking the state of a specific event.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] event Event to check.
- Return values
-
true If the event is set. false If the event is not set.
| __STATIC_INLINE void nrf_twi_event_clear | ( | NRF_TWI_Type * | p_reg , |
| nrf_twi_event_t | event | ||
| ) |
Function for clearing a specific TWI event.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] event Event to clear.
| __STATIC_INLINE void nrf_twi_frequency_set | ( | NRF_TWI_Type * | p_reg , |
| nrf_twi_frequency_t | frequency | ||
| ) |
Function for setting the TWI master clock frequency.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] frequency TWI frequency.
| __STATIC_INLINE void nrf_twi_int_disable | ( | NRF_TWI_Type * | p_reg , |
| uint32_t | int_mask | ||
| ) |
Function for disabling specified interrupts.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] int_mask Interrupts to disable.
| __STATIC_INLINE void nrf_twi_int_enable | ( | NRF_TWI_Type * | p_reg , |
| uint32_t | int_mask | ||
| ) |
Function for enabling specified interrupts.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] int_mask Interrupts to enable.
| __STATIC_INLINE bool nrf_twi_int_enable_check | ( | NRF_TWI_Type * | p_reg , |
| nrf_twi_int_mask_t | int_mask | ||
| ) |
Function for retrieving the state of a given interrupt.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] int_mask Interrupt to check.
- Return values
-
true If the interrupt is enabled. false If the interrupt is not enabled.
| __STATIC_INLINE void nrf_twi_pins_set | ( | NRF_TWI_Type * | p_reg , |
| uint32_t | scl_pin , | ||
| uint32_t | sda_pin | ||
| ) |
Function for configuring TWI pins.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] scl_pin SCL pin number. [in] sda_pin SDA pin number.
| __STATIC_INLINE uint8_t nrf_twi_rxd_get | ( | NRF_TWI_Type * | p_reg | ) |
Function for reading data received by TWI.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure.
- Returns
- Received data.
| __STATIC_INLINE void nrf_twi_shorts_disable | ( | NRF_TWI_Type * | p_reg , |
| uint32_t | shorts_mask | ||
| ) |
Function for disabling specified shortcuts.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] shorts_mask Shortcuts to disable.
| __STATIC_INLINE void nrf_twi_shorts_enable | ( | NRF_TWI_Type * | p_reg , |
| uint32_t | shorts_mask | ||
| ) |
Function for enabling specified shortcuts.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] shorts_mask Shortcuts to enable.
| __STATIC_INLINE uint32_t* nrf_twi_task_address_get | ( | NRF_TWI_Type * | p_reg , |
| nrf_twi_task_t | task | ||
| ) |
Function for getting the address of a specific TWI task register.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] task Requested task.
- Returns
- Address of the specified task register.
| __STATIC_INLINE void nrf_twi_task_trigger | ( | NRF_TWI_Type * | p_reg , |
| nrf_twi_task_t | task | ||
| ) |
Function for activating a specific TWI task.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] task Task to activate.
| __STATIC_INLINE void nrf_twi_txd_set | ( | NRF_TWI_Type * | p_reg , |
| uint8_t | data | ||
| ) |
Function for writing data to be transmitted by TWI.
- Parameters
-
[in] p_reg Pointer to the peripheral registers structure. [in] data Data to be transmitted.