cpu/stm32l1-f0/spi: Configure the SPI pins as highspeed
This commit is contained in:
parent
e96f32ccd5
commit
1fe296d707
@ -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));
|
||||||
|
|||||||
@ -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));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user