feat(esp_driver_spi): add config for data io default level

This commit is contained in:
wanckl
2024-08-29 09:05:43 +08:00
committed by Armando
parent 8fcc57b12f
commit ab53d300d0
4 changed files with 21 additions and 5 deletions
+11 -5
View File
@@ -26,11 +26,6 @@ void spi_hal_init(spi_hal_context_t *hal, uint32_t host_id)
memset(hal, 0, sizeof(spi_hal_context_t));
spi_dev_t *hw = SPI_LL_GET_HW(host_id);
hal->hw = hw;
#if SPI_LL_MOSI_FREE_LEVEL
// Change default data line level to low which same as esp32
spi_ll_set_mosi_free_level(hw, 0);
#endif
spi_ll_master_init(hw);
//Force a transaction done interrupt. This interrupt won't fire yet because
@@ -43,6 +38,17 @@ void spi_hal_init(spi_hal_context_t *hal, uint32_t host_id)
spi_ll_apply_config(hw);
}
void spi_hal_config_io_default_level(spi_hal_context_t *hal, bool level)
{
#if SPI_LL_MOSI_FREE_LEVEL
// Config default output data line level when don't have transaction
spi_ll_set_mosi_free_level(hal->hw, level);
spi_ll_apply_config(hal->hw);
#else
HAL_LOGW(SPI_HAL_TAG, "The target don't support this config")
#endif
}
void spi_hal_deinit(spi_hal_context_t *hal)
{
spi_dev_t *hw = hal->hw;