[fix] spi drivers set cs pin in idle

This commit is contained in:
2023-05-21 21:08:09 +02:00
parent 6d313aaa54
commit 26f5cfe3ce
2 changed files with 4 additions and 0 deletions

View File

@@ -40,6 +40,8 @@ void ad9833_init(ad9833_handle_t *hfg, SPI_HandleTypeDef *hspi, GPIO_TypeDef *cs
hfg->cs_port = cs_port; hfg->cs_port = cs_port;
hfg->cs_pin = cs_pin; hfg->cs_pin = cs_pin;
HAL_GPIO_WritePin(hfg->cs_port, hfg->cs_pin, GPIO_PIN_SET);
hfg->_regCtl = 0; hfg->_regCtl = 0;
hfg->_regCtl |= (1 << AD_B28); // always write 2 words consecutively for frequency hfg->_regCtl |= (1 << AD_B28); // always write 2 words consecutively for frequency
ad9833_transmit16(hfg, hfg->_regCtl); ad9833_transmit16(hfg, hfg->_regCtl);

View File

@@ -17,6 +17,8 @@ void mcp41x_init(mcp41x_handle_t *hpot, SPI_HandleTypeDef *hspi, GPIO_TypeDef *c
hpot->cs_pin = cs_pin; hpot->cs_pin = cs_pin;
hpot->max_res = res; hpot->max_res = res;
hpot->dir = MCP41X_ATOB; hpot->dir = MCP41X_ATOB;
HAL_GPIO_WritePin(hpot->cs_port, hpot->cs_pin, GPIO_PIN_SET);
} }
void mcp41x_setValue(mcp41x_handle_t *hpot, uint8_t value) void mcp41x_setValue(mcp41x_handle_t *hpot, uint8_t value)