![]() |
nRF5 SDK
v12.3.0
|
| Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API |
Hardware access layer for accessing the SPI peripheral. More...
Macros | |
| #define | NRF_SPI_PIN_NOT_CONNECTED 0xFFFFFFFF |
| This value can be used as a parameter for the nrf_spi_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_spi_event_t { NRF_SPI_EVENT_READY = offsetof(NRF_SPI_Type, EVENTS_READY) } |
| SPI events. More... | |
| enum | nrf_spi_int_mask_t { NRF_SPI_INT_READY_MASK = SPI_INTENSET_READY_Msk } |
| SPI interrupts. More... | |
| enum | nrf_spi_frequency_t { NRF_SPI_FREQ_125K = SPI_FREQUENCY_FREQUENCY_K125, NRF_SPI_FREQ_250K = SPI_FREQUENCY_FREQUENCY_K250, NRF_SPI_FREQ_500K = SPI_FREQUENCY_FREQUENCY_K500, NRF_SPI_FREQ_1M = SPI_FREQUENCY_FREQUENCY_M1, NRF_SPI_FREQ_2M = SPI_FREQUENCY_FREQUENCY_M2, NRF_SPI_FREQ_4M = SPI_FREQUENCY_FREQUENCY_M4, NRF_SPI_FREQ_8M = (int)SPI_FREQUENCY_FREQUENCY_M8 } |
| SPI data rates. More... | |
| enum | nrf_spi_mode_t { NRF_SPI_MODE_0, NRF_SPI_MODE_1, NRF_SPI_MODE_2, NRF_SPI_MODE_3 } |
| SPI modes. More... | |
| enum | nrf_spi_bit_order_t { NRF_SPI_BIT_ORDER_MSB_FIRST = SPI_CONFIG_ORDER_MsbFirst, NRF_SPI_BIT_ORDER_LSB_FIRST = SPI_CONFIG_ORDER_LsbFirst } |
| SPI bit orders. More... | |
Functions | |
| __STATIC_INLINE void | nrf_spi_event_clear (NRF_SPI_Type *p_reg, nrf_spi_event_t spi_event) |
| Function for clearing a specific SPI event. More... | |
| __STATIC_INLINE bool | nrf_spi_event_check (NRF_SPI_Type *p_reg, nrf_spi_event_t spi_event) |
| Function for checking the state of a specific SPI event. More... | |
| __STATIC_INLINE uint32_t * | nrf_spi_event_address_get (NRF_SPI_Type *p_reg, nrf_spi_event_t spi_event) |
| Function for getting the address of a specific SPI event register. More... | |
| __STATIC_INLINE void | nrf_spi_int_enable (NRF_SPI_Type *p_reg, uint32_t spi_int_mask) |
| Function for enabling specified interrupts. More... | |
| __STATIC_INLINE void | nrf_spi_int_disable (NRF_SPI_Type *p_reg, uint32_t spi_int_mask) |
| Function for disabling specified interrupts. More... | |
| __STATIC_INLINE bool | nrf_spi_int_enable_check (NRF_SPI_Type *p_reg, nrf_spi_int_mask_t spi_int) |
| Function for retrieving the state of a given interrupt. More... | |
| __STATIC_INLINE void | nrf_spi_enable (NRF_SPI_Type *p_reg) |
| Function for enabling the SPI peripheral. More... | |
| __STATIC_INLINE void | nrf_spi_disable (NRF_SPI_Type *p_reg) |
| Function for disabling the SPI peripheral. More... | |
| __STATIC_INLINE void | nrf_spi_pins_set (NRF_SPI_Type *p_reg, uint32_t sck_pin, uint32_t mosi_pin, uint32_t miso_pin) |
| Function for configuring SPI pins. More... | |
| __STATIC_INLINE void | nrf_spi_txd_set (NRF_SPI_Type *p_reg, uint8_t data) |
| Function for writing data to the SPI transmitter register. More... | |
| __STATIC_INLINE uint8_t | nrf_spi_rxd_get (NRF_SPI_Type *p_reg) |
| Function for reading data from the SPI receiver register. More... | |
| __STATIC_INLINE void | nrf_spi_frequency_set (NRF_SPI_Type *p_reg, nrf_spi_frequency_t frequency) |
| Function for setting the SPI master data rate. More... | |
| __STATIC_INLINE void | nrf_spi_configure (NRF_SPI_Type *p_reg, nrf_spi_mode_t spi_mode, nrf_spi_bit_order_t spi_bit_order) |
| Function for setting the SPI configuration. More... | |
Hardware access layer for accessing the SPI peripheral.
| enum nrf_spi_bit_order_t |
| enum nrf_spi_event_t |
| enum nrf_spi_frequency_t |
| enum nrf_spi_int_mask_t |
| enum nrf_spi_mode_t |
| __STATIC_INLINE void nrf_spi_configure | ( | NRF_SPI_Type * | p_reg, |
| nrf_spi_mode_t | spi_mode, | ||
| nrf_spi_bit_order_t | spi_bit_order | ||
| ) |
Function for setting the SPI configuration.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | spi_mode | SPI mode. |
| [in] | spi_bit_order | SPI bit order. |
| __STATIC_INLINE void nrf_spi_disable | ( | NRF_SPI_Type * | p_reg | ) |
Function for disabling the SPI peripheral.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| __STATIC_INLINE void nrf_spi_enable | ( | NRF_SPI_Type * | p_reg | ) |
Function for enabling the SPI peripheral.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| __STATIC_INLINE uint32_t* nrf_spi_event_address_get | ( | NRF_SPI_Type * | p_reg, |
| nrf_spi_event_t | spi_event | ||
| ) |
Function for getting the address of a specific SPI event register.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | spi_event | Requested event. |
| __STATIC_INLINE bool nrf_spi_event_check | ( | NRF_SPI_Type * | p_reg, |
| nrf_spi_event_t | spi_event | ||
| ) |
Function for checking the state of a specific SPI event.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | spi_event | Event to check. |
| true | If the event is set. |
| false | If the event is not set. |
| __STATIC_INLINE void nrf_spi_event_clear | ( | NRF_SPI_Type * | p_reg, |
| nrf_spi_event_t | spi_event | ||
| ) |
Function for clearing a specific SPI event.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | spi_event | Event to clear. |
| __STATIC_INLINE void nrf_spi_frequency_set | ( | NRF_SPI_Type * | p_reg, |
| nrf_spi_frequency_t | frequency | ||
| ) |
Function for setting the SPI master data rate.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | frequency | SPI frequency. |
| __STATIC_INLINE void nrf_spi_int_disable | ( | NRF_SPI_Type * | p_reg, |
| uint32_t | spi_int_mask | ||
| ) |
Function for disabling specified interrupts.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | spi_int_mask | Interrupts to disable. |
| __STATIC_INLINE void nrf_spi_int_enable | ( | NRF_SPI_Type * | p_reg, |
| uint32_t | spi_int_mask | ||
| ) |
Function for enabling specified interrupts.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | spi_int_mask | Interrupts to enable. |
| __STATIC_INLINE bool nrf_spi_int_enable_check | ( | NRF_SPI_Type * | p_reg, |
| nrf_spi_int_mask_t | spi_int | ||
| ) |
Function for retrieving the state of a given interrupt.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | spi_int | Interrupt to check. |
| true | If the interrupt is enabled. |
| false | If the interrupt is not enabled. |
| __STATIC_INLINE void nrf_spi_pins_set | ( | NRF_SPI_Type * | p_reg, |
| uint32_t | sck_pin, | ||
| uint32_t | mosi_pin, | ||
| uint32_t | miso_pin | ||
| ) |
Function for configuring SPI pins.
If a given signal is not needed, pass the NRF_SPI_PIN_NOT_CONNECTED value instead of its pin number.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | sck_pin | SCK pin number. |
| [in] | mosi_pin | MOSI pin number. |
| [in] | miso_pin | MISO pin number. |
| __STATIC_INLINE uint8_t nrf_spi_rxd_get | ( | NRF_SPI_Type * | p_reg | ) |
Function for reading data from the SPI receiver register.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| __STATIC_INLINE void nrf_spi_txd_set | ( | NRF_SPI_Type * | p_reg, |
| uint8_t | data | ||
| ) |
Function for writing data to the SPI transmitter register.
| [in] | p_reg | Pointer to the peripheral registers structure. |
| [in] | data | TX data to send. |