nRF5 SDK v17.1.0
Macros | Enumerations | Functions
SPIS HAL

Hardware access layer for managing the SPIS peripheral. More...

Macros

#define NRF_SPIS_PIN_NOT_CONNECTED   0xFFFFFFFF
 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.
 

Enumerations

enum  nrf_spis_task_t {
  NRF_SPIS_TASK_ACQUIRE = offsetof(NRF_SPIS_Type, TASKS_ACQUIRE),
  NRF_SPIS_TASK_RELEASE = offsetof(NRF_SPIS_Type, TASKS_RELEASE)
}
 SPIS tasks. More...
 
enum  nrf_spis_event_t {
  NRF_SPIS_EVENT_END = offsetof(NRF_SPIS_Type, EVENTS_END),
  NRF_SPIS_EVENT_ACQUIRED = offsetof(NRF_SPIS_Type, EVENTS_ACQUIRED)
}
 SPIS events. More...
 
enum  nrf_spis_short_mask_t { NRF_SPIS_SHORT_END_ACQUIRE = SPIS_SHORTS_END_ACQUIRE_Msk }
 SPIS shortcuts. More...
 
enum  nrf_spis_int_mask_t {
  NRF_SPIS_INT_END_MASK = SPIS_INTENSET_END_Msk,
  NRF_SPIS_INT_ACQUIRED_MASK = SPIS_INTENSET_ACQUIRED_Msk
}
 SPIS interrupts. More...
 
enum  nrf_spis_mode_t {
  NRF_SPIS_MODE_0,
  NRF_SPIS_MODE_1,
  NRF_SPIS_MODE_2,
  NRF_SPIS_MODE_3
}
 SPI modes. More...
 
enum  nrf_spis_bit_order_t {
  NRF_SPIS_BIT_ORDER_MSB_FIRST = SPIS_CONFIG_ORDER_MsbFirst,
  NRF_SPIS_BIT_ORDER_LSB_FIRST = SPIS_CONFIG_ORDER_LsbFirst
}
 SPI bit orders. More...
 
enum  nrf_spis_semstat_t {
  NRF_SPIS_SEMSTAT_FREE = 0,
  NRF_SPIS_SEMSTAT_CPU = 1,
  NRF_SPIS_SEMSTAT_SPIS = 2,
  NRF_SPIS_SEMSTAT_CPUPENDING = 3
}
 SPI semaphore status. More...
 
enum  nrf_spis_status_mask_t {
  NRF_SPIS_STATUS_OVERREAD = SPIS_STATUS_OVERREAD_Msk,
  NRF_SPIS_STATUS_OVERFLOW = SPIS_STATUS_OVERFLOW_Msk
}
 SPIS status. More...
 

Functions

__STATIC_INLINE void nrf_spis_task_trigger (NRF_SPIS_Type *p_reg, nrf_spis_task_t task)
 Function for activating the specified SPIS task. More...
 
__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. More...
 
__STATIC_INLINE void nrf_spis_event_clear (NRF_SPIS_Type *p_reg, nrf_spis_event_t event)
 Function for clearing the specified SPIS event. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE void nrf_spis_shorts_enable (NRF_SPIS_Type *p_reg, uint32_t mask)
 Function for enabling the specified shortcuts. More...
 
__STATIC_INLINE void nrf_spis_shorts_disable (NRF_SPIS_Type *p_reg, uint32_t mask)
 Function for disabling the specified shortcuts. More...
 
__STATIC_INLINE void nrf_spis_int_enable (NRF_SPIS_Type *p_reg, uint32_t mask)
 Function for enabling the specified interrupts. More...
 
__STATIC_INLINE void nrf_spis_int_disable (NRF_SPIS_Type *p_reg, uint32_t mask)
 Function for disabling the specified interrupts. More...
 
__STATIC_INLINE bool nrf_spis_int_enable_check (NRF_SPIS_Type const *p_reg, nrf_spis_int_mask_t spis_int)
 Function for retrieving the state of a given interrupt. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE void nrf_spis_enable (NRF_SPIS_Type *p_reg)
 Function for enabling the SPIS peripheral. More...
 
__STATIC_INLINE void nrf_spis_disable (NRF_SPIS_Type *p_reg)
 Function for disabling the SPIS peripheral. More...
 
__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get (NRF_SPIS_Type *p_reg)
 Function for retrieving the SPIS semaphore status. More...
 
__STATIC_INLINE
nrf_spis_status_mask_t 
nrf_spis_status_get (NRF_SPIS_Type *p_reg)
 Function for retrieving the SPIS status. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__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. More...
 
__STATIC_INLINE void nrf_spis_def_set (NRF_SPIS_Type *p_reg, uint8_t def)
 Function for setting the default character. More...
 
__STATIC_INLINE void nrf_spis_orc_set (NRF_SPIS_Type *p_reg, uint8_t orc)
 Function for setting the over-read character. More...
 

Detailed Description

Hardware access layer for managing the SPIS peripheral.

Enumeration Type Documentation

SPI bit orders.

Enumerator
NRF_SPIS_BIT_ORDER_MSB_FIRST 

Most significant bit shifted out first.

NRF_SPIS_BIT_ORDER_LSB_FIRST 

Least significant bit shifted out first.

SPIS events.

Enumerator
NRF_SPIS_EVENT_END 

Granted transaction completed.

NRF_SPIS_EVENT_ACQUIRED 

Semaphore acquired.

SPIS interrupts.

Enumerator
NRF_SPIS_INT_END_MASK 

Interrupt on END event.

NRF_SPIS_INT_ACQUIRED_MASK 

Interrupt on ACQUIRED event.

SPI modes.

Enumerator
NRF_SPIS_MODE_0 

SCK active high, sample on leading edge of clock.

NRF_SPIS_MODE_1 

SCK active high, sample on trailing edge of clock.

NRF_SPIS_MODE_2 

SCK active low, sample on leading edge of clock.

NRF_SPIS_MODE_3 

SCK active low, sample on trailing edge of clock.

SPI semaphore status.

Enumerator
NRF_SPIS_SEMSTAT_FREE 

Semaphore is free.

NRF_SPIS_SEMSTAT_CPU 

Semaphore is assigned to the CPU.

NRF_SPIS_SEMSTAT_SPIS 

Semaphore is assigned to the SPI slave.

NRF_SPIS_SEMSTAT_CPUPENDING 

Semaphore is assigned to the SPI, but a handover to the CPU is pending.

SPIS shortcuts.

Enumerator
NRF_SPIS_SHORT_END_ACQUIRE 

Shortcut between END event and ACQUIRE task.

SPIS status.

Enumerator
NRF_SPIS_STATUS_OVERREAD 

TX buffer over-read detected and prevented.

NRF_SPIS_STATUS_OVERFLOW 

RX buffer overflow detected and prevented.

SPIS tasks.

Enumerator
NRF_SPIS_TASK_ACQUIRE 

Acquire SPI semaphore.

NRF_SPIS_TASK_RELEASE 

Release SPI semaphore, enabling the SPI slave to acquire it.

Function Documentation

__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]spi_modeSPI mode.
[in]spi_bit_orderSPI bit order.
__STATIC_INLINE void nrf_spis_def_set ( NRF_SPIS_Type *  p_reg,
uint8_t  def 
)

Function for setting the default character.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]defDefault character that is clocked out in case of an overflow of the RXD buffer.
__STATIC_INLINE void nrf_spis_disable ( NRF_SPIS_Type *  p_reg)

Function for disabling the SPIS peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
__STATIC_INLINE void nrf_spis_enable ( NRF_SPIS_Type *  p_reg)

Function for enabling the SPIS peripheral.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventThe specified event.
Returns
Address of the specified event register.
__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
[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.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent to be cleared.
__STATIC_INLINE void nrf_spis_int_disable ( NRF_SPIS_Type *  p_reg,
uint32_t  mask 
)

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.
__STATIC_INLINE void nrf_spis_int_enable ( NRF_SPIS_Type *  p_reg,
uint32_t  mask 
)

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.
__STATIC_INLINE bool nrf_spis_int_enable_check ( NRF_SPIS_Type const *  p_reg,
nrf_spis_int_mask_t  spis_int 
)

Function for retrieving the state of a given interrupt.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]spis_intInterrupt to be checked.
Return values
trueThe interrupt is enabled.
falseThe interrupt is not enabled.
__STATIC_INLINE void nrf_spis_orc_set ( NRF_SPIS_Type *  p_reg,
uint8_t  orc 
)

Function for setting the over-read character.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]orcOver-read character that is clocked out in case of an over-read of the TXD buffer.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]sck_pinSCK pin number.
[in]mosi_pinMOSI pin number.
[in]miso_pinMISO pin number.
[in]csn_pinCSN pin number.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]eventEvent for which to clear the configuration.
__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
[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.
__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
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of bytes received.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_bufferPointer to the buffer for received data.
[in]lengthMaximum number of data bytes to receive.
__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get ( NRF_SPIS_Type *  p_reg)

Function for retrieving the SPIS semaphore status.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Current semaphore status.
__STATIC_INLINE void nrf_spis_shorts_disable ( NRF_SPIS_Type *  p_reg,
uint32_t  mask 
)

Function for disabling the specified shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcuts to be disabled.
__STATIC_INLINE void nrf_spis_shorts_enable ( NRF_SPIS_Type *  p_reg,
uint32_t  mask 
)

Function for enabling the specified shortcuts.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
[in]maskShortcuts to be enabled.
__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get ( NRF_SPIS_Type *  p_reg)

Function for retrieving the SPIS status.

Parameters
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Current SPIS status.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask for which to clear the configuration.
__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
[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.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskThe specified task.
Returns
Address of the specified task register.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]taskTask to be activated.
__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
[in]p_regPointer to the structure of registers of the peripheral.
Returns
Number of bytes transmitted.
__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
[in]p_regPointer to the structure of registers of the peripheral.
[in]p_bufferPointer to the buffer that contains the data to send.
[in]lengthMaximum number of data bytes to transmit.

Documentation feedback | Developer Zone | Subscribe | Updated