![]() |
nrfx 4.5.0
|
Hardware access layer for managing the SPI peripheral. More...
Macros | |
| #define | NRF_SPI_INST_GET(idx) |
| Macro getting pointer to the structure of registers of the SPI peripheral. | |
| #define | NRF_SPI_PIN_NOT_CONNECTED UINT32_MAX |
| 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 , NRF_SPI_ALL_INTS_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 | |
| NRF_STATIC_INLINE void | nrf_spi_event_clear (NRF_SPI_Type *p_reg, nrf_spi_event_t event) |
| Function for clearing the specified SPI event. | |
| NRF_STATIC_INLINE bool | nrf_spi_event_check (NRF_SPI_Type const *p_reg, nrf_spi_event_t event) |
| Function for retrieving the state of the SPI event. | |
| NRF_STATIC_INLINE uint32_t | nrf_spi_event_address_get (NRF_SPI_Type const *p_reg, nrf_spi_event_t event) |
| Function for getting the address of the specified SPI event register. | |
| NRF_STATIC_INLINE void | nrf_spi_int_enable (NRF_SPI_Type *p_reg, uint32_t mask) |
| Function for enabling the specified interrupts. | |
| NRF_STATIC_INLINE void | nrf_spi_int_disable (NRF_SPI_Type *p_reg, uint32_t mask) |
| Function for disabling the specified interrupts. | |
| NRF_STATIC_INLINE uint32_t | nrf_spi_int_enable_check (NRF_SPI_Type const *p_reg, uint32_t mask) |
| Function for checking if the specified interrupts are enabled. | |
| NRF_STATIC_INLINE void | nrf_spi_enable (NRF_SPI_Type *p_reg) |
| Function for enabling the SPI peripheral. | |
| NRF_STATIC_INLINE void | nrf_spi_disable (NRF_SPI_Type *p_reg) |
| Function for disabling the SPI peripheral. | |
| NRF_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. | |
| NRF_STATIC_INLINE void | nrf_spi_sck_pin_set (NRF_SPI_Type *p_reg, uint32_t pin) |
| Function for setting the SCK pin. | |
| NRF_STATIC_INLINE void | nrf_spi_mosi_pin_set (NRF_SPI_Type *p_reg, uint32_t pin) |
| Function for setting the MOSI pin. | |
| NRF_STATIC_INLINE void | nrf_spi_miso_pin_set (NRF_SPI_Type *p_reg, uint32_t pin) |
| Function for setting the MISO pin. | |
| NRF_STATIC_INLINE uint32_t | nrf_spi_sck_pin_get (NRF_SPI_Type const *p_reg) |
| Function for getting the SCK pin selection. | |
| NRF_STATIC_INLINE uint32_t | nrf_spi_mosi_pin_get (NRF_SPI_Type const *p_reg) |
| Function for getting the MOSI pin selection. | |
| NRF_STATIC_INLINE uint32_t | nrf_spi_miso_pin_get (NRF_SPI_Type const *p_reg) |
| Function for getting the MISO pin selection. | |
| NRF_STATIC_INLINE void | nrf_spi_txd_set (NRF_SPI_Type *p_reg, uint8_t data) |
| Function for writing data to the SPI transmitter register. | |
| NRF_STATIC_INLINE uint8_t | nrf_spi_rxd_get (NRF_SPI_Type const *p_reg) |
| Function for reading data from the SPI receiver register. | |
| NRF_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. | |
| NRF_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. | |
Hardware access layer for managing the SPI peripheral.
| #define NRF_SPI_INST_GET | ( | idx | ) |
Macro getting pointer to the structure of registers of the SPI peripheral.
| [in] | idx | SPI instance index. |
| 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 |
| NRF_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 structure of registers of the peripheral. |
| [in] | spi_mode | SPI mode. |
| [in] | spi_bit_order | SPI bit order. |
| NRF_STATIC_INLINE void nrf_spi_disable | ( | NRF_SPI_Type * | p_reg | ) |
Function for disabling the SPI peripheral.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE void nrf_spi_enable | ( | NRF_SPI_Type * | p_reg | ) |
Function for enabling the SPI peripheral.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE uint32_t nrf_spi_event_address_get | ( | NRF_SPI_Type const * | p_reg, |
| nrf_spi_event_t | event ) |
Function for getting the address of the specified SPI event register.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | event | The specified event. |
| NRF_STATIC_INLINE bool nrf_spi_event_check | ( | NRF_SPI_Type const * | p_reg, |
| nrf_spi_event_t | event ) |
Function for retrieving the state of the SPI 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. |
| NRF_STATIC_INLINE void nrf_spi_event_clear | ( | NRF_SPI_Type * | p_reg, |
| nrf_spi_event_t | event ) |
Function for clearing the specified SPI event.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | event | Event to be cleared. |
| NRF_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 structure of registers of the peripheral. |
| [in] | frequency | SPI frequency. |
| NRF_STATIC_INLINE void nrf_spi_int_disable | ( | NRF_SPI_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. Use nrf_spi_int_mask_t values for bit masking. |
| NRF_STATIC_INLINE void nrf_spi_int_enable | ( | NRF_SPI_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. Use nrf_spi_int_mask_t values for bit masking. |
| NRF_STATIC_INLINE uint32_t nrf_spi_int_enable_check | ( | NRF_SPI_Type const * | p_reg, |
| uint32_t | mask ) |
Function for checking if the specified interrupts are enabled.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | mask | Mask of interrupts to be checked. Use nrf_spi_int_mask_t values for bit masking. |
| NRF_STATIC_INLINE uint32_t nrf_spi_miso_pin_get | ( | NRF_SPI_Type const * | p_reg | ) |
Function for getting the MISO pin selection.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE void nrf_spi_miso_pin_set | ( | NRF_SPI_Type * | p_reg, |
| uint32_t | pin ) |
Function for setting the MISO pin.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | pin | MISO pin number. |
| NRF_STATIC_INLINE uint32_t nrf_spi_mosi_pin_get | ( | NRF_SPI_Type const * | p_reg | ) |
Function for getting the MOSI pin selection.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE void nrf_spi_mosi_pin_set | ( | NRF_SPI_Type * | p_reg, |
| uint32_t | pin ) |
Function for setting the MOSI pin.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | pin | MOSI pin number. |
| NRF_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 structure of registers of the peripheral. |
| [in] | sck_pin | SCK pin number. |
| [in] | mosi_pin | MOSI pin number. |
| [in] | miso_pin | MISO pin number. |
| NRF_STATIC_INLINE uint8_t nrf_spi_rxd_get | ( | NRF_SPI_Type const * | p_reg | ) |
Function for reading data from the SPI receiver register.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE uint32_t nrf_spi_sck_pin_get | ( | NRF_SPI_Type const * | p_reg | ) |
Function for getting the SCK pin selection.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| NRF_STATIC_INLINE void nrf_spi_sck_pin_set | ( | NRF_SPI_Type * | p_reg, |
| uint32_t | pin ) |
Function for setting the SCK pin.
| [in] | p_reg | Pointer to the structure of registers of the peripheral. |
| [in] | pin | SCK pin number. |
| NRF_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 structure of registers of the peripheral. |
| [in] | data | TX data to send. |