SPIS HAL¶
-
group
nrf_spis_hal
Hardware access layer for managing the SPIS peripheral.
Defines
-
NRF_SPIS_PIN_NOT_CONNECTED
¶ This value can be used as a parameter for the nrf_spis_pins_set function to specify that a given SPI signal (SCK, MOSI, or MISO) shall not be connected to a physical pin.
Enums
-
enum
nrf_spis_task_t
¶ SPIS tasks.
Values:
-
enumerator
NRF_SPIS_TASK_ACQUIRE
¶ Acquire SPI semaphore.
-
enumerator
NRF_SPIS_TASK_RELEASE
¶ Release SPI semaphore, enabling the SPI slave to acquire it.
-
enumerator
-
enum
nrf_spis_event_t
¶ SPIS events.
Values:
-
enumerator
NRF_SPIS_EVENT_END
¶ Granted transaction completed.
-
enumerator
NRF_SPIS_EVENT_ACQUIRED
¶ Semaphore acquired.
-
enumerator
-
enum
nrf_spis_short_mask_t
¶ SPIS shortcuts.
Values:
-
enumerator
NRF_SPIS_SHORT_END_ACQUIRE
¶ Shortcut between END event and ACQUIRE task.
-
enumerator
-
enum
nrf_spis_int_mask_t
¶ SPIS interrupts.
Values:
-
enumerator
NRF_SPIS_INT_END_MASK
¶ Interrupt on END event.
-
enumerator
NRF_SPIS_INT_ACQUIRED_MASK
¶ Interrupt on ACQUIRED event.
-
enumerator
-
enum
nrf_spis_mode_t
¶ SPI modes.
Values:
-
enumerator
NRF_SPIS_MODE_0
¶ SCK active high, sample on leading edge of clock.
-
enumerator
NRF_SPIS_MODE_1
¶ SCK active high, sample on trailing edge of clock.
-
enumerator
NRF_SPIS_MODE_2
¶ SCK active low, sample on leading edge of clock.
-
enumerator
NRF_SPIS_MODE_3
¶ SCK active low, sample on trailing edge of clock.
-
enumerator
-
enum
nrf_spis_bit_order_t
¶ SPI bit orders.
Values:
-
enumerator
NRF_SPIS_BIT_ORDER_MSB_FIRST
¶ Most significant bit shifted out first.
-
enumerator
NRF_SPIS_BIT_ORDER_LSB_FIRST
¶ Least significant bit shifted out first.
-
enumerator
-
enum
nrf_spis_semstat_t
¶ SPI semaphore status.
Values:
-
enumerator
NRF_SPIS_SEMSTAT_FREE
¶ Semaphore is free.
-
enumerator
NRF_SPIS_SEMSTAT_CPU
¶ Semaphore is assigned to the CPU.
-
enumerator
NRF_SPIS_SEMSTAT_SPIS
¶ Semaphore is assigned to the SPI slave.
-
enumerator
NRF_SPIS_SEMSTAT_CPUPENDING
¶ Semaphore is assigned to the SPI, but a handover to the CPU is pending.
-
enumerator
Functions
-
NRF_STATIC_INLINE void
nrf_spis_task_trigger
(NRF_SPIS_Type *p_reg, nrf_spis_task_t task)¶ Function for activating the specified SPIS task.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] Task to be activated.
-
NRF_STATIC_INLINE uint32_t
nrf_spis_task_address_get
(NRF_SPIS_Type const *p_reg, nrf_spis_task_t task)¶ Function for getting the address of the specified SPIS task register.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] The specified task.
- Returns
Address of the specified task register.
-
NRF_STATIC_INLINE void
nrf_spis_event_clear
(NRF_SPIS_Type *p_reg, nrf_spis_event_t event)¶ Function for clearing the specified SPIS event.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Event to be cleared.
-
NRF_STATIC_INLINE bool
nrf_spis_event_check
(NRF_SPIS_Type const *p_reg, nrf_spis_event_t event)¶ Function for retrieving the state of the SPIS event.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Event to be checked.
- Returns true
The event has been generated.
- Returns false
The event has not been generated.
-
NRF_STATIC_INLINE uint32_t
nrf_spis_event_address_get
(NRF_SPIS_Type const *p_reg, nrf_spis_event_t event)¶ Function for getting the address of the specified SPIS event register.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] The specified event.
- Returns
Address of the specified event register.
-
NRF_STATIC_INLINE void
nrf_spis_shorts_enable
(NRF_SPIS_Type *p_reg, uint32_t mask)¶ Function for enabling the specified shortcuts.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Shortcuts to be enabled.
-
NRF_STATIC_INLINE void
nrf_spis_shorts_disable
(NRF_SPIS_Type *p_reg, uint32_t mask)¶ Function for disabling the specified shortcuts.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Shortcuts to be disabled.
-
NRF_STATIC_INLINE void
nrf_spis_int_enable
(NRF_SPIS_Type *p_reg, uint32_t mask)¶ Function for enabling the specified interrupts.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Mask of interrupts to be enabled.
-
NRF_STATIC_INLINE void
nrf_spis_int_disable
(NRF_SPIS_Type *p_reg, uint32_t mask)¶ Function for disabling the specified interrupts.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Mask of interrupts to be disabled.
-
NRF_STATIC_INLINE uint32_t
nrf_spis_int_enable_check
(NRF_SPIS_Type const *p_reg, uint32_t mask)¶ Function for checking if the specified interrupts are enabled.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Mask of interrupts to be checked.
- Returns
Mask of enabled interrupts.
-
NRF_STATIC_INLINE void
nrf_spis_subscribe_set
(NRF_SPIS_Type *p_reg, nrf_spis_task_t task, uint8_t channel)¶ Function for setting the subscribe configuration for a given SPIS task.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] Task for which to set the configuration.
channel – [in] Channel through which to subscribe events.
-
NRF_STATIC_INLINE void
nrf_spis_subscribe_clear
(NRF_SPIS_Type *p_reg, nrf_spis_task_t task)¶ Function for clearing the subscribe configuration for a given SPIS task.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] Task for which to clear the configuration.
-
NRF_STATIC_INLINE void
nrf_spis_publish_set
(NRF_SPIS_Type *p_reg, nrf_spis_event_t event, uint8_t channel)¶ Function for setting the publish configuration for a given SPIS event.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Event for which to set the configuration.
channel – [in] Channel through which to publish the event.
-
NRF_STATIC_INLINE void
nrf_spis_publish_clear
(NRF_SPIS_Type *p_reg, nrf_spis_event_t event)¶ Function for clearing the publish configuration for a given SPIS event.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Event for which to clear the configuration.
-
NRF_STATIC_INLINE void
nrf_spis_enable
(NRF_SPIS_Type *p_reg)¶ Function for enabling the SPIS peripheral.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE void
nrf_spis_disable
(NRF_SPIS_Type *p_reg)¶ Function for disabling the SPIS peripheral.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE nrf_spis_semstat_t
nrf_spis_semaphore_status_get
(NRF_SPIS_Type const *p_reg)¶ Function for retrieving the SPIS semaphore status.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns
Current semaphore status.
-
NRF_STATIC_INLINE nrf_spis_status_mask_t
nrf_spis_status_get
(NRF_SPIS_Type const *p_reg)¶ Function for retrieving the SPIS status.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns
Current SPIS status.
-
NRF_STATIC_INLINE void
nrf_spis_pins_set
(NRF_SPIS_Type *p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin, uint32_t csn_pin)¶ Function for configuring SPIS pins.
If a given signal is not needed, pass the NRF_SPIS_PIN_NOT_CONNECTED value instead of its pin number.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
sck_pin – [in] SCK pin number.
mosi_pin – [in] MOSI pin number.
miso_pin – [in] MISO pin number.
csn_pin – [in] CSN pin number.
-
NRF_STATIC_INLINE uint32_t
nrf_spis_sck_pin_get
(NRF_SPIS_Type const *p_reg)¶ Function for getting the SCK pin selection.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns
SCK pin selection.
-
NRF_STATIC_INLINE uint32_t
nrf_spis_mosi_pin_get
(NRF_SPIS_Type const *p_reg)¶ Function for getting the MOSI pin selection.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns
MOSI pin selection.
-
NRF_STATIC_INLINE uint32_t
nrf_spis_miso_pin_get
(NRF_SPIS_Type const *p_reg)¶ Function for getting the MISO pin selection.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns
MISO pin selection.
-
NRF_STATIC_INLINE uint32_t
nrf_spis_csn_pin_get
(NRF_SPIS_Type const *p_reg)¶ Function for getting the CSN pin selection.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns
CSN pin selection.
-
NRF_STATIC_INLINE void
nrf_spis_tx_buffer_set
(NRF_SPIS_Type *p_reg, uint8_t const *p_buffer, size_t length)¶ Function for setting the transmit buffer.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
p_buffer – [in] Pointer to the buffer that contains the data to send.
length – [in] Maximum number of data bytes to transmit.
-
NRF_STATIC_INLINE void
nrf_spis_rx_buffer_set
(NRF_SPIS_Type *p_reg, uint8_t *p_buffer, size_t length)¶ Function for setting the receive buffer.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
p_buffer – [in] Pointer to the buffer for received data.
length – [in] Maximum number of data bytes to receive.
-
NRF_STATIC_INLINE size_t
nrf_spis_tx_amount_get
(NRF_SPIS_Type const *p_reg)¶ Function for getting the number of bytes transmitted in the last granted transaction.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns
Number of bytes transmitted.
-
NRF_STATIC_INLINE size_t
nrf_spis_rx_amount_get
(NRF_SPIS_Type const *p_reg)¶ Function for getting the number of bytes received in the last granted transaction.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns
Number of bytes received.
-
NRF_STATIC_INLINE void
nrf_spis_configure
(NRF_SPIS_Type *p_reg, nrf_spis_mode_t spi_mode, nrf_spis_bit_order_t spi_bit_order)¶ Function for setting the SPI configuration.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
spi_mode – [in] SPI mode.
spi_bit_order – [in] SPI bit order.
-
NRF_STATIC_INLINE void
nrf_spis_def_set
(NRF_SPIS_Type *p_reg, uint8_t def)¶ Function for setting the default character.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
def – [in] Default character that is clocked out in case of an overflow of the RXD buffer.
-
NRF_STATIC_INLINE void
nrf_spis_orc_set
(NRF_SPIS_Type *p_reg, uint8_t orc)¶ Function for setting the over-read character.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
orc – [in] Over-read character that is clocked out in case of an over-read of the TXD buffer.
-
NRF_STATIC_INLINE void
nrf_spis_tx_list_enable
(NRF_SPIS_Type *p_reg)¶ Function for enabling the TX list feature.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE void
nrf_spis_tx_list_disable
(NRF_SPIS_Type *p_reg)¶ Function for disabling the TX list feature.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE void
nrf_spis_rx_list_enable
(NRF_SPIS_Type *p_reg)¶ Function for enabling the RX list feature.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
-
NRF_STATIC_INLINE void
nrf_spis_rx_list_disable
(NRF_SPIS_Type *p_reg)¶ Function for disabling the RX list feature.
- Parameters
p_reg – [in] Pointer to the structure of registers of the peripheral.
-