X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstmf0%2Fao_arch_funcs.h;h=953a0c00c2a69ad107124a91b337bb04ed05256e;hb=7ac9267b156d7bb6e942dd630a9ba142ba0c7a00;hp=d46899d575c409f149fd7e50767debb0422f24d1;hpb=f1ea931ca808b120b5f378269aa9a6e38e90b8af;p=fw%2Faltos diff --git a/src/stmf0/ao_arch_funcs.h b/src/stmf0/ao_arch_funcs.h index d46899d5..953a0c00 100644 --- a/src/stmf0/ao_arch_funcs.h +++ b/src/stmf0/ao_arch_funcs.h @@ -36,8 +36,9 @@ #define _AO_SPI_SPEED_187500Hz STM_SPI_CR1_BR_PCLK_256 static inline uint32_t -ao_spi_speed(uint32_t hz) +ao_spi_speed(int index, uint32_t hz) { + (void) index; if (hz >=24000000) return _AO_SPI_SPEED_24MHz; if (hz >=12000000) return _AO_SPI_SPEED_12MHz; if (hz >= 6000000) return _AO_SPI_SPEED_6MHz; @@ -95,6 +96,9 @@ ao_spi_get(uint8_t spi_index, uint32_t speed); void ao_spi_put(uint8_t spi_index); +void +ao_spi_put_pins(uint8_t spi_index); + void ao_spi_send(const void *block, uint16_t len, uint8_t spi_index); @@ -151,7 +155,7 @@ ao_spi_recv_byte(uint8_t spi_index) stm_spi->dr = 0xff; while (!(stm_spi->sr & (1 << STM_SPI_SR_RXNE))) ; - return stm_spi->dr; + return (uint8_t) stm_spi->dr; } void @@ -215,16 +219,16 @@ static inline void ao_enable_port(struct stm_gpio *port) static inline void ao_disable_port(struct stm_gpio *port) { if ((port) == &stm_gpioa) { - stm_rcc.ahbenr &= ~(1 << STM_RCC_AHBENR_IOPAEN); + stm_rcc.ahbenr &= ~(1UL << STM_RCC_AHBENR_IOPAEN); ao_power_unregister(&ao_power_gpioa); } else if ((port) == &stm_gpiob) { - stm_rcc.ahbenr &= ~(1 << STM_RCC_AHBENR_IOPBEN); + stm_rcc.ahbenr &= ~(1UL << STM_RCC_AHBENR_IOPBEN); ao_power_unregister(&ao_power_gpiob); } else if ((port) == &stm_gpioc) { - stm_rcc.ahbenr &= ~(1 << STM_RCC_AHBENR_IOPCEN); + stm_rcc.ahbenr &= ~(1UL << STM_RCC_AHBENR_IOPCEN); ao_power_unregister(&ao_power_gpioc); } else if ((port) == &stm_gpiof) { - stm_rcc.ahbenr &= ~(1 << STM_RCC_AHBENR_IOPFEN); + stm_rcc.ahbenr &= ~(1UL << STM_RCC_AHBENR_IOPFEN); ao_power_unregister(&ao_power_gpiof); } }