X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstm%2Fao_spi_stm.c;h=547de9e50ca0b887864ecaab28986d923b2ed572;hb=90507d4f7ef77b0870a032b1d9809898c2924721;hp=8bb0d8e8a2be33e869e393a75598be8dac7c5329;hpb=1489263b895a2a825e29d0560c9b1dbba8a3f431;p=fw%2Faltos diff --git a/src/stm/ao_spi_stm.c b/src/stm/ao_spi_stm.c index 8bb0d8e8..547de9e5 100644 --- a/src/stm/ao_spi_stm.c +++ b/src/stm/ao_spi_stm.c @@ -23,7 +23,7 @@ struct ao_spi_stm_info { struct stm_spi *stm_spi; }; -uint8_t ao_spi_mutex[STM_NUM_SPI]; +uint8_t ao_spi_mutex[STM_NUM_SPI]; static const struct ao_spi_stm_info ao_spi_stm_info[STM_NUM_SPI] = { { @@ -267,7 +267,7 @@ ao_spi_duplex(void *out, void *in, uint16_t len, uint8_t spi_index) } void -ao_spi_get(uint8_t spi_index) +ao_spi_get(uint8_t spi_index, uint32_t speed) { struct stm_spi *stm_spi = ao_spi_stm_info[spi_index].stm_spi; @@ -282,7 +282,7 @@ ao_spi_get(uint8_t spi_index) (1 << STM_SPI_CR1_SSI) | /* ... */ (0 << STM_SPI_CR1_LSBFIRST) | /* Big endian */ (1 << STM_SPI_CR1_SPE) | /* Enable SPI unit */ - (STM_SPI_CR1_BR_PCLK_4 << STM_SPI_CR1_BR) | /* baud rate to pclk/4 */ + (speed << STM_SPI_CR1_BR) | /* baud rate to pclk/4 */ (1 << STM_SPI_CR1_MSTR) | (0 << STM_SPI_CR1_CPOL) | /* Format 0 */ (0 << STM_SPI_CR1_CPHA));