Skip to content

Commit

Permalink
cpu: lpc2387: add spi_conf_pins()
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Sep 23, 2015
1 parent 320aa47 commit d0ff494
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cpu/lpc2387/periph/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */

0 comments on commit d0ff494

Please sign in to comment.