diff options
author | Bdale Garbee <bdale@gag.com> | 2016-05-06 17:59:39 -0600 |
---|---|---|
committer | Bdale Garbee <bdale@gag.com> | 2016-05-06 17:59:39 -0600 |
commit | ac7be4a40df88ee3a0992e041635e4ac4cf5ac48 (patch) | |
tree | ee3c747b2ee98b772e02dce604b58878e9336def /src/lpc/ao_arch_funcs.h | |
parent | b53c78e75879d647935a30acb88fdd69467617a7 (diff) | |
parent | ce4c8a8ad57515e851207b0a82f3af791bb30d3e (diff) |
Merge branch 'master' into branch-1.6
Diffstat (limited to 'src/lpc/ao_arch_funcs.h')
-rw-r--r-- | src/lpc/ao_arch_funcs.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lpc/ao_arch_funcs.h b/src/lpc/ao_arch_funcs.h index fbe641d8..dbb41538 100644 --- a/src/lpc/ao_arch_funcs.h +++ b/src/lpc/ao_arch_funcs.h @@ -227,6 +227,28 @@ ao_spi_duplex(const void *out, void *in, uint16_t len, uint8_t spi_index); void ao_spi_init(void); +static inline void +ao_spi_send_sync(const void *block, uint16_t len, uint8_t spi_index) +{ + ao_spi_send(block, len, spi_index); +} + +static inline void ao_spi_send_byte(uint8_t byte, uint8_t spi_index) +{ + struct lpc_ssp *lpc_ssp; + switch (spi_index) { + case 0: + lpc_ssp = &lpc_ssp0; + break; + case 1: + lpc_ssp = &lpc_ssp1; + break; + } + lpc_ssp->dr = byte; + while ((lpc_ssp->sr & (1 << LPC_SSP_SR_RNE)) == 0); + (void) lpc_ssp->dr; +} + #define ao_spi_init_cs(port, mask) do { \ uint8_t __bit__; \ for (__bit__ = 0; __bit__ < 32; __bit__++) { \ |