Hardware access layer for managing the TWIM peripheral. More...
Enumerations | |
enum | nrf_twim_task_t { NRF_TWIM_TASK_STARTRX = offsetof(NRF_TWIM_Type, TASKS_STARTRX), NRF_TWIM_TASK_STARTTX = offsetof(NRF_TWIM_Type, TASKS_STARTTX), NRF_TWIM_TASK_STOP = offsetof(NRF_TWIM_Type, TASKS_STOP), NRF_TWIM_TASK_SUSPEND = offsetof(NRF_TWIM_Type, TASKS_SUSPEND), NRF_TWIM_TASK_RESUME = offsetof(NRF_TWIM_Type, TASKS_RESUME) } |
TWIM tasks. More... | |
enum | nrf_twim_event_t { NRF_TWIM_EVENT_STOPPED = offsetof(NRF_TWIM_Type, EVENTS_STOPPED), NRF_TWIM_EVENT_ERROR = offsetof(NRF_TWIM_Type, EVENTS_ERROR), NRF_TWIM_EVENT_SUSPENDED = 0x148, NRF_TWIM_EVENT_RXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_RXSTARTED), NRF_TWIM_EVENT_TXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_TXSTARTED), NRF_TWIM_EVENT_LASTRX = offsetof(NRF_TWIM_Type, EVENTS_LASTRX), NRF_TWIM_EVENT_LASTTX = offsetof(NRF_TWIM_Type, EVENTS_LASTTX) } |
TWIM events. More... | |
enum | nrf_twim_short_mask_t { NRF_TWIM_SHORT_LASTTX_STARTRX_MASK = TWIM_SHORTS_LASTTX_STARTRX_Msk, NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK = TWIM_SHORTS_LASTTX_SUSPEND_Msk, NRF_TWIM_SHORT_LASTTX_STOP_MASK = TWIM_SHORTS_LASTTX_STOP_Msk, NRF_TWIM_SHORT_LASTRX_STARTTX_MASK = TWIM_SHORTS_LASTRX_STARTTX_Msk, NRF_TWIM_SHORT_LASTRX_STOP_MASK = TWIM_SHORTS_LASTRX_STOP_Msk } |
TWIM shortcuts. More... | |
enum | nrf_twim_int_mask_t { NRF_TWIM_INT_STOPPED_MASK = TWIM_INTENSET_STOPPED_Msk, NRF_TWIM_INT_ERROR_MASK = TWIM_INTENSET_ERROR_Msk, NRF_TWIM_INT_SUSPENDED_MASK = (1 << 18), NRF_TWIM_INT_RXSTARTED_MASK = TWIM_INTENSET_RXSTARTED_Msk, NRF_TWIM_INT_TXSTARTED_MASK = TWIM_INTENSET_TXSTARTED_Msk, NRF_TWIM_INT_LASTRX_MASK = TWIM_INTENSET_LASTRX_Msk, NRF_TWIM_INT_LASTTX_MASK = TWIM_INTENSET_LASTTX_Msk } |
TWIM interrupts. More... | |
enum | nrf_twim_frequency_t { NRF_TWIM_FREQ_100K = TWIM_FREQUENCY_FREQUENCY_K100, NRF_TWIM_FREQ_250K = TWIM_FREQUENCY_FREQUENCY_K250, NRF_TWIM_FREQ_400K = TWIM_FREQUENCY_FREQUENCY_K400, NRF_TWI_FREQ_100K = NRF_TWIM_FREQ_100K, NRF_TWI_FREQ_250K = NRF_TWIM_FREQ_250K, NRF_TWI_FREQ_400K = NRF_TWIM_FREQ_400K } |
TWIM master clock frequency. More... | |
enum | nrf_twim_error_t { NRF_TWIM_ERROR_ADDRESS_NACK = TWIM_ERRORSRC_ANACK_Msk, NRF_TWIM_ERROR_DATA_NACK = TWIM_ERRORSRC_DNACK_Msk, NRF_TWI_ERROR_ADDRESS_NACK = NRF_TWIM_ERROR_ADDRESS_NACK, NRF_TWI_ERROR_DATA_NACK = NRF_TWIM_ERROR_DATA_NACK } |
TWIM error source. More... | |
Functions | |
__STATIC_INLINE void | nrf_twim_task_trigger (NRF_TWIM_Type *p_reg, nrf_twim_task_t task) |
Function for activating a specific TWIM task. More... | |
__STATIC_INLINE uint32_t * | nrf_twim_task_address_get (NRF_TWIM_Type *p_reg, nrf_twim_task_t task) |
Function for getting the address of a specific TWIM task register. More... | |
__STATIC_INLINE void | nrf_twim_event_clear (NRF_TWIM_Type *p_reg, nrf_twim_event_t event) |
Function for clearing a specific TWIM event. More... | |
__STATIC_INLINE bool | nrf_twim_event_check (NRF_TWIM_Type *p_reg, nrf_twim_event_t event) |
Function for checking the state of a specific TWIM event. More... | |
__STATIC_INLINE uint32_t * | nrf_twim_event_address_get (NRF_TWIM_Type *p_reg, nrf_twim_event_t event) |
Function for getting the address of a specific TWIM event register. More... | |
__STATIC_INLINE void | nrf_twim_shorts_enable (NRF_TWIM_Type *p_reg, uint32_t shorts_mask) |
Function for enabling specified shortcuts. More... | |
__STATIC_INLINE void | nrf_twim_shorts_disable (NRF_TWIM_Type *p_reg, uint32_t shorts_mask) |
Function for disabling specified shortcuts. More... | |
__STATIC_INLINE void | nrf_twim_int_enable (NRF_TWIM_Type *p_reg, uint32_t int_mask) |
Function for enabling specified interrupts. More... | |
__STATIC_INLINE void | nrf_twim_int_disable (NRF_TWIM_Type *p_reg, uint32_t int_mask) |
Function for disabling specified interrupts. More... | |
__STATIC_INLINE bool | nrf_twim_int_enable_check (NRF_TWIM_Type *p_reg, nrf_twim_int_mask_t int_mask) |
Function for checking the state of a given interrupt. More... | |
__STATIC_INLINE void | nrf_twim_enable (NRF_TWIM_Type *p_reg) |
Function for enabling the TWIM peripheral. More... | |
__STATIC_INLINE void | nrf_twim_disable (NRF_TWIM_Type *p_reg) |
Function for disabling the TWIM peripheral. More... | |
__STATIC_INLINE void | nrf_twim_pins_set (NRF_TWIM_Type *p_reg, uint32_t scl_pin, uint32_t sda_pin) |
Function for configuring TWI pins. More... | |
__STATIC_INLINE void | nrf_twim_frequency_set (NRF_TWIM_Type *p_reg, nrf_twim_frequency_t frequency) |
Function for setting the TWI master clock frequency. More... | |
__STATIC_INLINE uint32_t | nrf_twim_errorsrc_get_and_clear (NRF_TWIM_Type *p_reg) |
Function for checking the TWI error source. More... | |
__STATIC_INLINE void | nrf_twim_address_set (NRF_TWIM_Type *p_reg, uint8_t address) |
Function for setting the address to be used in TWI transfers. More... | |
__STATIC_INLINE void | nrf_twim_tx_buffer_set (NRF_TWIM_Type *p_reg, uint8_t const *p_buffer, uint8_t length) |
Function for setting the transmit buffer. More... | |
__STATIC_INLINE void | nrf_twim_rx_buffer_set (NRF_TWIM_Type *p_reg, uint8_t *p_buffer, uint8_t length) |
Function for setting the receive buffer. More... | |
__STATIC_INLINE void | nrf_twim_shorts_set (NRF_TWIM_Type *p_reg, uint32_t shorts_mask) |
__STATIC_INLINE uint32_t | nrf_twim_txd_amount_get (NRF_TWIM_Type *p_reg) |
__STATIC_INLINE uint32_t | nrf_twim_rxd_amount_get (NRF_TWIM_Type *p_reg) |
__STATIC_INLINE void | nrf_twim_tx_list_enable (NRF_TWIM_Type *p_reg) |
Function for enabling the TX list feature. More... | |
__STATIC_INLINE void | nrf_twim_tx_list_disable (NRF_TWIM_Type *p_reg) |
Function for disabling the TX list feature. More... | |
__STATIC_INLINE void | nrf_twim_rx_list_enable (NRF_TWIM_Type *p_reg) |
Function for enabling the RX list feature. More... | |
__STATIC_INLINE void | nrf_twim_rx_list_disable (NRF_TWIM_Type *p_reg) |
Function for disabling the RX list feature. More... | |
Hardware access layer for managing the TWIM peripheral.
enum nrf_twim_error_t |
enum nrf_twim_event_t |
TWIM events.
enum nrf_twim_frequency_t |
enum nrf_twim_int_mask_t |
TWIM interrupts.
TWIM shortcuts.
enum nrf_twim_task_t |
__STATIC_INLINE void nrf_twim_address_set | ( | NRF_TWIM_Type * | p_reg, |
uint8_t | address | ||
) |
Function for setting the address to be used in TWI transfers.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | address | Address to be used in transfers. |
__STATIC_INLINE void nrf_twim_disable | ( | NRF_TWIM_Type * | p_reg | ) |
Function for disabling the TWIM peripheral.
[in] | p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_twim_enable | ( | NRF_TWIM_Type * | p_reg | ) |
Function for enabling the TWIM peripheral.
[in] | p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE uint32_t nrf_twim_errorsrc_get_and_clear | ( | NRF_TWIM_Type * | p_reg | ) |
Function for checking the TWI error source.
The error flags are cleared after reading.
[in] | p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE uint32_t* nrf_twim_event_address_get | ( | NRF_TWIM_Type * | p_reg, |
nrf_twim_event_t | event | ||
) |
Function for getting the address of a specific TWIM event register.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | event | Requested event. |
__STATIC_INLINE bool nrf_twim_event_check | ( | NRF_TWIM_Type * | p_reg, |
nrf_twim_event_t | event | ||
) |
Function for checking the state of a specific TWIM event.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | event | Event to check. |
true | If the event is set. |
false | If the event is not set. |
__STATIC_INLINE void nrf_twim_event_clear | ( | NRF_TWIM_Type * | p_reg, |
nrf_twim_event_t | event | ||
) |
Function for clearing a specific TWIM event.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | event | Event to clear. |
__STATIC_INLINE void nrf_twim_frequency_set | ( | NRF_TWIM_Type * | p_reg, |
nrf_twim_frequency_t | frequency | ||
) |
Function for setting the TWI master clock frequency.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | frequency | TWI frequency. |
__STATIC_INLINE void nrf_twim_int_disable | ( | NRF_TWIM_Type * | p_reg, |
uint32_t | int_mask | ||
) |
Function for disabling specified interrupts.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | int_mask | Interrupts to disable. |
__STATIC_INLINE void nrf_twim_int_enable | ( | NRF_TWIM_Type * | p_reg, |
uint32_t | int_mask | ||
) |
Function for enabling specified interrupts.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | int_mask | Interrupts to enable. |
__STATIC_INLINE bool nrf_twim_int_enable_check | ( | NRF_TWIM_Type * | p_reg, |
nrf_twim_int_mask_t | int_mask | ||
) |
Function for checking the state of a given interrupt.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | int_mask | Interrupt to check. |
true | If the interrupt is enabled. |
false | If the interrupt is not enabled. |
__STATIC_INLINE void nrf_twim_pins_set | ( | NRF_TWIM_Type * | p_reg, |
uint32_t | scl_pin, | ||
uint32_t | sda_pin | ||
) |
Function for configuring TWI pins.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | scl_pin | SCL pin number. |
[in] | sda_pin | SDA pin number. |
__STATIC_INLINE void nrf_twim_rx_buffer_set | ( | NRF_TWIM_Type * | p_reg, |
uint8_t * | p_buffer, | ||
uint8_t | length | ||
) |
Function for setting the receive buffer.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | p_buffer | Pointer to the buffer for received data. |
[in] | length | Maximum number of data bytes to receive. |
__STATIC_INLINE void nrf_twim_rx_list_disable | ( | NRF_TWIM_Type * | p_reg | ) |
Function for disabling the RX list feature.
[in] | p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_twim_rx_list_enable | ( | NRF_TWIM_Type * | p_reg | ) |
Function for enabling the RX list feature.
[in] | p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_twim_shorts_disable | ( | NRF_TWIM_Type * | p_reg, |
uint32_t | shorts_mask | ||
) |
Function for disabling specified shortcuts.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | shorts_mask | Shortcuts to disable. |
__STATIC_INLINE void nrf_twim_shorts_enable | ( | NRF_TWIM_Type * | p_reg, |
uint32_t | shorts_mask | ||
) |
Function for enabling specified shortcuts.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | shorts_mask | Shortcuts to enable. |
__STATIC_INLINE uint32_t* nrf_twim_task_address_get | ( | NRF_TWIM_Type * | p_reg, |
nrf_twim_task_t | task | ||
) |
Function for getting the address of a specific TWIM task register.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | task | Requested task. |
__STATIC_INLINE void nrf_twim_task_trigger | ( | NRF_TWIM_Type * | p_reg, |
nrf_twim_task_t | task | ||
) |
Function for activating a specific TWIM task.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | task | Task to activate. |
__STATIC_INLINE void nrf_twim_tx_buffer_set | ( | NRF_TWIM_Type * | p_reg, |
uint8_t const * | p_buffer, | ||
uint8_t | length | ||
) |
Function for setting the transmit buffer.
[in] | p_reg | Pointer to the peripheral registers structure. |
[in] | p_buffer | Pointer to the buffer with data to send. |
[in] | length | Maximum number of data bytes to transmit. |
__STATIC_INLINE void nrf_twim_tx_list_disable | ( | NRF_TWIM_Type * | p_reg | ) |
Function for disabling the TX list feature.
[in] | p_reg | Pointer to the peripheral registers structure. |
__STATIC_INLINE void nrf_twim_tx_list_enable | ( | NRF_TWIM_Type * | p_reg | ) |
Function for enabling the TX list feature.
[in] | p_reg | Pointer to the peripheral registers structure. |