diff options
author | Keith Packard <keithp@keithp.com> | 2013-05-19 20:24:11 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-05-19 20:39:19 -0700 |
commit | 397109139fb9ff27ec7cfb0cafa65d1dbea053bd (patch) | |
tree | bab8fb6bc1469050461513a1aae0ba6890386b56 | |
parent | e383d7a28d01729c50f933ceda77ea767d1b8087 (diff) |
altos/lpc: Leave SPI enabled all the time
Might be able to turn it off with some care; more experimentation required.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/lpc/ao_spi_lpc.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/lpc/ao_spi_lpc.c b/src/lpc/ao_spi_lpc.c index e7edca4c..7c830053 100644 --- a/src/lpc/ao_spi_lpc.c +++ b/src/lpc/ao_spi_lpc.c @@ -89,24 +89,11 @@ ao_spi_get(uint8_t id, uint32_t speed) /* Set the clock prescale */ lpc_ssp->cpsr = speed; - - /* Enable the device */ - lpc_ssp->cr1 = ((0 << LPC_SSP_CR1_LBM) | - (1 << LPC_SSP_CR1_SSE) | - (LPC_SSP_CR1_MS_MASTER << LPC_SSP_CR1_MS) | - (0 << LPC_SSP_CR1_SOD)); } void ao_spi_put(uint8_t id) { - struct lpc_ssp *lpc_ssp = ao_lpc_ssp[id]; - - /* Disable the device */ - lpc_ssp->cr1 = ((0 << LPC_SSP_CR1_LBM) | - (0 << LPC_SSP_CR1_SSE) | - (LPC_SSP_CR1_MS_MASTER << LPC_SSP_CR1_MS) | - (0 << LPC_SSP_CR1_SOD)); ao_mutex_put(&ao_spi_mutex[id]); } @@ -121,6 +108,13 @@ ao_spi_channel_init(uint8_t id) (0 << LPC_SSP_CR0_CPOL) | (0 << LPC_SSP_CR0_CPHA) | (0 << LPC_SSP_CR0_SCR)); + + /* Enable the device */ + lpc_ssp->cr1 = ((0 << LPC_SSP_CR1_LBM) | + (1 << LPC_SSP_CR1_SSE) | + (LPC_SSP_CR1_MS_MASTER << LPC_SSP_CR1_MS) | + (0 << LPC_SSP_CR1_SOD)); + /* Drain the receive fifo */ for (d = 0; d < LPC_SSP_FIFOSIZE; d++) (void) lpc_ssp->dr; |