General functions for SPI driver. These functions provide basic functionality on top of SPI hardware registers. More...
Functions | |
| INIT_CODE spi_status_en | spi_init (spi_instance_en id) |
| INIT_CODE spi_status_en | spi_deinit (spi_instance_en id) |
| spi_status_en | spi_set_configuration (spi_instance_en id, spi_config_t *config, uint32_t *achieved_clk_rate_khz) |
| spi_status_en | spi_get_configuration (spi_instance_en id, spi_config_t *config, uint32_t *achieved_clk_rate_khz) |
| spi_status_en | spi_enable (spi_instance_en id) |
| spi_status_en | spi_disable (spi_instance_en id) |
| spi_status_en | spi_controller_select_peripheral (spi_instance_en id, uint32_t peripheral_select) |
General functions for SPI driver. These functions provide basic functionality on top of SPI hardware registers.
group_spi_data_structures
| INIT_CODE spi_status_en spi_init | ( | spi_instance_en | id | ) |
Initializes the SPI block
| id | SPI Instance ID. |
| INIT_CODE spi_status_en spi_deinit | ( | spi_instance_en | id | ) |
Deinitializes the SPI block
| id | SPI Instance ID. |
| spi_status_en spi_set_configuration | ( | spi_instance_en | id, |
| spi_config_t * | config, | ||
| uint32_t * | achieved_clk_rate_khz ) |
Configures the SPI block. This function should only be called when the SPI block is disabled. This function checks each parameter to ensure they are valid, it sets the clock divider to achieve desired SPI clock rate.
| id | SPI Instance ID. |
| config | Configuration structure - See spi_config_t for details |
| achieved_clk_rate_khz | Pointer to location to return achieved clock rate in kHz. |
| spi_status_en spi_get_configuration | ( | spi_instance_en | id, |
| spi_config_t * | config, | ||
| uint32_t * | achieved_clk_rate_khz ) |
Gets current SPI block configuration.
| id | SPI Instance ID. |
| config | Configuration structure - See spi_config_t for details |
| achieved_clk_rate_khz | Pointer to location to return achieved clock rate in kHz. |
| spi_status_en spi_enable | ( | spi_instance_en | id | ) |
Enables the SPI block. Note that if the SPI block is enabled the configuration can't be changed. First set the configuration and then enable the SPI.
| id | SPI Instance ID. |
| spi_status_en spi_disable | ( | spi_instance_en | id | ) |
Disables the SPI block. Note that if the SPI block is enabled the configuration can't be changed. Call this function before changing any configuration settings.
| id | SPI Instance ID. |
| spi_status_en spi_controller_select_peripheral | ( | spi_instance_en | id, |
| uint32_t | peripheral_select ) |
Selects which peripheral select to enable during communication. Note that this function is only valid in controller mode, it will be ignored if block is peripheral
| id | SPI Instance ID. |
| peripheral_select | Bit mask of peripheral select lines to enable |