diff options
author | Keith Packard <keithp@keithp.com> | 2013-05-19 20:25:13 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-05-19 20:39:19 -0700 |
commit | b9bb088a36fd351809f4c378356327ffa663c974 (patch) | |
tree | 1b7897ab1650cde3b195406a3d9bbed91986dec0 /src/lpc/ao_spi_lpc.c | |
parent | 397109139fb9ff27ec7cfb0cafa65d1dbea053bd (diff) |
altos/lpc: Allow for alternate SPI SCLK0 pin usage
SPI SCLK0 can appear on three different pins; let the application
configure which one it wants.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lpc/ao_spi_lpc.c')
-rw-r--r-- | src/lpc/ao_spi_lpc.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lpc/ao_spi_lpc.c b/src/lpc/ao_spi_lpc.c index 7c830053..12d44872 100644 --- a/src/lpc/ao_spi_lpc.c +++ b/src/lpc/ao_spi_lpc.c @@ -125,7 +125,21 @@ ao_spi_init(void) { #if HAS_SPI_0 /* Configure pins */ - lpc_ioconf.pio0_6 = ao_lpc_alternate(LPC_IOCONF_FUNC_SCK0); +#if SPI_SCK0_P0_6 + lpc_ioconf.pio0_6 = ao_lpc_alternate(LPC_IOCONF_FUNC_PIO0_6_SCK0); +#define HAS_SCK0 +#endif +#if SPI_SCK0_P0_10 + lpc_ioconf.pio0_10 = ao_lpc_alternate(LPC_IOCONF_FUNC_PIO0_10_SCK0); +#define HAS_SCK0 +#endif +#if SPI_SCK0_P1_29 + lpc_ioconf.pio1_29 = ao_lpc_alternate(LPC_IOCONF_FUNC_PIO1_29_SCK0); +#define HAS_SCK0 +#endif +#ifndef HAS_SCK0 +#error "No pin specified for SCK0" +#endif lpc_ioconf.pio0_8 = ao_lpc_alternate(LPC_IOCONF_FUNC_MISO0); lpc_ioconf.pio0_9 = ao_lpc_alternate(LPC_IOCONF_FUNC_MOSI0); |