summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/ao_25lc1024.c2
-rw-r--r--src/drivers/ao_at45db161d.c2
-rw-r--r--src/drivers/ao_cc1120.c2
-rw-r--r--src/drivers/ao_companion.c18
-rw-r--r--src/drivers/ao_m25.c2
-rw-r--r--src/drivers/ao_ms5607.c2
6 files changed, 10 insertions, 18 deletions
diff --git a/src/drivers/ao_25lc1024.c b/src/drivers/ao_25lc1024.c
index b25d52c4..c5d811f7 100644
--- a/src/drivers/ao_25lc1024.c
+++ b/src/drivers/ao_25lc1024.c
@@ -50,7 +50,7 @@ static __xdata uint8_t ao_ee_mutex;
_asm nop _endasm; \
} while(0)
-#define ao_ee_cs_low() ao_spi_get_bit(EE_CS_PORT, EE_CS_PIN, EE_CS, AO_EE_SPI_BUS)
+#define ao_ee_cs_low() ao_spi_get_bit(EE_CS_PORT, EE_CS_PIN, EE_CS, AO_EE_SPI_BUS, AO_SPI_SPEED_FAST)
#define ao_ee_cs_high() ao_spi_put_bit(EE_CS_PORT, EE_CS_PIN, EE_CS, AO_EE_SPI_BUS)
diff --git a/src/drivers/ao_at45db161d.c b/src/drivers/ao_at45db161d.c
index 5eb25acf..e7e74153 100644
--- a/src/drivers/ao_at45db161d.c
+++ b/src/drivers/ao_at45db161d.c
@@ -43,7 +43,7 @@ __xdata uint8_t ao_flash_mutex;
_asm nop _endasm; \
} while(0)
-#define ao_flash_cs_low() ao_spi_get_bit(FLASH_CS_PORT, FLASH_CS_PIN, FLASH_CS, AO_FLASH_SPI_BUS)
+#define ao_flash_cs_low() ao_spi_get_bit(FLASH_CS_PORT, FLASH_CS_PIN, FLASH_CS, AO_FLASH_SPI_BUS, AO_SPI_SPEED_FAST)
#define ao_flash_cs_high() ao_spi_put_bit(FLASH_CS_PORT, FLASH_CS_PIN, FLASH_CS, AO_FLASH_SPI_BUS)
diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c
index cc9ebd30..c974613e 100644
--- a/src/drivers/ao_cc1120.c
+++ b/src/drivers/ao_cc1120.c
@@ -33,7 +33,7 @@ const uint32_t ao_radio_cal = 0x6ca333;
#define FOSC 32000000
-#define ao_radio_select() ao_spi_get_mask(AO_CC1120_SPI_CS_PORT,(1 << AO_CC1120_SPI_CS_PIN),AO_CC1120_SPI_BUS)
+#define ao_radio_select() ao_spi_get_mask(AO_CC1120_SPI_CS_PORT,(1 << AO_CC1120_SPI_CS_PIN),AO_CC1120_SPI_BUS,AO_SPI_SPEED_1MHz)
#define ao_radio_deselect() ao_spi_put_mask(AO_CC1120_SPI_CS_PORT,(1 << AO_CC1120_SPI_CS_PIN),AO_CC1120_SPI_BUS)
#define ao_radio_spi_send(d,l) ao_spi_send((d), (l), AO_CC1120_SPI_BUS)
#define ao_radio_spi_send_fixed(d,l) ao_spi_send_fixed((d), (l), AO_CC1120_SPI_BUS)
diff --git a/src/drivers/ao_companion.c b/src/drivers/ao_companion.c
index a31cc2ea..85d68c44 100644
--- a/src/drivers/ao_companion.c
+++ b/src/drivers/ao_companion.c
@@ -18,28 +18,20 @@
#include <ao.h>
#include <ao_companion.h>
-#ifndef ao_spi_slow
-#define ao_spi_slow(bus) (U0GCR = (UxGCR_CPOL_NEGATIVE | \
- UxGCR_CPHA_FIRST_EDGE | \
- UxGCR_ORDER_MSB | \
- (13 << UxGCR_BAUD_E_SHIFT)))
-
-#define ao_spi_fast(bus) (U0GCR = (UxGCR_CPOL_NEGATIVE | \
- UxGCR_CPHA_FIRST_EDGE | \
- UxGCR_ORDER_MSB | \
- (17 << UxGCR_BAUD_E_SHIFT)))
+#ifdef MEGAMETRUM
+#define ao_spi_slow(b)
+#define ao_spi_fast(b)
#endif
#define COMPANION_SELECT() do { \
ao_spi_get_bit(AO_COMPANION_CS_PORT, \
AO_COMPANION_CS_PIN, \
AO_COMPANION_CS, \
- AO_COMPANION_SPI_BUS); \
- ao_spi_slow(AO_COMPANION_SPI_BUS); \
+ AO_COMPANION_SPI_BUS, \
+ AO_SPI_SPEED_200kHz); \
} while (0)
#define COMPANION_DESELECT() do { \
- ao_spi_fast(AO_COMPANION_SPI_BUS); \
ao_spi_put_bit(AO_COMPANION_CS_PORT, \
AO_COMPANION_CS_PIN, \
AO_COMPANION_CS, \
diff --git a/src/drivers/ao_m25.c b/src/drivers/ao_m25.c
index 2983a405..9603c1de 100644
--- a/src/drivers/ao_m25.c
+++ b/src/drivers/ao_m25.c
@@ -110,7 +110,7 @@ static void ao_boot_radio(void) {
#define ao_boot_radio()
#endif
-#define M25_SELECT(cs) do { ao_boot_radio(); ao_spi_get_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS); } while (0)
+#define M25_SELECT(cs) do { ao_boot_radio(); ao_spi_get_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS, AO_SPI_SPEED_FAST); } while (0)
#define M25_DESELECT(cs) ao_spi_put_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS)
#define M25_BLOCK_SHIFT 16
diff --git a/src/drivers/ao_ms5607.c b/src/drivers/ao_ms5607.c
index e08f4d40..e1d0507e 100644
--- a/src/drivers/ao_ms5607.c
+++ b/src/drivers/ao_ms5607.c
@@ -24,7 +24,7 @@ static uint8_t ms5607_configured;
static void
ao_ms5607_start(void) {
- ao_spi_get(AO_MS5607_SPI_INDEX);
+ ao_spi_get(AO_MS5607_SPI_INDEX,AO_SPI_SPEED_FAST);
stm_gpio_set(AO_MS5607_CS_GPIO, AO_MS5607_CS, 0);
}