stm32f4: Encode mode/func into single parameter of gpio_peripheral

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-07-28 11:32:56 -04:00
parent 7d4c475e52
commit ef0784afe6
5 changed files with 13 additions and 12 deletions

View file

@ -20,9 +20,9 @@ spi_setup(uint32_t bus, uint8_t mode, uint32_t rate)
// Enable SPI
enable_pclock(SPI2_BASE);
gpio_peripheral(GPIO('B', 14), GPIO_FUNCTION, 5, 1);
gpio_peripheral(GPIO('B', 15), GPIO_FUNCTION, 5, 0);
gpio_peripheral(GPIO('B', 13), GPIO_FUNCTION, 5, 0);
gpio_peripheral(GPIO('B', 14), GPIO_FUNCTION(5), 1);
gpio_peripheral(GPIO('B', 15), GPIO_FUNCTION(5), 0);
gpio_peripheral(GPIO('B', 13), GPIO_FUNCTION(5), 0);
// Calculate CR1 register
uint32_t pclk = get_pclock_frequency(SPI2_BASE);