diff options
author | Uros Majstorovic <majstor@majstor.org> | 2021-12-07 20:14:23 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2021-12-07 20:14:23 +0100 |
commit | 9c8f5a5e8f11e4a5012d55b96afae290242b8fdd (patch) | |
tree | 785538c3539d0b3d710f983c55c089567f5a458a /fw/fe310/eos/eve/eve_platform.c | |
parent | 7ded8116d90081851e0ddb1b4bdd77b645f6535c (diff) |
fixed eve, spi start/stop interface
Diffstat (limited to 'fw/fe310/eos/eve/eve_platform.c')
-rw-r--r-- | fw/fe310/eos/eve/eve_platform.c | 62 |
1 files changed, 12 insertions, 50 deletions
diff --git a/fw/fe310/eos/eve/eve_platform.c b/fw/fe310/eos/eve/eve_platform.c index 2a43f1c..4450412 100644 --- a/fw/fe310/eos/eve/eve_platform.c +++ b/fw/fe310/eos/eve/eve_platform.c @@ -1,61 +1,36 @@ #include <stdlib.h> - -#include "platform.h" +#include <stdio.h> #include "eos.h" -#include "interrupt.h" -#include "event.h" - -#include "board.h" #include "eve.h" #include "eve_platform.h" - -static void handle_time(unsigned char type) { - eve_handle_time(); -} - -static void handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) { - eve_handle_touch(); - - GPIO_REG(GPIO_LOW_IP) = (1 << EVE_PIN_INTR); - GPIO_REG(GPIO_LOW_IE) |= (1 << EVE_PIN_INTR); -} - -static void handle_intr(void) { - GPIO_REG(GPIO_LOW_IE) &= ~(1 << EVE_PIN_INTR); - eos_evtq_push_isr(EOS_EVT_UI | EVE_ETYPE_INTR, NULL, 0); - return; +void *eve_malloc(size_t size) { + void *p = malloc(size); + printf("MALLOC:%p %d\n", p, size); + return p; } -void eve_time_sleep(uint32_t ms) { - eos_time_sleep(ms); +void eve_free(void *p) { + printf("FREE:%p\n", p); + free(p); } void eve_timer_set(uint32_t ms) { eos_timer_set(ms, EOS_TIMER_ETYPE_UI); } -void eve_timer_clear(void) { - eos_timer_clear(EOS_TIMER_ETYPE_UI); +void eve_time_sleep(uint32_t ms) { + eos_time_sleep(ms); } uint64_t eve_time_get_tick(void) { return eos_time_get_tick(); } -void eve_platform_init(void) { - eos_evtq_set_handler(EOS_EVT_UI, handle_evt); - eos_timer_set_handler(EOS_TIMER_ETYPE_UI, handle_time); - - GPIO_REG(GPIO_INPUT_EN) |= (1 << EVE_PIN_INTR); - GPIO_REG(GPIO_OUTPUT_EN) &= ~(1 << EVE_PIN_INTR); - GPIO_REG(GPIO_PULLUP_EN) &= ~(1 << EVE_PIN_INTR); - GPIO_REG(GPIO_OUTPUT_XOR) &= ~(1 << EVE_PIN_INTR); - - GPIO_REG(GPIO_LOW_IE) |= (1 << EVE_PIN_INTR); - eos_intr_set(INT_GPIO_BASE + EVE_PIN_INTR, IRQ_PRIORITY_UI, handle_intr); +void eve_timer_clear(void) { + eos_timer_clear(EOS_TIMER_ETYPE_UI); } void eve_spi_start(void) { @@ -65,16 +40,3 @@ void eve_spi_start(void) { void eve_spi_stop(void) { eos_spi_deselect(); } - -#include <stdio.h> - -void *eve_malloc(size_t size) { - void *p = malloc(size); - printf("MALLOC:%p %d\n", p, size); - return p; -} - -void eve_free(void *p) { - printf("FREE:%p\n", p); - free(p); -} |