cpu/stm32l1-f0/spi: Configure the SPI pins as highspeed

This commit is contained in:
DipSwitch 2015-09-12 12:47:32 +02:00
parent e96f32ccd5
commit 1fe296d707
2 changed files with 2 additions and 0 deletions

View File

@ -151,6 +151,7 @@ int spi_conf_pins(spi_t dev)
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
port->MODER &= ~(3 << (pin[i] * 2)); port->MODER &= ~(3 << (pin[i] * 2));
port->MODER |= (2 << (pin[i] * 2)); port->MODER |= (2 << (pin[i] * 2));
port->OSPEEDR |= (3 << (pin[i] * 2));
int hl = (pin[i] < 8) ? 0 : 1; int hl = (pin[i] < 8) ? 0 : 1;
port->AFR[hl] &= ~(0xf << ((pin[i] - (hl * 8)) * 4)); port->AFR[hl] &= ~(0xf << ((pin[i] - (hl * 8)) * 4));
port->AFR[hl] |= (af << ((pin[i] - (hl * 8)) * 4)); port->AFR[hl] |= (af << ((pin[i] - (hl * 8)) * 4));

View File

@ -147,6 +147,7 @@ int spi_conf_pins(spi_t dev)
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
port->MODER &= ~(3 << (pin[i] * 2)); port->MODER &= ~(3 << (pin[i] * 2));
port->MODER |= (2 << (pin[i] * 2)); port->MODER |= (2 << (pin[i] * 2));
port->OSPEEDR |= (3 << (pin[i] * 2));
int hl = (pin[i] < 8) ? 0 : 1; int hl = (pin[i] < 8) ? 0 : 1;
port->AFR[hl] &= ~(0xf << ((pin[i] - (hl * 8)) * 4)); port->AFR[hl] &= ~(0xf << ((pin[i] - (hl * 8)) * 4));
port->AFR[hl] |= (af << ((pin[i] - (hl * 8)) * 4)); port->AFR[hl] |= (af << ((pin[i] - (hl * 8)) * 4));