Hardware access layer for managing the SPIM peripheral. More...
Macros | |
#define | NRF_SPIM_PIN_NOT_CONNECTED 0xFFFFFFFF |
This value can be used as a parameter for the nrf_spim_pins_set function to specify that a given SPI signal (SCK, MOSI, or MISO) shall not be connected to a physical pin. | |
#define | NRF_SPIM_DCX_CNT_ALL_CMD 0xF |
This value specified in the DCX line configuration causes this line to be set low during whole transmission (all transmitted bytes are marked as command bytes). Any lower value causes the DCX line to be switched from low to high after this number of bytes is transmitted (all remaining bytes are marked as data bytes). | |
#define | NRF_SPIM_HW_CSN_PRESENT |
Macro for checking if the hardware chip select function is available. More... | |
Enumerations | |
enum | nrf_spim_task_t { NRF_SPIM_TASK_START = offsetof(NRF_SPIM_Type, TASKS_START), NRF_SPIM_TASK_STOP = offsetof(NRF_SPIM_Type, TASKS_STOP), NRF_SPIM_TASK_SUSPEND = offsetof(NRF_SPIM_Type, TASKS_SUSPEND), NRF_SPIM_TASK_RESUME = offsetof(NRF_SPIM_Type, TASKS_RESUME) } |
SPIM tasks. More... | |
enum | nrf_spim_event_t { NRF_SPIM_EVENT_STOPPED = offsetof(NRF_SPIM_Type, EVENTS_STOPPED), NRF_SPIM_EVENT_ENDRX = offsetof(NRF_SPIM_Type, EVENTS_ENDRX), NRF_SPIM_EVENT_END = offsetof(NRF_SPIM_Type, EVENTS_END), NRF_SPIM_EVENT_ENDTX = offsetof(NRF_SPIM_Type, EVENTS_ENDTX), NRF_SPIM_EVENT_STARTED = offsetof(NRF_SPIM_Type, EVENTS_STARTED) } |
SPIM events. More... | |
enum | nrf_spim_short_mask_t { NRF_SPIM_SHORT_END_START_MASK = SPIM_SHORTS_END_START_Msk, NRF_SPIM_ALL_SHORTS_MASK = SPIM_SHORTS_END_START_Msk } |
SPIM shortcuts. More... | |
enum | nrf_spim_int_mask_t { NRF_SPIM_INT_STOPPED_MASK = SPIM_INTENSET_STOPPED_Msk, NRF_SPIM_INT_ENDRX_MASK = SPIM_INTENSET_ENDRX_Msk, NRF_SPIM_INT_END_MASK = SPIM_INTENSET_END_Msk, NRF_SPIM_INT_ENDTX_MASK = SPIM_INTENSET_ENDTX_Msk, NRF_SPIM_INT_STARTED_MASK = SPIM_INTENSET_STARTED_Msk, NRF_SPIM_ALL_INTS_MASK } |
SPIM interrupts. More... | |
enum | nrf_spim_frequency_t { NRF_SPIM_FREQ_125K = SPIM_FREQUENCY_FREQUENCY_K125, NRF_SPIM_FREQ_250K = SPIM_FREQUENCY_FREQUENCY_K250, NRF_SPIM_FREQ_500K = SPIM_FREQUENCY_FREQUENCY_K500, NRF_SPIM_FREQ_1M = SPIM_FREQUENCY_FREQUENCY_M1, NRF_SPIM_FREQ_2M = SPIM_FREQUENCY_FREQUENCY_M2, NRF_SPIM_FREQ_4M = SPIM_FREQUENCY_FREQUENCY_M4, NRF_SPIM_FREQ_8M = (int)SPIM_FREQUENCY_FREQUENCY_M8, NRF_SPIM_FREQ_16M = SPIM_FREQUENCY_FREQUENCY_M16, NRF_SPIM_FREQ_32M = SPIM_FREQUENCY_FREQUENCY_M32 } |
SPI master data rates. More... | |
enum | nrf_spim_mode_t { NRF_SPIM_MODE_0, NRF_SPIM_MODE_1, NRF_SPIM_MODE_2, NRF_SPIM_MODE_3 } |
SPI modes. More... | |
enum | nrf_spim_bit_order_t { NRF_SPIM_BIT_ORDER_MSB_FIRST = SPIM_CONFIG_ORDER_MsbFirst, NRF_SPIM_BIT_ORDER_LSB_FIRST = SPIM_CONFIG_ORDER_LsbFirst } |
SPI bit orders. More... | |
enum | nrf_spim_csn_pol_t { NRF_SPIM_CSN_POL_LOW = SPIM_CSNPOL_CSNPOL_LOW, NRF_SPIM_CSN_POL_HIGH = SPIM_CSNPOL_CSNPOL_HIGH } |
SPI CSN pin polarity. More... | |
Functions | |
__STATIC_INLINE void | nrf_spim_task_trigger (NRF_SPIM_Type *p_reg, nrf_spim_task_t task) |
Function for activating the specified SPIM task. More... | |
__STATIC_INLINE uint32_t | nrf_spim_task_address_get (NRF_SPIM_Type *p_reg, nrf_spim_task_t task) |
Function for getting the address of the specified SPIM task register. More... | |
__STATIC_INLINE void | nrf_spim_event_clear (NRF_SPIM_Type *p_reg, nrf_spim_event_t event) |
Function for clearing the specified SPIM event. More... | |
__STATIC_INLINE bool | nrf_spim_event_check (NRF_SPIM_Type *p_reg, nrf_spim_event_t event) |
Function for retrieving the state of the SPIM event. More... | |
__STATIC_INLINE uint32_t | nrf_spim_event_address_get (NRF_SPIM_Type *p_reg, nrf_spim_event_t event) |
Function for getting the address of the specified SPIM event register. More... | |
__STATIC_INLINE void | nrf_spim_shorts_enable (NRF_SPIM_Type *p_reg, uint32_t mask) |
Function for enabling the specified shortcuts. More... | |
__STATIC_INLINE void | nrf_spim_shorts_disable (NRF_SPIM_Type *p_reg, uint32_t mask) |
Function for disabling the specified shortcuts. More... | |
__STATIC_INLINE uint32_t | nrf_spim_shorts_get (NRF_SPIM_Type *p_reg) |
Function for getting the shortcut setting. More... | |
__STATIC_INLINE void | nrf_spim_int_enable (NRF_SPIM_Type *p_reg, uint32_t mask) |
Function for enabling the specified interrupts. More... | |
__STATIC_INLINE void | nrf_spim_int_disable (NRF_SPIM_Type *p_reg, uint32_t mask) |
Function for disabling the specified interrupts. More... | |
__STATIC_INLINE bool | nrf_spim_int_enable_check (NRF_SPIM_Type *p_reg, nrf_spim_int_mask_t spim_int) |
Function for retrieving the state of a given interrupt. More... | |
__STATIC_INLINE void | nrf_spim_subscribe_set (NRF_SPIM_Type *p_reg, nrf_spim_task_t task, uint8_t channel) |
Function for setting the subscribe configuration for a given SPIM task. More... | |
__STATIC_INLINE void | nrf_spim_subscribe_clear (NRF_SPIM_Type *p_reg, nrf_spim_task_t task) |
Function for clearing the subscribe configuration for a given SPIM task. More... | |
__STATIC_INLINE void | nrf_spim_publish_set (NRF_SPIM_Type *p_reg, nrf_spim_event_t event, uint8_t channel) |
Function for setting the publish configuration for a given SPIM event. More... | |
__STATIC_INLINE void | nrf_spim_publish_clear (NRF_SPIM_Type *p_reg, nrf_spim_event_t event) |
Function for clearing the publish configuration for a given SPIM event. More... | |
__STATIC_INLINE void | nrf_spim_enable (NRF_SPIM_Type *p_reg) |
Function for enabling the SPIM peripheral. More... | |
__STATIC_INLINE void | nrf_spim_disable (NRF_SPIM_Type *p_reg) |
Function for disabling the SPIM peripheral. More... | |
__STATIC_INLINE void | nrf_spim_pins_set (NRF_SPIM_Type *p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin) |
Function for configuring SPIM pins. More... | |
__STATIC_INLINE void | nrf_spim_csn_configure (NRF_SPIM_Type *p_reg, uint32_t pin, nrf_spim_csn_pol_t polarity, uint32_t duration) |
Function for configuring the SPIM hardware CSN pin. More... | |
__STATIC_INLINE void | nrf_spim_dcx_pin_set (NRF_SPIM_Type *p_reg, uint32_t dcx_pin) |
Function for configuring the SPIM DCX pin. More... | |
__STATIC_INLINE void | nrf_spim_dcx_cnt_set (NRF_SPIM_Type *p_reg, uint32_t count) |
Function for configuring the number of command bytes. More... | |
__STATIC_INLINE void | nrf_spim_iftiming_set (NRF_SPIM_Type *p_reg, uint32_t rxdelay) |
Function for configuring the extended SPIM interface. More... | |
__STATIC_INLINE void | nrf_spim_stallstat_rx_clear (NRF_SPIM_Type *p_reg) |
Function for clearing stall status for RX EasyDMA RAM accesses. More... | |
__STATIC_INLINE bool | nrf_spim_stallstat_rx_get (NRF_SPIM_Type *p_reg) |
Function for getting stall status for RX EasyDMA RAM accesses. More... | |
__STATIC_INLINE void | nrf_spim_stallstat_tx_clear (NRF_SPIM_Type *p_reg) |
Function for clearing stall status for TX EasyDMA RAM accesses. More... | |
__STATIC_INLINE bool | nrf_spim_stallstat_tx_get (NRF_SPIM_Type *p_reg) |
Function for getting stall status for TX EasyDMA RAM accesses. More... | |
__STATIC_INLINE void | nrf_spim_frequency_set (NRF_SPIM_Type *p_reg, nrf_spim_frequency_t frequency) |
Function for setting the SPI master data rate. More... | |
__STATIC_INLINE void | nrf_spim_tx_buffer_set (NRF_SPIM_Type *p_reg, uint8_t const *p_buffer, size_t length) |
Function for setting the transmit buffer. More... | |
__STATIC_INLINE void | nrf_spim_rx_buffer_set (NRF_SPIM_Type *p_reg, uint8_t *p_buffer, size_t length) |
Function for setting the receive buffer. More... | |
__STATIC_INLINE void | nrf_spim_configure (NRF_SPIM_Type *p_reg, nrf_spim_mode_t spi_mode, nrf_spim_bit_order_t spi_bit_order) |
Function for setting the SPI configuration. More... | |
__STATIC_INLINE void | nrf_spim_orc_set (NRF_SPIM_Type *p_reg, uint8_t orc) |
Function for setting the over-read character. More... | |
__STATIC_INLINE void | nrf_spim_tx_list_enable (NRF_SPIM_Type *p_reg) |
Function for enabling the TX list feature. More... | |
__STATIC_INLINE void | nrf_spim_tx_list_disable (NRF_SPIM_Type *p_reg) |
Function for disabling the TX list feature. More... | |
__STATIC_INLINE void | nrf_spim_rx_list_enable (NRF_SPIM_Type *p_reg) |
Function for enabling the RX list feature. More... | |
__STATIC_INLINE void | nrf_spim_rx_list_disable (NRF_SPIM_Type *p_reg) |
Function for disabling the RX list feature. More... | |
Hardware access layer for managing the SPIM peripheral.
#define NRF_SPIM_HW_CSN_PRESENT |
Macro for checking if the hardware chip select function is available.
enum nrf_spim_bit_order_t |
enum nrf_spim_csn_pol_t |
enum nrf_spim_event_t |
enum nrf_spim_frequency_t |
enum nrf_spim_int_mask_t |
SPIM interrupts.
enum nrf_spim_mode_t |
enum nrf_spim_task_t |
__STATIC_INLINE void nrf_spim_configure | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_mode_t | spi_mode, | ||
nrf_spim_bit_order_t | spi_bit_order | ||
) |
Function for setting the SPI configuration.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | spi_mode | SPI mode. |
[in] | spi_bit_order | SPI bit order. |
__STATIC_INLINE void nrf_spim_csn_configure | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | pin, | ||
nrf_spim_csn_pol_t | polarity, | ||
uint32_t | duration | ||
) |
Function for configuring the SPIM hardware CSN pin.
If this signal is not needed, pass the NRF_SPIM_PIN_NOT_CONNECTED value instead of its pin number.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | pin | CSN pin number. |
[in] | polarity | CSN pin polarity. |
[in] | duration | Minimum duration between the edge of CSN and the edge of SCK and minimum duration of CSN must stay unselected between transactions. The value is specified in number of 64 MHz clock cycles (15.625 ns). |
__STATIC_INLINE void nrf_spim_dcx_cnt_set | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | count | ||
) |
Function for configuring the number of command bytes.
Maximum value available for dividing the transmitted bytes into command bytes and data bytes is NRF_SPIM_DCX_CNT_ALL_CMD - 1. The NRF_SPIM_DCX_CNT_ALL_CMD value passed as the count
parameter causes all transmitted bytes to be marked as command bytes.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | count | Number of command bytes preceding the data bytes. |
__STATIC_INLINE void nrf_spim_dcx_pin_set | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | dcx_pin | ||
) |
Function for configuring the SPIM DCX pin.
If this signal is not needed, pass the NRF_SPIM_PIN_NOT_CONNECTED value instead of its pin number.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | dcx_pin | DCX pin number. |
__STATIC_INLINE void nrf_spim_disable | ( | NRF_SPIM_Type * | p_reg | ) |
Function for disabling the SPIM peripheral.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE void nrf_spim_enable | ( | NRF_SPIM_Type * | p_reg | ) |
Function for enabling the SPIM peripheral.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE uint32_t nrf_spim_event_address_get | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_event_t | event | ||
) |
Function for getting the address of the specified SPIM event register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | The specified event. |
__STATIC_INLINE bool nrf_spim_event_check | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_event_t | event | ||
) |
Function for retrieving the state of the SPIM event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event to be checked. |
true | The event has been generated. |
false | The event has not been generated. |
__STATIC_INLINE void nrf_spim_event_clear | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_event_t | event | ||
) |
Function for clearing the specified SPIM event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event to be cleared. |
__STATIC_INLINE void nrf_spim_frequency_set | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_frequency_t | frequency | ||
) |
Function for setting the SPI master data rate.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | frequency | SPI frequency. |
__STATIC_INLINE void nrf_spim_iftiming_set | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | rxdelay | ||
) |
Function for configuring the extended SPIM interface.
p_reg | Pointer to the structure of registers of the peripheral. |
rxdelay | Sample delay for input serial data on MISO, specified in 64 MHz clock cycles (15.625 ns) from the sampling edge of SCK. |
__STATIC_INLINE void nrf_spim_int_disable | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for disabling the specified interrupts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be disabled. |
__STATIC_INLINE void nrf_spim_int_enable | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for enabling the specified interrupts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Mask of interrupts to be enabled. |
__STATIC_INLINE bool nrf_spim_int_enable_check | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_int_mask_t | spim_int | ||
) |
Function for retrieving the state of a given interrupt.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | spim_int | Interrupt to be checked. |
true | The interrupt is enabled. |
false | The interrupt is not enabled. |
__STATIC_INLINE void nrf_spim_orc_set | ( | NRF_SPIM_Type * | p_reg, |
uint8_t | orc | ||
) |
Function for setting the over-read character.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | orc | Over-read character that is clocked out in case of an over-read of the TXD buffer. |
__STATIC_INLINE void nrf_spim_pins_set | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | sck_pin, | ||
uint32_t | mosi_pin, | ||
uint32_t | miso_pin | ||
) |
Function for configuring SPIM pins.
If a given signal is not needed, pass the NRF_SPIM_PIN_NOT_CONNECTED value instead of its pin number.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | sck_pin | SCK pin number. |
[in] | mosi_pin | MOSI pin number. |
[in] | miso_pin | MISO pin number. |
__STATIC_INLINE void nrf_spim_publish_clear | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_event_t | event | ||
) |
Function for clearing the publish configuration for a given SPIM event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event for which to clear the configuration. |
__STATIC_INLINE void nrf_spim_publish_set | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_event_t | event, | ||
uint8_t | channel | ||
) |
Function for setting the publish configuration for a given SPIM event.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | event | Event for which to set the configuration. |
[in] | channel | Channel through which to publish the event. |
__STATIC_INLINE void nrf_spim_rx_buffer_set | ( | NRF_SPIM_Type * | p_reg, |
uint8_t * | p_buffer, | ||
size_t | length | ||
) |
Function for setting the receive buffer.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_buffer | Pointer to the buffer for received data. |
[in] | length | Maximum number of data bytes to receive. |
__STATIC_INLINE void nrf_spim_rx_list_disable | ( | NRF_SPIM_Type * | p_reg | ) |
Function for disabling the RX list feature.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE void nrf_spim_rx_list_enable | ( | NRF_SPIM_Type * | p_reg | ) |
Function for enabling the RX list feature.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE void nrf_spim_shorts_disable | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for disabling the specified shortcuts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Shortcuts to be disabled. |
__STATIC_INLINE void nrf_spim_shorts_enable | ( | NRF_SPIM_Type * | p_reg, |
uint32_t | mask | ||
) |
Function for enabling the specified shortcuts.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | mask | Shortcuts to be enabled. |
__STATIC_INLINE uint32_t nrf_spim_shorts_get | ( | NRF_SPIM_Type * | p_reg | ) |
Function for getting the shortcut setting.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE void nrf_spim_stallstat_rx_clear | ( | NRF_SPIM_Type * | p_reg | ) |
Function for clearing stall status for RX EasyDMA RAM accesses.
p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE bool nrf_spim_stallstat_rx_get | ( | NRF_SPIM_Type * | p_reg | ) |
Function for getting stall status for RX EasyDMA RAM accesses.
p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE void nrf_spim_stallstat_tx_clear | ( | NRF_SPIM_Type * | p_reg | ) |
Function for clearing stall status for TX EasyDMA RAM accesses.
p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE bool nrf_spim_stallstat_tx_get | ( | NRF_SPIM_Type * | p_reg | ) |
Function for getting stall status for TX EasyDMA RAM accesses.
p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE void nrf_spim_subscribe_clear | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_task_t | task | ||
) |
Function for clearing the subscribe configuration for a given SPIM task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task for which to clear the configuration. |
__STATIC_INLINE void nrf_spim_subscribe_set | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_task_t | task, | ||
uint8_t | channel | ||
) |
Function for setting the subscribe configuration for a given SPIM task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task for which to set the configuration. |
[in] | channel | Channel through which to subscribe events. |
__STATIC_INLINE uint32_t nrf_spim_task_address_get | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_task_t | task | ||
) |
Function for getting the address of the specified SPIM task register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | The specified task. |
__STATIC_INLINE void nrf_spim_task_trigger | ( | NRF_SPIM_Type * | p_reg, |
nrf_spim_task_t | task | ||
) |
Function for activating the specified SPIM task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task to be activated. |
__STATIC_INLINE void nrf_spim_tx_buffer_set | ( | NRF_SPIM_Type * | p_reg, |
uint8_t const * | p_buffer, | ||
size_t | length | ||
) |
Function for setting the transmit buffer.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | p_buffer | Pointer to the buffer with data to send. |
[in] | length | Maximum number of data bytes to transmit. |
__STATIC_INLINE void nrf_spim_tx_list_disable | ( | NRF_SPIM_Type * | p_reg | ) |
Function for disabling the TX list feature.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
__STATIC_INLINE void nrf_spim_tx_list_enable | ( | NRF_SPIM_Type * | p_reg | ) |
Function for enabling the TX list feature.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |