diff options
| author | Keith Packard <keithp@keithp.com> | 2013-05-14 18:52:15 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-05-14 18:52:15 -0700 |
| commit | 0dead06bb474234ee32c0d5b73acdf85088cd5a2 (patch) | |
| tree | 9dcd68c5a27ce71f5bf1e9063ba984e5587eaf38 /src/stm/ao_arch_funcs.h | |
| parent | 642b7c50f568c5f4499f51a61d203c9471787b6b (diff) | |
altos: Try to fix MPU6000 SPI mode
Hold the SPI mutex after boot and until the I2C mode has been disabled
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/ao_arch_funcs.h')
| -rw-r--r-- | src/stm/ao_arch_funcs.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/stm/ao_arch_funcs.h b/src/stm/ao_arch_funcs.h index 1e78cabc..6fe86e62 100644 --- a/src/stm/ao_arch_funcs.h +++ b/src/stm/ao_arch_funcs.h @@ -87,13 +87,16 @@ extern uint16_t ao_spi_speed[STM_NUM_SPI]; void ao_spi_init(void); +#define ao_spi_set_cs(reg,mask) ((reg)->bsrr = ((uint32_t) (mask)) << 16) +#define ao_spi_clr_cs(reg,mask) ((reg)->bsrr = (mask)) + #define ao_spi_get_mask(reg,mask,bus, speed) do { \ ao_spi_get(bus, speed); \ - (reg)->bsrr = ((uint32_t) mask) << 16; \ + ao_spi_set_cs(reg,mask); \ } while (0) #define ao_spi_put_mask(reg,mask,bus) do { \ - (reg)->bsrr = mask; \ + ao_spi_clr_cs(reg,mask); \ ao_spi_put(bus); \ } while (0) |
