nrfx 3.3
Data Structures | Macros | Functions
TWIM HALY

Hardware access layer with cache and barrier support for managing the TWIM peripheral. More...

Data Structures

struct  nrfy_twim_pins_t
 TWIM pins configuration structure. More...
 
struct  nrfy_twim_config_t
 TWIM configuration structure. More...
 
struct  nrfy_twim_xfer_desc_t
 Structure describing a TWIM transfer. More...
 

Macros

#define NRFY_TWIM_HAS_ARRAY_LIST   1
 

Functions

NRFY_STATIC_INLINE void nrfy_twim_periph_configure (NRF_TWIM_Type *p_reg, nrfy_twim_config_t const *p_config)
 Function for configuring the TWIM.
 
NRFY_STATIC_INLINE void nrfy_twim_int_init (NRF_TWIM_Type *p_reg, uint32_t mask, uint8_t irq_priority, bool enable)
 Function for initializing the specified TWIM interrupts.
 
NRFY_STATIC_INLINE void nrfy_twim_int_uninit (NRF_TWIM_Type *p_reg)
 Function for uninitializing the TWIM interrupts.
 
NRFY_STATIC_INLINE uint32_t nrfy_twim_events_process (NRF_TWIM_Type *p_reg, uint32_t mask, nrfy_twim_xfer_desc_t const *p_xfer)
 Function for processing the specified TWIM events.
 
NRFY_STATIC_INLINE void nrfy_twim_tx_buffer_set (NRF_TWIM_Type *p_reg, nrfy_twim_xfer_desc_t const *p_xfer)
 Function for setting the TWIM transaction buffer.
 
NRFY_STATIC_INLINE void nrfy_twim_rx_buffer_set (NRF_TWIM_Type *p_reg, nrfy_twim_xfer_desc_t const *p_xfer)
 Function for setting the TWIM reception buffer.
 
NRFY_STATIC_INLINE void nrfy_twim_tx_start (NRF_TWIM_Type *p_reg, nrfy_twim_xfer_desc_t const *p_xfer)
 Function for starting TWIM transaction.
 
NRFY_STATIC_INLINE void nrfy_twim_rx_start (NRF_TWIM_Type *p_reg, nrfy_twim_xfer_desc_t const *p_xfer)
 Function for starting TWIM reception.
 
NRFY_STATIC_INLINE void nrfy_twim_abort (NRF_TWIM_Type *p_reg, nrfy_twim_xfer_desc_t const *p_xfer)
 Function for aborting the ongoing TWIM transaction.
 
NRFY_STATIC_INLINE void nrfy_twim_pins_get (NRF_TWIM_Type const *p_reg, nrfy_twim_pins_t *p_pins)
 Function for getting TWIM pins configuration.
 
NRFY_STATIC_INLINE void nrfy_twim_stop (NRF_TWIM_Type *p_reg)
 Function for disabling TWIM with all interrupts and shortcuts.
 
NRFY_STATIC_INLINE void nrfy_twim_tx_list_set (NRF_TWIM_Type *p_reg, bool enable)
 Function for enabling or disabling the TX list feature.
 
NRFY_STATIC_INLINE void nrfy_twim_rx_list_set (NRF_TWIM_Type *p_reg, bool enable)
 Function for enabling or disabling the RX list feature.
 
NRFY_STATIC_INLINE void nrfy_twim_pins_set (NRF_TWIM_Type *p_reg, nrfy_twim_pins_t const *p_pins)
 Function for setting the TWIM pins configuration.
 
NRFY_STATIC_INLINE void nrfy_twim_task_trigger (NRF_TWIM_Type *p_reg, nrf_twim_task_t task)
 
NRFY_STATIC_INLINE uint32_t nrfy_twim_task_address_get (NRF_TWIM_Type const *p_reg, nrf_twim_task_t task)
 
NRFY_STATIC_INLINE void nrfy_twim_event_clear (NRF_TWIM_Type *p_reg, nrf_twim_event_t event)
 
NRFY_STATIC_INLINE bool nrfy_twim_event_check (NRF_TWIM_Type const *p_reg, nrf_twim_event_t event)
 
NRFY_STATIC_INLINE uint32_t nrfy_twim_event_address_get (NRF_TWIM_Type const *p_reg, nrf_twim_event_t event)
 
NRFY_STATIC_INLINE void nrfy_twim_shorts_enable (NRF_TWIM_Type *p_reg, uint32_t mask)
 
NRFY_STATIC_INLINE void nrfy_twim_shorts_disable (NRF_TWIM_Type *p_reg, uint32_t mask)
 
NRFY_STATIC_INLINE void nrfy_twim_int_enable (NRF_TWIM_Type *p_reg, uint32_t mask)
 
NRFY_STATIC_INLINE void nrfy_twim_int_disable (NRF_TWIM_Type *p_reg, uint32_t mask)
 
NRFY_STATIC_INLINE uint32_t nrfy_twim_int_enable_check (NRF_TWIM_Type const *p_reg, uint32_t mask)
 
NRFY_STATIC_INLINE void nrfy_twim_subscribe_set (NRF_TWIM_Type *p_reg, nrf_twim_task_t task, uint8_t channel)
 
NRFY_STATIC_INLINE void nrfy_twim_subscribe_clear (NRF_TWIM_Type *p_reg, nrf_twim_task_t task)
 
NRFY_STATIC_INLINE void nrfy_twim_publish_set (NRF_TWIM_Type *p_reg, nrf_twim_event_t event, uint8_t channel)
 
NRFY_STATIC_INLINE void nrfy_twim_publish_clear (NRF_TWIM_Type *p_reg, nrf_twim_event_t event)
 
NRFY_STATIC_INLINE void nrfy_twim_enable (NRF_TWIM_Type *p_reg)
 
NRFY_STATIC_INLINE void nrfy_twim_disable (NRF_TWIM_Type *p_reg)
 
NRFY_STATIC_INLINE uint32_t nrfy_twim_scl_pin_get (NRF_TWIM_Type const *p_reg)
 
NRFY_STATIC_INLINE uint32_t nrfy_twim_sda_pin_get (NRF_TWIM_Type const *p_reg)
 
NRFY_STATIC_INLINE void nrfy_twim_frequency_set (NRF_TWIM_Type *p_reg, nrf_twim_frequency_t frequency)
 
NRFY_STATIC_INLINE uint32_t nrfy_twim_errorsrc_get_and_clear (NRF_TWIM_Type *p_reg)
 
NRFY_STATIC_INLINE void nrfy_twim_address_set (NRF_TWIM_Type *p_reg, uint8_t address)
 
NRFY_STATIC_INLINE void nrfy_twim_shorts_set (NRF_TWIM_Type *p_reg, uint32_t mask)
 
NRFY_STATIC_INLINE uint32_t nrfy_twim_shorts_get (NRF_TWIM_Type const *p_reg)
 
NRFY_STATIC_INLINE size_t nrfy_twim_txd_amount_get (NRF_TWIM_Type const *p_reg)
 
NRFY_STATIC_INLINE size_t nrfy_twim_rxd_amount_get (NRF_TWIM_Type const *p_reg)
 
NRFY_STATIC_INLINE void nrfy_twim_tx_list_enable (NRF_TWIM_Type *p_reg)
 
NRFY_STATIC_INLINE void nrfy_twim_tx_list_disable (NRF_TWIM_Type *p_reg)
 
NRFY_STATIC_INLINE void nrfy_twim_rx_list_enable (NRF_TWIM_Type *p_reg)
 
NRFY_STATIC_INLINE void nrfy_twim_rx_list_disable (NRF_TWIM_Type *p_reg)
 

Detailed Description

Hardware access layer with cache and barrier support for managing the TWIM peripheral.

Macro Definition Documentation

◆ NRFY_TWIM_HAS_ARRAY_LIST

#define NRFY_TWIM_HAS_ARRAY_LIST   1
See also
NRF_TWIM_HAS_ARRAY_LIST Symbol indicating whether EasyDMA array list feature is present.

Function Documentation

◆ nrfy_twim_abort()

NRFY_STATIC_INLINE void nrfy_twim_abort ( NRF_TWIM_Type *  p_reg,
nrfy_twim_xfer_desc_t const *  p_xfer 
)

Function for aborting the ongoing TWIM transaction.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_xferPointer to the structure containing reception buffer if the abort is to be blocking. NULL for non-blocking operation.

◆ nrfy_twim_address_set()

NRFY_STATIC_INLINE void nrfy_twim_address_set ( NRF_TWIM_Type *  p_reg,
uint8_t  address 
)
See also
nrf_twim_address_set Function for setting the address to be used in TWI transfers.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]addressAddress to be used in transfers.

◆ nrfy_twim_disable()

NRFY_STATIC_INLINE void nrfy_twim_disable ( NRF_TWIM_Type *  p_reg)
See also
nrf_twim_disable Function for disabling the TWIM peripheral.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrfy_twim_enable()

NRFY_STATIC_INLINE void nrfy_twim_enable ( NRF_TWIM_Type *  p_reg)
See also
nrf_twim_enable Function for enabling the TWIM peripheral.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrfy_twim_errorsrc_get_and_clear()

NRFY_STATIC_INLINE uint32_t nrfy_twim_errorsrc_get_and_clear ( NRF_TWIM_Type *  p_reg)
See also
nrf_twim_errorsrc_get_and_clear Function for checking the TWI error source.

The error flags are cleared after reading.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Mask with error source flags.

◆ nrfy_twim_event_address_get()

NRFY_STATIC_INLINE uint32_t nrfy_twim_event_address_get ( NRF_TWIM_Type const *  p_reg,
nrf_twim_event_t  event 
)
See also
nrf_twim_event_address_get Function for getting the address of the specified TWIM event register.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventThe specified event.
Returns
Address of the specified event register.

◆ nrfy_twim_event_check()

NRFY_STATIC_INLINE bool nrfy_twim_event_check ( NRF_TWIM_Type const *  p_reg,
nrf_twim_event_t  event 
)
See also
nrf_twim_event_check Function for retrieving the state of the TWIM event.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to be checked.
Return values
trueThe event has been generated.
falseThe event has not been generated.

◆ nrfy_twim_event_clear()

NRFY_STATIC_INLINE void nrfy_twim_event_clear ( NRF_TWIM_Type *  p_reg,
nrf_twim_event_t  event 
)
See also
nrf_twim_event_clear Function for clearing the specified TWIM event.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to clear.

◆ nrfy_twim_events_process()

NRFY_STATIC_INLINE uint32_t nrfy_twim_events_process ( NRF_TWIM_Type *  p_reg,
uint32_t  mask,
nrfy_twim_xfer_desc_t const *  p_xfer 
)

Function for processing the specified TWIM events.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of events to be processed, created by NRFY_EVENT_TO_INT_BITMASK();
[in]p_xferPointer to the structure containing buffer associated with the last reception. Can be NULL.
Returns
Mask of events that were generated and processed. To be checked against the result of NRFY_EVENT_TO_INT_BITMASK().

◆ nrfy_twim_frequency_set()

NRFY_STATIC_INLINE void nrfy_twim_frequency_set ( NRF_TWIM_Type *  p_reg,
nrf_twim_frequency_t  frequency 
)
See also
nrf_twim_frequency_set Function for setting the TWI master clock frequency.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]frequencyTWI frequency.

◆ nrfy_twim_int_disable()

NRFY_STATIC_INLINE void nrfy_twim_int_disable ( NRF_TWIM_Type *  p_reg,
uint32_t  mask 
)
See also
nrf_twim_int_disable Function for disabling the specified interrupts.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be disabled. Use nrf_twim_int_mask_t values for bit masking.

◆ nrfy_twim_int_enable()

NRFY_STATIC_INLINE void nrfy_twim_int_enable ( NRF_TWIM_Type *  p_reg,
uint32_t  mask 
)
See also
nrf_twim_int_enable Function for enabling the specified interrupts.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be enabled. Use nrf_twim_int_mask_t values for bit masking.

◆ nrfy_twim_int_enable_check()

NRFY_STATIC_INLINE uint32_t nrfy_twim_int_enable_check ( NRF_TWIM_Type const *  p_reg,
uint32_t  mask 
)
See also
nrf_twim_int_enable_check Function for checking if the specified interrupts are enabled.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be checked. Use nrf_twim_int_mask_t values for bit masking.
Returns
Mask of enabled interrupts.

◆ nrfy_twim_int_init()

NRFY_STATIC_INLINE void nrfy_twim_int_init ( NRF_TWIM_Type *  p_reg,
uint32_t  mask,
uint8_t  irq_priority,
bool  enable 
)

Function for initializing the specified TWIM interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskMask of interrupts to be initialized.
[in]irq_priorityInterrupt priority.
[in]enableTrue if interrupts associated with the event mask are to be enabled, false otherwise.

◆ nrfy_twim_int_uninit()

NRFY_STATIC_INLINE void nrfy_twim_int_uninit ( NRF_TWIM_Type *  p_reg)

Function for uninitializing the TWIM interrupts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrfy_twim_periph_configure()

NRFY_STATIC_INLINE void nrfy_twim_periph_configure ( NRF_TWIM_Type *  p_reg,
nrfy_twim_config_t const *  p_config 
)

Function for configuring the TWIM.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_configPointer to the peripheral configuration structure.

◆ nrfy_twim_pins_get()

NRFY_STATIC_INLINE void nrfy_twim_pins_get ( NRF_TWIM_Type const *  p_reg,
nrfy_twim_pins_t p_pins 
)

Function for getting TWIM pins configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[out]p_pinsPointer to the structure to be filled with TWIM pins configuration.

◆ nrfy_twim_pins_set()

NRFY_STATIC_INLINE void nrfy_twim_pins_set ( NRF_TWIM_Type *  p_reg,
nrfy_twim_pins_t const *  p_pins 
)

Function for setting the TWIM pins configuration.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[out]p_pinsPointer to the TWIM pin configurartion structure.

◆ nrfy_twim_publish_clear()

NRFY_STATIC_INLINE void nrfy_twim_publish_clear ( NRF_TWIM_Type *  p_reg,
nrf_twim_event_t  event 
)
See also
nrf_twim_publish_clear Function for clearing the publish configuration for a given TWIM event.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to clear the configuration.

◆ nrfy_twim_publish_set()

NRFY_STATIC_INLINE void nrfy_twim_publish_set ( NRF_TWIM_Type *  p_reg,
nrf_twim_event_t  event,
uint8_t  channel 
)
See also
nrf_twim_publish_set Function for setting the publish configuration for a given TWIM event.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to set the configuration.
[in]channelChannel through which to publish the event.

◆ nrfy_twim_rx_buffer_set()

NRFY_STATIC_INLINE void nrfy_twim_rx_buffer_set ( NRF_TWIM_Type *  p_reg,
nrfy_twim_xfer_desc_t const *  p_xfer 
)

Function for setting the TWIM reception buffer.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_xferPointer to the structure containing reception buffer.

◆ nrfy_twim_rx_list_disable()

NRFY_STATIC_INLINE void nrfy_twim_rx_list_disable ( NRF_TWIM_Type *  p_reg)
See also
nrf_twim_rx_list_disable Function for disabling the RX list feature.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrfy_twim_rx_list_enable()

NRFY_STATIC_INLINE void nrfy_twim_rx_list_enable ( NRF_TWIM_Type *  p_reg)
See also
nrf_twim_rx_list_enable Function for enabling the RX list feature.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrfy_twim_rx_list_set()

NRFY_STATIC_INLINE void nrfy_twim_rx_list_set ( NRF_TWIM_Type *  p_reg,
bool  enable 
)

Function for enabling or disabling the RX list feature.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if RX list feature is to be enabled, false otherwise.

◆ nrfy_twim_rx_start()

NRFY_STATIC_INLINE void nrfy_twim_rx_start ( NRF_TWIM_Type *  p_reg,
nrfy_twim_xfer_desc_t const *  p_xfer 
)

Function for starting TWIM reception.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_xferPointer to the structure containing reception buffer.

◆ nrfy_twim_rxd_amount_get()

NRFY_STATIC_INLINE size_t nrfy_twim_rxd_amount_get ( NRF_TWIM_Type const *  p_reg)
See also
nrf_twim_rxd_amount_get Function for getting the amount of received bytes.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Amount of received bytes.

◆ nrfy_twim_scl_pin_get()

NRFY_STATIC_INLINE uint32_t nrfy_twim_scl_pin_get ( NRF_TWIM_Type const *  p_reg)
See also
nrf_twim_scl_pin_get Function for retrieving the SCL pin selection.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
SCL pin selection.

◆ nrfy_twim_sda_pin_get()

NRFY_STATIC_INLINE uint32_t nrfy_twim_sda_pin_get ( NRF_TWIM_Type const *  p_reg)
See also
nrf_twim_sda_pin_get Function for retrieving the SDA pin selection.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
SDA pin selection.

◆ nrfy_twim_shorts_disable()

NRFY_STATIC_INLINE void nrfy_twim_shorts_disable ( NRF_TWIM_Type *  p_reg,
uint32_t  mask 
)
See also
nrf_twim_shorts_disable Function for disabling the specified shortcuts.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcuts to be disabled.

◆ nrfy_twim_shorts_enable()

NRFY_STATIC_INLINE void nrfy_twim_shorts_enable ( NRF_TWIM_Type *  p_reg,
uint32_t  mask 
)
See also
nrf_twim_shorts_enable Function for enabling the specified shortcuts.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcuts to be enabled.

◆ nrfy_twim_shorts_get()

NRFY_STATIC_INLINE uint32_t nrfy_twim_shorts_get ( NRF_TWIM_Type const *  p_reg)
See also
nrf_twim_shorts_get Function for getting the shortcut setting.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Current shortcut configuration.

◆ nrfy_twim_shorts_set()

NRFY_STATIC_INLINE void nrfy_twim_shorts_set ( NRF_TWIM_Type *  p_reg,
uint32_t  mask 
)
See also
nrf_twim_shorts_set Function for setting the specified shortcuts.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcuts to be set.

◆ nrfy_twim_stop()

NRFY_STATIC_INLINE void nrfy_twim_stop ( NRF_TWIM_Type *  p_reg)

Function for disabling TWIM with all interrupts and shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrfy_twim_subscribe_clear()

NRFY_STATIC_INLINE void nrfy_twim_subscribe_clear ( NRF_TWIM_Type *  p_reg,
nrf_twim_task_t  task 
)
See also
nrf_twim_subscribe_clear Function for clearing the subscribe configuration for a given TWIM task.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to clear the configuration.

◆ nrfy_twim_subscribe_set()

NRFY_STATIC_INLINE void nrfy_twim_subscribe_set ( NRF_TWIM_Type *  p_reg,
nrf_twim_task_t  task,
uint8_t  channel 
)
See also
nrf_twim_subscribe_set Function for setting the subscribe configuration for a given TWIM task.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to set the configuration.
[in]channelChannel through which to subscribe events.

◆ nrfy_twim_task_address_get()

NRFY_STATIC_INLINE uint32_t nrfy_twim_task_address_get ( NRF_TWIM_Type const *  p_reg,
nrf_twim_task_t  task 
)
See also
nrf_twim_task_address_get Function for getting the address of the specified TWIM task register.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskThe specified task.
Returns
Address of the specified task register.

◆ nrfy_twim_task_trigger()

NRFY_STATIC_INLINE void nrfy_twim_task_trigger ( NRF_TWIM_Type *  p_reg,
nrf_twim_task_t  task 
)
See also
nrf_twim_task_trigger Function for activating the specified TWIM task.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask to be activated.

◆ nrfy_twim_tx_buffer_set()

NRFY_STATIC_INLINE void nrfy_twim_tx_buffer_set ( NRF_TWIM_Type *  p_reg,
nrfy_twim_xfer_desc_t const *  p_xfer 
)

Function for setting the TWIM transaction buffer.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_xferPointer to the structure containing transaction buffer.

◆ nrfy_twim_tx_list_disable()

NRFY_STATIC_INLINE void nrfy_twim_tx_list_disable ( NRF_TWIM_Type *  p_reg)
See also
nrf_twim_tx_list_disable Function for disabling the TX list feature.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrfy_twim_tx_list_enable()

NRFY_STATIC_INLINE void nrfy_twim_tx_list_enable ( NRF_TWIM_Type *  p_reg)
See also
nrf_twim_tx_list_enable Function for enabling the TX list feature.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.

◆ nrfy_twim_tx_list_set()

NRFY_STATIC_INLINE void nrfy_twim_tx_list_set ( NRF_TWIM_Type *  p_reg,
bool  enable 
)

Function for enabling or disabling the TX list feature.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]enableTrue if TX list feature is to be enabled, false otherwise.

◆ nrfy_twim_tx_start()

NRFY_STATIC_INLINE void nrfy_twim_tx_start ( NRF_TWIM_Type *  p_reg,
nrfy_twim_xfer_desc_t const *  p_xfer 
)

Function for starting TWIM transaction.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_xferPointer to the structure containing transaction buffer.

◆ nrfy_twim_txd_amount_get()

NRFY_STATIC_INLINE size_t nrfy_twim_txd_amount_get ( NRF_TWIM_Type const *  p_reg)
See also
nrf_twim_txd_amount_get Function for getting the amount of transmitted bytes.
Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Amount of transmitted bytes.

Documentation feedback | Developer Zone | Subscribe | Updated