diff options
Diffstat (limited to 'code/fe310/eos')
-rw-r--r-- | code/fe310/eos/eos.h | 1 | ||||
-rw-r--r-- | code/fe310/eos/eve/eve.h | 1 | ||||
-rw-r--r-- | code/fe310/eos/eve/eve_platform.c | 2 | ||||
-rw-r--r-- | code/fe310/eos/spi_dev.c | 15 | ||||
-rw-r--r-- | code/fe310/eos/spi_dev.h | 2 |
5 files changed, 17 insertions, 4 deletions
diff --git a/code/fe310/eos/eos.h b/code/fe310/eos/eos.h index b48b7c0..08bd10b 100644 --- a/code/fe310/eos/eos.h +++ b/code/fe310/eos/eos.h @@ -3,6 +3,5 @@ #define EOS_ERR_FULL -10 #define EOS_ERR_EMPTY -11 #define EOS_ERR_NET -20 -#define EOS_ERR_TEXT -30 void eos_init(void); diff --git a/code/fe310/eos/eve/eve.h b/code/fe310/eos/eve/eve.h index f377567..b72fdf5 100644 --- a/code/fe310/eos/eve/eve.h +++ b/code/fe310/eos/eve/eve.h @@ -5,6 +5,7 @@ #define EVE_ETYPE_INTR 1 #define EVE_OK 0 #define EVE_ERR -1 +#define EVE_ERR_TEXT -100 /* events */ #define EVE_TOUCH_ETYPE_TRACK 0x0001 diff --git a/code/fe310/eos/eve/eve_platform.c b/code/fe310/eos/eve/eve_platform.c index e15d414..bc0a7b9 100644 --- a/code/fe310/eos/eve/eve_platform.c +++ b/code/fe310/eos/eve/eve_platform.c @@ -66,4 +66,6 @@ void eve_init_platform(void) { GPIO_REG(GPIO_LOW_IE) |= (1 << EVE_PIN_INTR); eos_intr_set(INT_GPIO_BASE + EVE_PIN_INTR, IRQ_PRIORITY_UI, handle_intr); + + eos_spi_dev_set_div(EOS_DEV_DISP, 4); }
\ No newline at end of file diff --git a/code/fe310/eos/spi_dev.c b/code/fe310/eos/spi_dev.c index dd956f3..aed26bc 100644 --- a/code/fe310/eos/spi_dev.c +++ b/code/fe310/eos/spi_dev.c @@ -20,17 +20,19 @@ #define SPI_CSPIN_CAM 23 +static uint16_t spi_dev_div[EOS_DEV_MAX_DEV]; + void eos_spi_dev_start(unsigned char dev) { eos_net_stop(); switch (dev) { case EOS_DEV_DISP: - eos_spi_start(dev, SPI_DIV_DISP, SPI_CSID_DISP, 0); + eos_spi_start(dev, spi_dev_div[dev-1], SPI_CSID_DISP, 0); break; case EOS_DEV_CARD: - eos_spi_start(dev, SPI_DIV_CARD, SPI_CSID_CARD, 0); + eos_spi_start(dev, spi_dev_div[dev-1], SPI_CSID_CARD, 0); break; case EOS_DEV_CAM: - eos_spi_start(dev, SPI_DIV_CAM, SPI_CSID_NONE, SPI_CSPIN_CAM); + eos_spi_start(dev, spi_dev_div[dev-1], SPI_CSID_NONE, SPI_CSPIN_CAM); break; } } @@ -41,6 +43,10 @@ void eos_spi_dev_stop(void) { } void eos_spi_dev_init(void) { + spi_dev_div[EOS_DEV_DISP - 1] = SPI_DIV_DISP; + spi_dev_div[EOS_DEV_CARD - 1] = SPI_DIV_CARD; + spi_dev_div[EOS_DEV_CAM - 1] = SPI_DIV_CAM; + GPIO_REG(GPIO_INPUT_EN) &= ~(1 << SPI_CSPIN_CAM); GPIO_REG(GPIO_OUTPUT_EN) |= (1 << SPI_CSPIN_CAM); GPIO_REG(GPIO_PULLUP_EN) &= ~(1 << SPI_CSPIN_CAM); @@ -48,3 +54,6 @@ void eos_spi_dev_init(void) { GPIO_REG(GPIO_OUTPUT_VAL) |= (1 << SPI_CSPIN_CAM); } +void eos_spi_dev_set_div(unsigned char dev, uint16_t div) { + spi_dev_div[dev-1] = div; +} diff --git a/code/fe310/eos/spi_dev.h b/code/fe310/eos/spi_dev.h index 256c48c..21dcee9 100644 --- a/code/fe310/eos/spi_dev.h +++ b/code/fe310/eos/spi_dev.h @@ -7,3 +7,5 @@ void eos_spi_dev_init(void); void eos_spi_dev_start(unsigned char dev); void eos_spi_dev_stop(void); + +void eos_spi_dev_set_div(unsigned char dev, uint16_t div); |