cpu: lpc2387: add spi_conf_pins()

This commit is contained in:
Kaspar Schleiser 2015-09-11 11:13:57 +02:00
parent 320aa47200
commit d0ff4946ea

View File

@ -105,9 +105,7 @@ int spi_init_master(spi_t dev, spi_conf_t conf, spi_speed_t speed)
PCONP |= PCSSP0; /* Enable power for SSP0 (default is on)*/ PCONP |= PCSSP0; /* Enable power for SSP0 (default is on)*/
/* PIN Setup*/ /* PIN Setup*/
PINSEL3 |= BIT8 + BIT9; /* Set CLK function to SPI*/ spi_conf_pins(dev);
PINSEL3 |= BIT14 + BIT15; /* Set MISO function to SPI*/
PINSEL3 |= BIT16 + BIT17; /* Set MOSI function to SPI*/
/* Interface Setup*/ /* Interface Setup*/
SSP0CR0 = 7; SSP0CR0 = 7;
@ -194,4 +192,17 @@ void spi_poweroff(spi_t dev)
{ {
} }
int spi_conf_pins(spi_t dev)
{
switch (dev) {
case 0:
PINSEL3 |= BIT8 + BIT9; /* SCLK */
PINSEL3 |= BIT14 + BIT15; /* MISO */
PINSEL3 |= BIT16 + BIT17; /* MOSI */
return 0;
default:
return -1;
}
}
#endif /* SPI_0_EN */ #endif /* SPI_0_EN */