![]() |
nrfx 4.5.0
|
Serial Peripheral Interface Master with EasyDMA (SPIM) driver. More...
Topics | |
| SPIM peripheral driver configuration | |
Data Structures | |
| struct | nrfx_spim_event_t |
| SPIM event description with transmission details. More... | |
| struct | nrfx_spim_t |
| Data structure of the Serial Peripheral Interface Master with EasyDMA (SPIM) driver instance. More... | |
| struct | nrfx_spim_config_t |
| Configuration structure of the SPIM driver instance. More... | |
Macros | |
| #define | NRFX_SPIM_INSTANCE(reg) |
| Macro for creating an instance of the SPIM driver. | |
| #define | NRFX_SPIM_DEFAULT_CONFIG(_pin_sck, _pin_mosi, _pin_miso, _pin_ss) |
| SPIM driver default configuration. | |
| #define | NRFX_SPIM_FREQUENCY_STATIC_CHECK(id, frequency) |
| Macro for checking whether specified frequency can be achieved for a given SPIM instance. | |
| #define | NRFX_SPIM_BASE_FREQUENCY_GET(p_instance) |
| Macro for getting base frequency value in Hz for a given SPIM instance. | |
| #define | NRFX_SPIM_FLAG_TX_POSTINC (1UL << 0) |
| Flag indicating that TX buffer address will be incremented after transfer. | |
| #define | NRFX_SPIM_FLAG_RX_POSTINC (1UL << 1) |
| Flag indicating that RX buffer address will be incremented after transfer. | |
| #define | NRFX_SPIM_FLAG_NO_XFER_EVT_HANDLER (1UL << 2) |
| Flag indicating that the interrupt after each transfer will be suppressed, and the event handler will not be called. | |
| #define | NRFX_SPIM_FLAG_HOLD_XFER (1UL << 3) |
| Flag indicating that the transfer will be set up, but not started. | |
| #define | NRFX_SPIM_FLAG_REPEATED_XFER (1UL << 4) |
| Flag indicating that the transfer will be executed multiple times. | |
| #define | NRFX_SPIM_SINGLE_XFER(p_tx, tx_len, p_rx, rx_len) |
| Macro for setting up single transfer descriptor. | |
| #define | NRFX_SPIM_XFER_TRX(p_tx_buf, tx_length, p_rx_buf, rx_length) |
| Macro for setting the duplex TX RX transfer. | |
| #define | NRFX_SPIM_XFER_TX(p_buf, length) |
| Macro for setting the TX transfer. | |
| #define | NRFX_SPIM_XFER_RX(p_buf, length) |
| Macro for setting the RX transfer. | |
Typedefs | |
| typedef nrfy_spim_xfer_desc_t | nrfx_spim_xfer_desc_t |
| Single transfer descriptor structure. | |
| typedef void(* | nrfx_spim_event_handler_t) (nrfx_spim_event_t const *p_event, void *p_context) |
| SPIM event handler type for user-defined callback function. | |
Enumerations | |
| enum | nrfx_spim_event_type_t { NRFX_SPIM_EVENT_DONE } |
| SPIM master driver event types, passed to the handler routine provided during initialization. More... | |
Functions | |
| int | nrfx_spim_init (nrfx_spim_t *p_instance, nrfx_spim_config_t const *p_config, nrfx_spim_event_handler_t handler, void *p_context) |
| Function for initializing the SPIM driver instance. | |
| int | nrfx_spim_reconfigure (nrfx_spim_t *p_instance, nrfx_spim_config_t const *p_config) |
| Function for reconfiguring the SPIM driver instance. | |
| void | nrfx_spim_uninit (nrfx_spim_t *p_instance) |
| Function for uninitializing the SPIM driver instance. | |
| bool | nrfx_spim_init_check (nrfx_spim_t const *p_instance) |
| Function for checking if the SPIM driver instance is initialized. | |
| int | nrfx_spim_xfer (nrfx_spim_t *p_instance, nrfx_spim_xfer_desc_t const *p_xfer_desc, uint32_t flags) |
| Function for starting the SPIM data transfer. | |
| int | nrfx_spim_xfer_dcx (nrfx_spim_t *p_instance, nrfx_spim_xfer_desc_t const *p_xfer_desc, uint32_t flags, uint8_t cmd_length) |
| Function for starting the SPIM data transfer with DCX control. | |
| NRFX_STATIC_INLINE uint32_t | nrfx_spim_start_task_address_get (nrfx_spim_t const *p_instance) |
| Function for returning the address of a SPIM start task. | |
| NRFX_STATIC_INLINE uint32_t | nrfx_spim_end_event_address_get (nrfx_spim_t const *p_instance) |
| Function for returning the address of a END SPIM event. | |
| void | nrfx_spim_abort (nrfx_spim_t *p_instance) |
| Function for aborting ongoing transfer. | |
| void | nrfx_spim_irq_handler (nrfx_spim_t *p_instance) |
| Driver interrupt handler. | |
| void | nrfx_spim_nrf52_anomaly_58_init (nrfx_spim_t *p_instance, nrfx_gpiote_t *p_gpiote_inst) |
| Function for providing GPIOTE driver instance for the nRF52 Anomaly 58 workaround. | |
Serial Peripheral Interface Master with EasyDMA (SPIM) driver.
| #define NRFX_SPIM_BASE_FREQUENCY_GET | ( | p_instance | ) |
Macro for getting base frequency value in Hz for a given SPIM instance.
| [in] | p_instance | Pointer to the driver instance structure. |
| #define NRFX_SPIM_DEFAULT_CONFIG | ( | _pin_sck, | |
| _pin_mosi, | |||
| _pin_miso, | |||
| _pin_ss ) |
SPIM driver default configuration.
This configuration sets up SPIM with the following options:
| [in] | _pin_sck | SCK pin. |
| [in] | _pin_mosi | MOSI pin. |
| [in] | _pin_miso | MISO pin. |
| [in] | _pin_ss | Slave select pin. |
| #define NRFX_SPIM_FREQUENCY_STATIC_CHECK | ( | id, | |
| frequency ) |
Macro for checking whether specified frequency can be achieved for a given SPIM instance.
| [in] | id | Index of the specified SPIM instance. |
| [in] | frequency | Desired frequency value in Hz. |
| #define NRFX_SPIM_INSTANCE | ( | reg | ) |
Macro for creating an instance of the SPIM driver.
| #define NRFX_SPIM_SINGLE_XFER | ( | p_tx, | |
| tx_len, | |||
| p_rx, | |||
| rx_len ) |
Macro for setting up single transfer descriptor.
This macro is for internal use only.
| #define NRFX_SPIM_XFER_RX | ( | p_buf, | |
| length ) |
Macro for setting the RX transfer.
| #define NRFX_SPIM_XFER_TRX | ( | p_tx_buf, | |
| tx_length, | |||
| p_rx_buf, | |||
| rx_length ) |
Macro for setting the duplex TX RX transfer.
| #define NRFX_SPIM_XFER_TX | ( | p_buf, | |
| length ) |
Macro for setting the TX transfer.
| void nrfx_spim_abort | ( | nrfx_spim_t * | p_instance | ) |
Function for aborting ongoing transfer.
| [in] | p_instance | Pointer to the driver instance structure. |
| NRFX_STATIC_INLINE uint32_t nrfx_spim_end_event_address_get | ( | nrfx_spim_t const * | p_instance | ) |
Function for returning the address of a END SPIM event.
The END event can be used to detect the end of a transfer if the NRFX_SPIM_FLAG_NO_XFER_EVT_HANDLER option is used.
| [in] | p_instance | Pointer to the driver instance structure. |
| int nrfx_spim_init | ( | nrfx_spim_t * | p_instance, |
| nrfx_spim_config_t const * | p_config, | ||
| nrfx_spim_event_handler_t | handler, | ||
| void * | p_context ) |
Function for initializing the SPIM driver instance.
This function configures and enables the specified peripheral.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | p_config | Pointer to the structure with the initial configuration. NULL if configuration is to be skipped and will be done later using nrfx_spim_reconfigure. |
| [in] | handler | Event handler provided by the user. If NULL, transfers will be performed in blocking mode. |
| [in] | p_context | Context passed to event handler. |
| 0 | Initialization was successful. |
| -EALREADY | The driver is already initialized. |
| -EBUSY | Some other peripheral with the same instance ID is already in use. This is possible only if Peripheral Resource Sharing (PRS) module is enabled. |
| -ENOTSUP | Requested configuration is not supported by the SPIM instance. |
| -EINVAL | Requested frequency is not available on the specified driver instance or pins. |
| bool nrfx_spim_init_check | ( | nrfx_spim_t const * | p_instance | ) |
Function for checking if the SPIM driver instance is initialized.
| [in] | p_instance | Pointer to the driver instance structure. |
| true | Instance is already initialized. |
| false | Instance is not initialized. |
| void nrfx_spim_irq_handler | ( | nrfx_spim_t * | p_instance | ) |
Driver interrupt handler.
| [in] | p_instance | Pointer to the driver instance structure. |
| void nrfx_spim_nrf52_anomaly_58_init | ( | nrfx_spim_t * | p_instance, |
| nrfx_gpiote_t * | p_gpiote_inst ) |
Function for providing GPIOTE driver instance for the nRF52 Anomaly 58 workaround.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | p_gpiote_inst | Pointer to the GPIOTE driver instance structure. |
| int nrfx_spim_reconfigure | ( | nrfx_spim_t * | p_instance, |
| nrfx_spim_config_t const * | p_config ) |
Function for reconfiguring the SPIM driver instance.
| [in] | p_instance | Pointer to the driver instance structure. |
| [in] | p_config | Pointer to the structure with the configuration. |
| 0 | Reconfiguration was successful. |
| -EBUSY | The driver is during transfer. |
| -EINPROGRESS | The driver is uninitialized. |
| -ENOTSUP | Requested configuration is not supported by the SPIM instance. |
| -EINVAL | Requested frequency is not available on the specified driver instance or pins. |
| -EPERM | Software-controlled Slave Select and hardware-controlled Slave Select cannot be active at the same time. |
| NRFX_STATIC_INLINE uint32_t nrfx_spim_start_task_address_get | ( | nrfx_spim_t const * | p_instance | ) |
Function for returning the address of a SPIM start task.
This function is to be used if nrfx_spim_xfer was called with the flag NRFX_SPIM_FLAG_HOLD_XFER. In that case, the transfer is not started by the driver, but it must be started externally by PPI.
| [in] | p_instance | Pointer to the driver instance structure. |
| void nrfx_spim_uninit | ( | nrfx_spim_t * | p_instance | ) |
Function for uninitializing the SPIM driver instance.
| [in] | p_instance | Pointer to the driver instance structure. |
| int nrfx_spim_xfer | ( | nrfx_spim_t * | p_instance, |
| nrfx_spim_xfer_desc_t const * | p_xfer_desc, | ||
| uint32_t | flags ) |
Function for starting the SPIM data transfer.
Additional options are provided using the flags parameter:
| p_instance | Pointer to the driver instance structure. |
| p_xfer_desc | Pointer to the transfer descriptor. |
| flags | Transfer options (0 for default settings). |
| 0 | The procedure is successful. |
| -EBUSY | The driver is not ready for a new transfer. |
| -ENOTSUP | The provided parameters are not supported. |
| -EACCES | The provided buffers are not placed in the Data RAM region. |
| int nrfx_spim_xfer_dcx | ( | nrfx_spim_t * | p_instance, |
| nrfx_spim_xfer_desc_t const * | p_xfer_desc, | ||
| uint32_t | flags, | ||
| uint8_t | cmd_length ) |
Function for starting the SPIM data transfer with DCX control.
See nrfx_spim_xfer for description of additional options of transfer provided by the flags parameter.
| p_instance | Pointer to the driver instance structure. |
| p_xfer_desc | Pointer to the transfer descriptor. |
| flags | Transfer options (0 for default settings). |
| cmd_length | Length of the command bytes preceding the data bytes. The DCX line will be low during transmission of command bytes and high during transmission of data 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 cmd_length parameter causes all transmitted bytes to be marked as command bytes. |
| 0 | The procedure is successful. |
| -EBUSY | The driver is not ready for a new transfer. |
| -ENOTSUP | The provided parameters are not supported. |
| -EACCES | The provided buffers are not placed in the Data RAM region. |