mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-26 02:02:02 +00:00
spi_master: refactor hal context structures
This commit seperates the hal context into different configuration structures based on their members' definitions. Through refactoring spi_master.c, the device related configuration should be passed in and set each time before a new transaction. The transaction related configuration now is a local variable in case of the fact that error occurs without any notice when user forgets to pass new transaction configuration in (which means the old driver will use the trans_config that is saved from last transaction). Besides, via above refactor, this commit fixs a bug which leads to wrong cs polarity setting. Closes https://github.com/espressif/esp-idf/pull/5490 Moreover, via above refactor, this commit also fixs a bug about duplex mode switching when multiple devices are added to the bus. Closes https://github.com/espressif/esp-idf/issues/4641
This commit is contained in:
@@ -485,7 +485,7 @@ static inline void spi_ll_master_select_cs(spi_dev_t *hw, int cs_id)
|
||||
* @param hw Beginning address of the peripheral registers.
|
||||
* @param val stored clock configuration calculated before (by ``spi_ll_cal_clock``).
|
||||
*/
|
||||
static inline void spi_ll_master_set_clock_by_reg(spi_dev_t *hw, spi_ll_clock_val_t *val)
|
||||
static inline void spi_ll_master_set_clock_by_reg(spi_dev_t *hw, const spi_ll_clock_val_t *val)
|
||||
{
|
||||
hw->clock.val = *(uint32_t *)val;
|
||||
}
|
||||
|
Reference in New Issue
Block a user