From d0ff4946eaacc9b8e051b9d82cb8b3368310fc62 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Fri, 11 Sep 2015 11:13:57 +0200 Subject: [PATCH] cpu: lpc2387: add spi_conf_pins() --- cpu/lpc2387/periph/spi.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cpu/lpc2387/periph/spi.c b/cpu/lpc2387/periph/spi.c index eef2621aa0..fecfc04d7c 100644 --- a/cpu/lpc2387/periph/spi.c +++ b/cpu/lpc2387/periph/spi.c @@ -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)*/ /* PIN Setup*/ - PINSEL3 |= BIT8 + BIT9; /* Set CLK function to SPI*/ - PINSEL3 |= BIT14 + BIT15; /* Set MISO function to SPI*/ - PINSEL3 |= BIT16 + BIT17; /* Set MOSI function to SPI*/ + spi_conf_pins(dev); /* Interface Setup*/ 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 */