summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/eve
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-04-08 02:27:15 +0200
committerUros Majstorovic <majstor@majstor.org>2021-04-08 02:27:15 +0200
commit66e53b7e54878e2161f5c0dab6f90aebd9a1d97a (patch)
tree9ad45a813794be241123596531c993f471c01eb8 /fw/fe310/eos/eve
parent4566511371a8a80201c1adb0535cde722cbd9b48 (diff)
added board.h
Diffstat (limited to 'fw/fe310/eos/eve')
-rw-r--r--fw/fe310/eos/eve/clipb.c8
-rw-r--r--fw/fe310/eos/eve/eve.c138
-rw-r--r--fw/fe310/eos/eve/eve_platform.c8
-rw-r--r--fw/fe310/eos/eve/eve_touch.c144
-rw-r--r--fw/fe310/eos/eve/eve_vtrack.c20
-rw-r--r--fw/fe310/eos/eve/screen/window.c8
-rw-r--r--fw/fe310/eos/eve/widget/selectw.c20
-rw-r--r--fw/fe310/eos/eve/widget/strw.c14
-rw-r--r--fw/fe310/eos/eve/widget/textw.c20
9 files changed, 190 insertions, 190 deletions
diff --git a/fw/fe310/eos/eve/clipb.c b/fw/fe310/eos/eve/clipb.c
index 04c9a46..974b631 100644
--- a/fw/fe310/eos/eve/clipb.c
+++ b/fw/fe310/eos/eve/clipb.c
@@ -3,17 +3,17 @@
#include "eve.h"
#include "clipb.h"
-static uint8_t _clipb[EVE_CLIPB_SIZE_BUF];
+static uint8_t clipb[EVE_CLIPB_SIZE_BUF];
int eve_clipb_push(uint8_t *str, uint16_t len) {
if (len >= EVE_CLIPB_SIZE_BUF) return EVE_ERR;
- memcpy(_clipb, str, len);
- _clipb[len] = '\0';
+ memcpy(clipb, str, len);
+ clipb[len] = '\0';
return EVE_OK;
}
uint8_t *eve_clipb_get(void) {
- return _clipb;
+ return clipb;
} \ No newline at end of file
diff --git a/fw/fe310/eos/eve/eve.c b/fw/fe310/eos/eve/eve.c
index 6809d72..3b56e11 100644
--- a/fw/fe310/eos/eve/eve.c
+++ b/fw/fe310/eos/eve/eve.c
@@ -6,15 +6,15 @@
#define EVE_MEM_WRITE 0x800000
-static char _cmd_burst;
-static uint16_t _cmd_offset;
+static char cmd_burst;
+static uint16_t cmd_offset;
-static char _dl_burst;
-static uint32_t _dl_addr;
+static char dl_burst;
+static uint32_t dl_addr;
-static uint32_t *_touch_calib;
-static uint8_t _brigtness;
-static uint8_t _power_state;
+static uint32_t *touch_calib;
+static uint8_t brigtness;
+static uint8_t power_state;
void eve_command(uint8_t command, uint8_t parameter) {
eve_spi_cs_set();
@@ -95,13 +95,13 @@ void eve_writeb(uint32_t addr, uint8_t *b, size_t size) {
eve_spi_cs_clear();
}
-static void _dl_inc(uint32_t i) {
- _dl_addr += i;
+static void dl_inc(uint32_t i) {
+ dl_addr += i;
}
void eve_dl_start(uint32_t addr, char burst) {
- _dl_addr = addr;
- _dl_burst = burst;
+ dl_addr = addr;
+ dl_burst = burst;
if (burst) {
eve_spi_lock();
eve_spi_cs_set();
@@ -110,20 +110,20 @@ void eve_dl_start(uint32_t addr, char burst) {
}
void eve_dl_write(uint32_t dl) {
- if (_dl_burst) {
+ if (dl_burst) {
eve_spi_xchg32(dl, EVE_SPI_FLAG_TX | EVE_SPI_FLAG_BSWAP);
} else {
- eve_write32(_dl_addr, dl);
+ eve_write32(dl_addr, dl);
}
- _dl_inc(4);
+ dl_inc(4);
}
void eve_dl_end(void) {
- if (_dl_burst) {
+ if (dl_burst) {
eve_spi_flush();
eve_spi_cs_clear();
eve_spi_unlock();
- _dl_burst = 0;
+ dl_burst = 0;
}
}
@@ -132,33 +132,33 @@ void eve_dl_swap(void) {
}
uint32_t eve_dl_get_addr(void) {
- return _dl_addr;
+ return dl_addr;
}
-static void _cmd_inc(uint16_t i) {
- _cmd_offset += i;
- _cmd_offset &= 0x0fff;
+static void cmd_inc(uint16_t i) {
+ cmd_offset += i;
+ cmd_offset &= 0x0fff;
}
-static void _cmd_begin(uint32_t command) {
+static void cmd_begin(uint32_t command) {
uint8_t flags = 0;
- if (_cmd_burst) {
+ if (cmd_burst) {
flags = EVE_SPI_FLAG_TX;
} else {
- uint32_t addr = EVE_RAM_CMD + _cmd_offset;
+ uint32_t addr = EVE_RAM_CMD + cmd_offset;
eve_spi_cs_set();
eve_spi_xchg24(addr | EVE_MEM_WRITE, 0);
}
eve_spi_xchg32(command, EVE_SPI_FLAG_BSWAP | flags);
- _cmd_inc(4);
+ cmd_inc(4);
}
-static void _cmd_end(void) {
- if (!_cmd_burst) eve_spi_cs_clear();
+static void cmd_end(void) {
+ if (!cmd_burst) eve_spi_cs_clear();
}
-static void _cmd_string(const char *s, uint8_t flags) {
+static void cmd_string(const char *s, uint8_t flags) {
int i = 0;
while (s[i] != 0) {
@@ -167,68 +167,68 @@ static void _cmd_string(const char *s, uint8_t flags) {
}
eve_spi_xchg8(0, flags);
i++;
- _cmd_inc(i);
+ cmd_inc(i);
}
-static void _cmd_buffer(const char *b, int size, uint8_t flags) {
+static void cmd_buffer(const char *b, int size, uint8_t flags) {
int i = 0;
for (i=0; i<size; i++) {
eve_spi_xchg8(b[i], flags);
}
- _cmd_inc(size);
+ cmd_inc(size);
}
void eve_cmd(uint32_t cmd, const char *fmt, ...) {
- uint8_t flags = _cmd_burst ? (EVE_SPI_FLAG_TX | EVE_SPI_FLAG_BSWAP) : EVE_SPI_FLAG_BSWAP;
+ uint8_t flags = cmd_burst ? (EVE_SPI_FLAG_TX | EVE_SPI_FLAG_BSWAP) : EVE_SPI_FLAG_BSWAP;
va_list argv;
uint16_t *p;
int i = 0;
va_start(argv, fmt);
- _cmd_begin(cmd);
+ cmd_begin(cmd);
while (fmt[i]) {
switch (fmt[i]) {
case 'b':
eve_spi_xchg8(va_arg(argv, int), flags);
- _cmd_inc(1);
+ cmd_inc(1);
break;
case 'h':
eve_spi_xchg16(va_arg(argv, int), flags);
- _cmd_inc(2);
+ cmd_inc(2);
break;
case 'w':
eve_spi_xchg32(va_arg(argv, int), flags);
- _cmd_inc(4);
+ cmd_inc(4);
break;
case '&':
p = va_arg(argv, uint16_t *);
- *p = _cmd_offset;
+ *p = cmd_offset;
eve_spi_xchg32(0, flags);
- _cmd_inc(4);
+ cmd_inc(4);
break;
case 's':
- _cmd_string(va_arg(argv, const char *), flags);
+ cmd_string(va_arg(argv, const char *), flags);
break;
case 'p':
- _cmd_buffer(va_arg(argv, const char *), va_arg(argv, int), flags);
+ cmd_buffer(va_arg(argv, const char *), va_arg(argv, int), flags);
break;
}
i++;
}
va_end(argv);
/* padding */
- i = _cmd_offset & 3; /* equivalent to _cmd_offset % 4 */
+ i = cmd_offset & 3; /* equivalent to cmd_offset % 4 */
if (i) {
i = 4 - i; /* 3, 2 or 1 */
- _cmd_inc(i);
+ cmd_inc(i);
while (i > 0) {
eve_spi_xchg8(0, flags);
i--;
}
}
- _cmd_end();
+ cmd_end();
}
uint32_t eve_cmd_result(uint16_t offset) {
@@ -236,14 +236,14 @@ uint32_t eve_cmd_result(uint16_t offset) {
}
void eve_cmd_dl(uint32_t dl) {
- _cmd_begin(dl);
- _cmd_end();
+ cmd_begin(dl);
+ cmd_end();
}
int eve_cmd_done(void) {
uint16_t r = eve_read16(REG_CMD_READ);
if (r == 0xfff) {
- _cmd_offset = 0;
+ cmd_offset = 0;
eve_write8(REG_CPURESET, 1);
eve_write16(REG_CMD_READ, 0);
eve_write16(REG_CMD_WRITE, 0);
@@ -251,11 +251,11 @@ int eve_cmd_done(void) {
eve_write8(REG_CPURESET, 0);
return -1;
}
- return (r == _cmd_offset);
+ return (r == cmd_offset);
}
int eve_cmd_exec(int w) {
- eve_write16(REG_CMD_WRITE, _cmd_offset);
+ eve_write16(REG_CMD_WRITE, cmd_offset);
if (w) {
int r;
do {
@@ -267,46 +267,46 @@ int eve_cmd_exec(int w) {
}
void eve_cmd_burst_start(void) {
- uint32_t addr = EVE_RAM_CMD + _cmd_offset;
+ uint32_t addr = EVE_RAM_CMD + cmd_offset;
eve_spi_lock();
eve_spi_cs_set();
eve_spi_xchg24(addr | EVE_MEM_WRITE, EVE_SPI_FLAG_TX);
- _cmd_burst = 1;
+ cmd_burst = 1;
}
void eve_cmd_burst_end(void) {
eve_spi_flush();
eve_spi_cs_clear();
eve_spi_unlock();
- _cmd_burst = 0;
+ cmd_burst = 0;
}
void eve_active(void) {
eve_command(EVE_ACTIVE, 0);
- if (_power_state == EVE_PSTATE_SLEEP) eve_time_sleep(40);
+ if (power_state == EVE_PSTATE_SLEEP) eve_time_sleep(40);
- eve_write8(REG_PWM_DUTY, _brigtness);
- if (_power_state != EVE_PSTATE_SLEEP) return;
+ eve_write8(REG_PWM_DUTY, brigtness);
+ if (power_state != EVE_PSTATE_SLEEP) return;
eve_write8(REG_TOUCH_MODE, EVE_TMODE_CONTINUOUS);
eve_write8(REG_CTOUCH_EXTENDED, 0x00);
- _power_state = EVE_PSTATE_ACTIVE;
+ power_state = EVE_PSTATE_ACTIVE;
}
void eve_standby(void) {
- if (_power_state != EVE_PSTATE_ACTIVE) return;
+ if (power_state != EVE_PSTATE_ACTIVE) return;
- _brigtness = eve_read8(REG_PWM_DUTY);
+ brigtness = eve_read8(REG_PWM_DUTY);
eve_command(EVE_STANDBY, 0);
- _power_state = EVE_PSTATE_STANDBY;
+ power_state = EVE_PSTATE_STANDBY;
}
void eve_sleep(void) {
- if (_power_state != EVE_PSTATE_ACTIVE) return;
+ if (power_state != EVE_PSTATE_ACTIVE) return;
- _brigtness = eve_read8(REG_PWM_DUTY);
+ brigtness = eve_read8(REG_PWM_DUTY);
eve_write8(REG_PWM_DUTY, 0x0);
eve_write8(REG_CTOUCH_EXTENDED, 0x01);
@@ -315,7 +315,7 @@ void eve_sleep(void) {
eve_time_sleep(500);
eve_command(EVE_SLEEP, 0);
- _power_state = EVE_PSTATE_SLEEP;
+ power_state = EVE_PSTATE_SLEEP;
}
void eve_brightness(uint8_t b) {
@@ -323,7 +323,7 @@ void eve_brightness(uint8_t b) {
}
void eve_set_touch_calibration(uint32_t *matrix) {
- _touch_calib = matrix;
+ touch_calib = matrix;
}
static int _init(void) {
@@ -382,13 +382,13 @@ static int _init(void) {
eve_write8(REG_TOUCH_MODE, EVE_TMODE_CONTINUOUS); /* enable touch */
eve_write16(REG_TOUCH_RZTHRESH, EVE_TOUCH_RZTHRESH); /* eliminate any false touches */
- if (_touch_calib) {
- eve_write32(REG_TOUCH_TRANSFORM_A, _touch_calib[0]);
- eve_write32(REG_TOUCH_TRANSFORM_B, _touch_calib[1]);
- eve_write32(REG_TOUCH_TRANSFORM_C, _touch_calib[2]);
- eve_write32(REG_TOUCH_TRANSFORM_D, _touch_calib[3]);
- eve_write32(REG_TOUCH_TRANSFORM_E, _touch_calib[4]);
- eve_write32(REG_TOUCH_TRANSFORM_F, _touch_calib[5]);
+ if (touch_calib) {
+ eve_write32(REG_TOUCH_TRANSFORM_A, touch_calib[0]);
+ eve_write32(REG_TOUCH_TRANSFORM_B, touch_calib[1]);
+ eve_write32(REG_TOUCH_TRANSFORM_C, touch_calib[2]);
+ eve_write32(REG_TOUCH_TRANSFORM_D, touch_calib[3]);
+ eve_write32(REG_TOUCH_TRANSFORM_E, touch_calib[4]);
+ eve_write32(REG_TOUCH_TRANSFORM_F, touch_calib[5]);
} else {
uint32_t touch_calib[6];
eve_cmd_dl(CMD_DLSTART);
@@ -427,7 +427,7 @@ int eve_init(int pwr_on) {
int rv = _init();
if (rv) return rv;
} else {
- _power_state = EVE_PSTATE_SLEEP;
+ power_state = EVE_PSTATE_SLEEP;
eve_active();
}
diff --git a/fw/fe310/eos/eve/eve_platform.c b/fw/fe310/eos/eve/eve_platform.c
index cfaf6d5..6bc87bb 100644
--- a/fw/fe310/eos/eve/eve_platform.c
+++ b/fw/fe310/eos/eve/eve_platform.c
@@ -5,10 +5,10 @@
#include "eos.h"
#include "interrupt.h"
#include "event.h"
+
#include "eve.h"
#include "eve_platform.h"
-#include "irq_def.h"
static void handle_time(unsigned char type) {
eve_handle_time();
@@ -55,15 +55,15 @@ void eve_platform_init(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);
+ eos_spi_set_div(EOS_SPI_DEV_EVE, 4);
}
void eve_spi_start(void) {
- eos_spi_dev_select(EOS_DEV_DISP);
+ eos_spi_select(EOS_SPI_DEV_EVE);
}
void eve_spi_stop(void) {
- eos_spi_dev_deselect();
+ eos_spi_deselect();
}
#include <stdio.h>
diff --git a/fw/fe310/eos/eve/eve_touch.c b/fw/fe310/eos/eve/eve_touch.c
index f777093..e75cf4e 100644
--- a/fw/fe310/eos/eve/eve_touch.c
+++ b/fw/fe310/eos/eve/eve_touch.c
@@ -4,16 +4,16 @@
#include "eve.h"
-static int _intr_mask = EVE_INT_TAG | EVE_INT_TOUCH;
-static int _multitouch;
-static uint8_t _tag0;
+static int touch_intr_mask = EVE_INT_TAG | EVE_INT_TOUCH;
+static int touch_multi;
+static uint8_t touch_tag0;
-static EVETouch _touch[EVE_MAX_TOUCH];
-static EVETouchTimer _touch_timer;
+static EVETouch touch_obj[EVE_MAX_TOUCH];
+static EVETouchTimer touch_timer;
-static eve_touch_handler_t _touch_handler;
-static void *_touch_handler_param;
-static uint8_t _tag_opt[256];
+static eve_touch_handler_t touch_handler;
+static void *touch_handler_param;
+static uint8_t touch_tag_opt[256];
static const uint32_t _reg_touch[] = {
REG_CTOUCH_TOUCH0_XY,
@@ -46,14 +46,14 @@ void eve_handle_touch(void) {
eve_spi_start();
- flags = eve_read8(REG_INT_FLAGS) & _intr_mask;
- if (!_multitouch && (flags & EVE_INT_TOUCH)) _multitouch = 1;
+ flags = eve_read8(REG_INT_FLAGS) & touch_intr_mask;
+ if (!touch_multi && (flags & EVE_INT_TOUCH)) touch_multi = 1;
for (i=0; i<EVE_MAX_TOUCH; i++) {
uint8_t touch_tag;
uint32_t touch_xy;
uint64_t now = 0;
uint16_t touch_evt = 0;
- EVETouch *touch = &_touch[i];
+ EVETouch *touch = &touch_obj[i];
touch_xy = i < 4 ? eve_read32(_reg_touch[i]) : (((uint32_t)eve_read16(REG_CTOUCH_TOUCH4_X) << 16) | eve_read16(REG_CTOUCH_TOUCH4_Y));
@@ -95,8 +95,8 @@ void eve_handle_touch(void) {
}
eve_touch_timer_clear(touch);
- if (_touch_handler && touch_evt) {
- _touch_handler(_touch_timer.touch, touch_evt, _touch_timer.tag0, _touch_handler_param);
+ if (touch_handler && touch_evt) {
+ touch_handler(touch_timer.touch, touch_evt, touch_timer.tag0, touch_handler_param);
}
}
touch_evt = EVE_TOUCH_ETYPE_POINT | _evt;
@@ -122,7 +122,7 @@ void eve_handle_touch(void) {
}
touch->x = touch_x;
touch->y = touch_y;
- if (_multitouch || (flags & EVE_INT_TAG)) {
+ if (touch_multi || (flags & EVE_INT_TAG)) {
touch_tag = eve_read8(_reg_tag[i]);
} else {
touch_tag = touch->tag;
@@ -139,13 +139,13 @@ void eve_handle_touch(void) {
eve_touch_timer_set_evt(touch, _ttevt & ~EVE_TOUCH_ETYPE_LPRESS);
}
if (touch->tracker.tag && touch->tracker.track) {
- uint8_t opt = _tag_opt[touch->tracker.tag];
+ uint8_t opt = touch_tag_opt[touch->tracker.tag];
char track_ext = ((opt & EVE_TOUCH_OPT_TRACK_EXT_X) && (touch->eevt & EVE_TOUCH_EETYPE_TRACK_X)) ||
((opt & EVE_TOUCH_OPT_TRACK_EXT_Y) && (touch->eevt & EVE_TOUCH_EETYPE_TRACK_Y));
if (!eve_touch_timer_get_evt(NULL) && track_ext) {
EVEVTrack *vtrack = eve_vtrack_get();
- eve_touch_timer_set(touch, EVE_TOUCH_ETYPE_TRACK, _tag0, EVE_TOUCH_TIMEOUT_TRACK);
+ eve_touch_timer_set(touch, EVE_TOUCH_ETYPE_TRACK, touch_tag0, EVE_TOUCH_TIMEOUT_TRACK);
if (vtrack->start) vtrack->start(touch, vtrack->param);
} else {
touch_evt |= EVE_TOUCH_ETYPE_TRACK_STOP;
@@ -155,23 +155,23 @@ void eve_handle_touch(void) {
}
if (touch_tag != touch->tag) {
if (touch_tag) {
- if (!_tag0) _tag0 = touch_tag;
+ if (!touch_tag0) touch_tag0 = touch_tag;
if (!touch->tag0) {
touch->tag0 = touch_tag;
- if (_tag_opt[touch_tag] & (EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_REG)) {
+ if (touch_tag_opt[touch_tag] & (EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_REG)) {
touch->tracker.tag = touch_tag;
}
- if (touch->tracker.tag && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_XY)) {
+ if (touch->tracker.tag && !(touch_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_XY)) {
touch_evt |= EVE_TOUCH_ETYPE_TRACK_START;
touch->tracker.track = 1;
touch->t = now;
}
- if (!eve_touch_timer_get_evt(NULL) && (_tag_opt[touch_tag] & (EVE_TOUCH_OPT_LPRESS | EVE_TOUCH_OPT_TAP2))) {
+ if (!eve_touch_timer_get_evt(NULL) && (touch_tag_opt[touch_tag] & (EVE_TOUCH_OPT_LPRESS | EVE_TOUCH_OPT_TAP2))) {
uint16_t _evt = 0;
- if (_tag_opt[touch_tag] & EVE_TOUCH_OPT_LPRESS) _evt |= EVE_TOUCH_ETYPE_LPRESS;
- if (_tag_opt[touch_tag] & EVE_TOUCH_OPT_TAP2) _evt |= EVE_TOUCH_ETYPE_TAP2;
- eve_touch_timer_set(touch, _evt, _tag0, EVE_TOUCH_TIMEOUT_TAP);
+ if (touch_tag_opt[touch_tag] & EVE_TOUCH_OPT_LPRESS) _evt |= EVE_TOUCH_ETYPE_LPRESS;
+ if (touch_tag_opt[touch_tag] & EVE_TOUCH_OPT_TAP2) _evt |= EVE_TOUCH_ETYPE_TAP2;
+ eve_touch_timer_set(touch, _evt, touch_tag0, EVE_TOUCH_TIMEOUT_TAP);
}
}
}
@@ -190,10 +190,10 @@ void eve_handle_touch(void) {
dx = dx < 0 ? -dx : dx;
dy = dy < 0 ? -dy : dy;
if (_track) {
- if ((dx > EVE_TOUCH_THRESHOLD_X) && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_X)) {
+ if ((dx > EVE_TOUCH_THRESHOLD_X) && !(touch_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_X)) {
touch->tracker.tag = 0;
}
- if ((dy > EVE_TOUCH_THRESHOLD_Y) && !(_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_Y)) {
+ if ((dy > EVE_TOUCH_THRESHOLD_Y) && !(touch_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_Y)) {
touch->tracker.tag = 0;
}
if (touch->tracker.tag && ((dx > EVE_TOUCH_THRESHOLD_X) || (dy > EVE_TOUCH_THRESHOLD_Y))) {
@@ -214,8 +214,8 @@ void eve_handle_touch(void) {
}
}
if (touch->tracker.tag && touch->tracker.track) {
- if (_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK) touch_evt |= EVE_TOUCH_ETYPE_TRACK;
- if (_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_REG) touch_evt |= EVE_TOUCH_ETYPE_TRACK_REG;
+ if (touch_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK) touch_evt |= EVE_TOUCH_ETYPE_TRACK;
+ if (touch_tag_opt[touch->tracker.tag] & EVE_TOUCH_OPT_TRACK_REG) touch_evt |= EVE_TOUCH_ETYPE_TRACK_REG;
}
if (touch_evt & EVE_TOUCH_ETYPE_TRACK_REG) {
uint32_t touch_track = eve_read32(_reg_track[i]);
@@ -227,48 +227,48 @@ void eve_handle_touch(void) {
}
if (touch->tracker.tag || _timer) int_ccomplete = 1;
}
- if (_touch_handler && touch_evt) {
- _touch_handler(touch, touch_evt, _tag0, _touch_handler_param);
+ if (touch_handler && touch_evt) {
+ touch_handler(touch, touch_evt, touch_tag0, touch_handler_param);
}
- if (!_multitouch) break;
+ if (!touch_multi) break;
}
if (!touch_ex) {
- _tag0 = 0;
- _multitouch = 0;
+ touch_tag0 = 0;
+ touch_multi = 0;
}
- if (_multitouch) int_ccomplete = 1;
+ if (touch_multi) int_ccomplete = 1;
- if (int_ccomplete && !(_intr_mask & EVE_INT_CONVCOMPLETE)) {
- _intr_mask |= EVE_INT_CONVCOMPLETE;
- eve_write8(REG_INT_MASK, _intr_mask);
+ if (int_ccomplete && !(touch_intr_mask & EVE_INT_CONVCOMPLETE)) {
+ touch_intr_mask |= EVE_INT_CONVCOMPLETE;
+ eve_write8(REG_INT_MASK, touch_intr_mask);
}
- if (!int_ccomplete && (_intr_mask & EVE_INT_CONVCOMPLETE)) {
- _intr_mask &= ~EVE_INT_CONVCOMPLETE;
- eve_write8(REG_INT_MASK, _intr_mask);
+ if (!int_ccomplete && (touch_intr_mask & EVE_INT_CONVCOMPLETE)) {
+ touch_intr_mask &= ~EVE_INT_CONVCOMPLETE;
+ eve_write8(REG_INT_MASK, touch_intr_mask);
}
eve_spi_stop();
}
void eve_handle_time(void) {
- EVETouch *touch = _touch_timer.touch;
+ EVETouch *touch = touch_timer.touch;
- if (_touch_timer.evt) {
+ if (touch_timer.evt) {
int more = 0;
uint16_t touch_evt = 0;
eve_spi_start();
- if (_touch_timer.evt & EVE_TOUCH_ETYPE_LPRESS) {
+ if (touch_timer.evt & EVE_TOUCH_ETYPE_LPRESS) {
touch_evt |= EVE_TOUCH_ETYPE_LPRESS;
if (touch) touch->eevt |= EVE_TOUCH_EETYPE_LPRESS;
}
- if (_touch_timer.evt & EVE_TOUCH_ETYPE_TAP2) {
+ if (touch_timer.evt & EVE_TOUCH_ETYPE_TAP2) {
touch_evt |= EVE_TOUCH_ETYPE_TAP1;
}
- if (_touch_timer.evt & EVE_TOUCH_ETYPE_TRACK) {
+ if (touch_timer.evt & EVE_TOUCH_ETYPE_TRACK) {
EVEVTrack *vtrack = eve_vtrack_get();
if (vtrack->tick) {
@@ -280,19 +280,19 @@ void eve_handle_time(void) {
if (vtrack->stop) vtrack->stop(touch, vtrack->param);
}
}
- if (_touch_timer.evt & EVE_TOUCH_ETYPE_TIMER) {
+ if (touch_timer.evt & EVE_TOUCH_ETYPE_TIMER) {
touch_evt |= EVE_TOUCH_ETYPE_TIMER;
more = 1;
}
if (more) {
- eve_timer_set(_touch_timer.to);
+ eve_timer_set(touch_timer.to);
} else {
- _touch_timer.evt = 0;
+ touch_timer.evt = 0;
}
- if (_touch_handler && touch_evt) {
- _touch_handler(touch, touch_evt, _touch_timer.tag0, _touch_handler_param);
+ if (touch_handler && touch_evt) {
+ touch_handler(touch, touch_evt, touch_timer.tag0, touch_handler_param);
}
eve_spi_stop();
@@ -305,27 +305,27 @@ void eve_touch_init(void) {
eve_vtrack_init();
for (i=0; i<EVE_MAX_TOUCH; i++) {
- EVETouch *touch = &_touch[i];
+ EVETouch *touch = &touch_obj[i];
touch->eevt |= EVE_TOUCH_EETYPE_NOTOUCH;
}
- eve_write8(REG_INT_MASK, _intr_mask);
+ eve_write8(REG_INT_MASK, touch_intr_mask);
eve_write8(REG_INT_EN, 0x01);
while(eve_read8(REG_INT_FLAGS));
}
void eve_touch_set_handler(eve_touch_handler_t handler, void *param) {
- _touch_handler = handler;
- _touch_handler_param = param;
+ touch_handler = handler;
+ touch_handler_param = param;
}
EVETouch *eve_touch_get(int i) {
- return &_touch[i];
+ return &touch_obj[i];
}
int8_t eve_touch_get_idx(EVETouch *touch) {
if (touch == NULL) return -1;
- return touch - _touch;
+ return touch - touch_obj;
}
uint16_t eve_touch_evt(EVETouch *touch, uint16_t evt, uint8_t tag0, uint8_t tag_min, uint8_t tag_n) {
@@ -363,22 +363,22 @@ uint16_t eve_touch_evt(EVETouch *touch, uint16_t evt, uint8_t tag0, uint8_t tag_
}
void eve_touch_set_opt(uint8_t tag, uint8_t opt) {
- _tag_opt[tag] = opt;
+ touch_tag_opt[tag] = opt;
}
uint8_t eve_touch_get_opt(uint8_t tag) {
- return _tag_opt[tag];
+ return touch_tag_opt[tag];
}
void eve_touch_clear_opt(void) {
- memset(_tag_opt, 0, sizeof(_tag_opt));
+ memset(touch_tag_opt, 0, sizeof(touch_tag_opt));
}
void eve_touch_timer_set(EVETouch *touch, uint16_t evt, uint8_t tag0, uint32_t to) {
- _touch_timer.touch = touch;
- _touch_timer.evt = evt;
- _touch_timer.tag0 = tag0;
- _touch_timer.to = to;
+ touch_timer.touch = touch;
+ touch_timer.evt = evt;
+ touch_timer.tag0 = tag0;
+ touch_timer.to = to;
eve_timer_set(to);
}
@@ -389,21 +389,21 @@ void eve_touch_timer_clear(EVETouch *touch) {
uint16_t eve_touch_timer_get_evt(EVETouch *touch) {
uint16_t ret = 0;
- if ((touch == NULL) || (_touch_timer.touch == touch)) {
- ret = _touch_timer.evt;
- } else if (_touch_timer.touch == NULL) {
- ret = _touch_timer.evt & EVE_TOUCH_ETYPE_TIMER;
+ if ((touch == NULL) || (touch_timer.touch == touch)) {
+ ret = touch_timer.evt;
+ } else if (touch_timer.touch == NULL) {
+ ret = touch_timer.evt & EVE_TOUCH_ETYPE_TIMER;
}
return ret;
}
void eve_touch_timer_set_evt(EVETouch *touch, uint16_t evt) {
- if (touch == _touch_timer.touch) {
- _touch_timer.evt = evt;
- } else if (_touch_timer.touch == NULL) {
- _touch_timer.evt = evt & EVE_TOUCH_ETYPE_TIMER;
+ if (touch == touch_timer.touch) {
+ touch_timer.evt = evt;
+ } else if (touch_timer.touch == NULL) {
+ touch_timer.evt = evt & EVE_TOUCH_ETYPE_TIMER;
}
- if (!_touch_timer.evt) eve_timer_clear();
+ if (!touch_timer.evt) eve_timer_clear();
}
void eve_touch_timer_start(uint8_t tag0, uint32_t to) {
@@ -415,5 +415,5 @@ void eve_touch_timer_stop(void) {
}
EVETouchTimer *eve_touch_timer_get(void) {
- return &_touch_timer;
+ return &touch_timer;
}
diff --git a/fw/fe310/eos/eve/eve_vtrack.c b/fw/fe310/eos/eve/eve_vtrack.c
index dfa8ba8..b9f28af 100644
--- a/fw/fe310/eos/eve/eve_vtrack.c
+++ b/fw/fe310/eos/eve/eve_vtrack.c
@@ -3,32 +3,32 @@
#include "eve.h"
-static EVEVTrack _vtrack;
-static EVEPhyAcc _vtrack_acc;
+static EVEVTrack vtrack;
+static EVEPhyAcc vtrack_acc;
void eve_vtrack_init(void) {
- eve_phy_acc_init(&_vtrack_acc, -EVE_VTRACK_ACC_A);
+ eve_phy_acc_init(&vtrack_acc, -EVE_VTRACK_ACC_A);
eve_vtrack_reset();
}
EVEVTrack *eve_vtrack_get(void) {
- return &_vtrack;
+ return &vtrack;
}
void eve_vtrack_set(eve_vtrack_start_t start, eve_vtrack_tick_t tick, eve_vtrack_stop_t stop, void *param) {
- _vtrack.start = start;
- _vtrack.tick = tick;
- _vtrack.stop = stop;
- _vtrack.param = param;
+ vtrack.start = start;
+ vtrack.tick = tick;
+ vtrack.stop = stop;
+ vtrack.param = param;
}
void eve_vtrack_reset(void) {
- eve_vtrack_set(eve_vtrack_acc_start, eve_vtrack_acc_tick, NULL, &_vtrack_acc);
+ eve_vtrack_set(eve_vtrack_acc_start, eve_vtrack_acc_tick, NULL, &vtrack_acc);
}
void eve_vtrack_start(EVETouch *touch, uint8_t tag0, uint32_t to) {
eve_touch_timer_set(touch, EVE_TOUCH_ETYPE_TRACK, tag0, to);
- if (_vtrack.start) _vtrack.start(touch, _vtrack.param);
+ if (vtrack.start) vtrack.start(touch, vtrack.param);
}
void eve_vtrack_stop(EVETouch *touch) {
diff --git a/fw/fe310/eos/eve/screen/window.c b/fw/fe310/eos/eve/screen/window.c
index 4f059c4..63a59a9 100644
--- a/fw/fe310/eos/eve/screen/window.c
+++ b/fw/fe310/eos/eve/screen/window.c
@@ -68,7 +68,7 @@ int eve_window_visible(EVEWindow *window) {
return 1;
}
-static void _window_visible_g(EVEWindow *w, EVERect *g) {
+static void window_visible_g(EVEWindow *w, EVERect *g) {
while (w) {
if (eve_window_visible(w)) {
if (w->g.x > g->x) g->w = MIN(g->w, w->g.x - g->x);
@@ -84,15 +84,15 @@ static void _window_visible_g(EVEWindow *w, EVERect *g) {
g->h -= y0;
}
}
- if (w->child_head) _window_visible_g(w->child_head, g);
+ if (w->child_head) window_visible_g(w->child_head, g);
w = w->next;
}
}
void eve_window_visible_g(EVEWindow *window, EVERect *g) {
*g = window->g;
- if (window->child_head) _window_visible_g(window->child_head, g);
- _window_visible_g(window->next, g);
+ if (window->child_head) window_visible_g(window->child_head, g);
+ window_visible_g(window->next, g);
}
void eve_window_append(EVEWindow *window) {
diff --git a/fw/fe310/eos/eve/widget/selectw.c b/fw/fe310/eos/eve/widget/selectw.c
index 7873e95..46ed3d1 100644
--- a/fw/fe310/eos/eve/widget/selectw.c
+++ b/fw/fe310/eos/eve/widget/selectw.c
@@ -16,7 +16,7 @@
#define DIVC(x,y) ((x) / (y) + ((x) % (y) != 0))
-static int _selectw_verify(utf8_t *option, uint16_t option_size) {
+static int selectw_verify(utf8_t *option, uint16_t option_size) {
int o_len;
uint16_t o_curr;
int rv;
@@ -32,7 +32,7 @@ static int _selectw_verify(utf8_t *option, uint16_t option_size) {
return EVE_OK;
}
-static int _selectw_count(EVESelectWidget *widget) {
+static int selectw_count(EVESelectWidget *widget) {
int o_len;
int o_curr;
int i;
@@ -51,7 +51,7 @@ static int _selectw_count(EVESelectWidget *widget) {
return i;
}
-static void _selectw_update_sz(EVESelectWidget *widget, int uievt) {
+static void selectw_update_sz(EVESelectWidget *widget, int uievt) {
EVEWidget *_widget = &widget->w;
EVEPage *page = _widget->page;
@@ -81,12 +81,12 @@ void eve_selectw_init(EVESelectWidget *widget, EVERect *g, EVEPage *page, EVEFon
memset(widget, 0, sizeof(EVESelectWidget));
eve_widget_init(_widget, EVE_WIDGET_TYPE_SELECT, g, page, eve_selectw_draw, eve_selectw_touch, NULL);
widget->font = font;
- rv = _selectw_verify(option, option_size);
+ rv = selectw_verify(option, option_size);
if (rv == EVE_OK) {
widget->option = option;
widget->option_size = option_size;
- widget->option_count = _selectw_count(widget);
- _selectw_update_sz(widget, 0);
+ widget->option_count = selectw_count(widget);
+ selectw_update_sz(widget, 0);
}
widget->multi = multi;
widget->select = widget->multi ? 0 : SELECTW_NOSELECT;
@@ -226,7 +226,7 @@ int eve_selectw_option_add(EVESelectWidget *widget, utf8_t *option) {
strcpy(widget->option + o_curr, option);
widget->option_count = i + 1;
- _selectw_update_sz(widget, 1);
+ selectw_update_sz(widget, 1);
return EVE_OK;
}
@@ -234,15 +234,15 @@ int eve_selectw_option_add(EVESelectWidget *widget, utf8_t *option) {
int eve_selectw_option_set(EVESelectWidget *widget, utf8_t *option, uint16_t option_size) {
int rv, i;
- rv = _selectw_verify(option, option_size);
+ rv = selectw_verify(option, option_size);
if (rv) return rv;
if (option_size > widget->option_size) return EVE_ERR_FULL;
memcpy(widget->option, option, option_size);
memset(widget->option + option_size, 0, widget->option_size - option_size);
- widget->option_count = _selectw_count(widget);
- _selectw_update_sz(widget, 1);
+ widget->option_count = selectw_count(widget);
+ selectw_update_sz(widget, 1);
return EVE_OK;
}
diff --git a/fw/fe310/eos/eve/widget/strw.c b/fw/fe310/eos/eve/widget/strw.c
index b169adb..232e52c 100644
--- a/fw/fe310/eos/eve/widget/strw.c
+++ b/fw/fe310/eos/eve/widget/strw.c
@@ -90,7 +90,7 @@ static EVEStrCursor *cursor_prox(EVEStrWidget *widget, EVEStrCursor *cursor, EVE
return NULL;
}
-static void _draw_str(EVEStrWidget *widget, uint16_t ch, uint16_t len, uint16_t x1, uint16_t x2, char s) {
+static void draw_string(EVEStrWidget *widget, uint16_t ch, uint16_t len, uint16_t x1, uint16_t x2, char s) {
int16_t x;
EVEWidget *_widget = &widget->w;
EVEPage *page = _widget->page;
@@ -116,7 +116,7 @@ static void _draw_str(EVEStrWidget *widget, uint16_t ch, uint16_t len, uint16_t
}
}
-static void _draw_cursor(EVEStrWidget *widget, EVEStrCursor *cursor) {
+static void draw_cursor(EVEStrWidget *widget, EVEStrCursor *cursor) {
uint16_t x, y;
EVEWidget *_widget = &widget->w;
@@ -187,12 +187,12 @@ uint8_t eve_strw_draw(EVEWidget *_widget, uint8_t tag0) {
l1 = c1->ch;
l2 = c2->ch - c1->ch;
l3 = widget->str_len - c2->ch;
- _draw_str(widget, 0, l1, 0, c1->x, 0);
- _draw_str(widget, c1->ch, l2, c1->x, c2->x, 1);
- _draw_str(widget, c2->ch, l3, c2->x, widget->str_g.x + _widget->g.w, 0);
+ draw_string(widget, 0, l1, 0, c1->x, 0);
+ draw_string(widget, c1->ch, l2, c1->x, c2->x, 1);
+ draw_string(widget, c2->ch, l3, c2->x, widget->str_g.x + _widget->g.w, 0);
} else {
- if (widget->cursor1.on) _draw_cursor(widget, &widget->cursor1);
- _draw_str(widget, 0, widget->str_len, 0, widget->str_g.x + _widget->g.w, 0);
+ if (widget->cursor1.on) draw_cursor(widget, &widget->cursor1);
+ draw_string(widget, 0, widget->str_len, 0, widget->str_g.x + _widget->g.w, 0);
}
if (cut) {
diff --git a/fw/fe310/eos/eve/widget/textw.c b/fw/fe310/eos/eve/widget/textw.c
index abf2a68..e994c0e 100644
--- a/fw/fe310/eos/eve/widget/textw.c
+++ b/fw/fe310/eos/eve/widget/textw.c
@@ -107,7 +107,7 @@ static EVETextCursor *cursor_prox(EVETextWidget *widget, EVETextCursor *cursor,
return NULL;
}
-static void _draw_line(EVETextWidget *widget, uint16_t l, uint16_t ch, uint16_t len, uint16_t x1, uint16_t x2, char s) {
+static void draw_line(EVETextWidget *widget, uint16_t l, uint16_t ch, uint16_t len, uint16_t x1, uint16_t x2, char s) {
EVEWidget *_widget = &widget->w;
EVEPage *page = _widget->page;
@@ -131,7 +131,7 @@ static void _draw_line(EVETextWidget *widget, uint16_t l, uint16_t ch, uint16_t
}
}
-static void _draw_cursor(EVETextWidget *widget, EVETextCursor *cursor) {
+static void draw_cursor(EVETextWidget *widget, EVETextCursor *cursor) {
uint16_t x, y;
EVEWidget *_widget = &widget->w;
@@ -198,10 +198,10 @@ uint8_t eve_textw_draw(EVEWidget *_widget, uint8_t tag0) {
l3 = 0;
s = 1;
}
- _draw_line(widget, i, LINE_START(widget, i), l1, 0, c1->x, 0);
- _draw_line(widget, i, c1->ch, l2, c1->x, s ? _widget->g.w : c2->x, 1);
+ draw_line(widget, i, LINE_START(widget, i), l1, 0, c1->x, 0);
+ draw_line(widget, i, c1->ch, l2, c1->x, s ? _widget->g.w : c2->x, 1);
if (!s) {
- _draw_line(widget, i, c2->ch, l3, c2->x, _widget->g.w, 0);
+ draw_line(widget, i, c2->ch, l3, c2->x, _widget->g.w, 0);
c1 = NULL;
c2 = NULL;
}
@@ -209,14 +209,14 @@ uint8_t eve_textw_draw(EVEWidget *_widget, uint8_t tag0) {
int l1 = c2->ch - LINE_START(widget, i);
int l2 = LINE_START(widget, i) + LINE_LEN(widget, i) - c2->ch;
- _draw_line(widget, i, LINE_START(widget, i), l1, 0, c2->x, 1);
- _draw_line(widget, i, c2->ch, l2, c2->x, _widget->g.w, 0);
+ draw_line(widget, i, LINE_START(widget, i), l1, 0, c2->x, 1);
+ draw_line(widget, i, c2->ch, l2, c2->x, _widget->g.w, 0);
c1 = NULL;
c2 = NULL;
s = 0;
} else {
- if (widget->cursor1.on && (widget->cursor1.line == i)) _draw_cursor(widget, &widget->cursor1);
- _draw_line(widget, i, LINE_START(widget, i), LINE_LEN(widget, i), 0, _widget->g.w, s);
+ if (widget->cursor1.on && (widget->cursor1.line == i)) draw_cursor(widget, &widget->cursor1);
+ draw_line(widget, i, LINE_START(widget, i), LINE_LEN(widget, i), 0, _widget->g.w, s);
}
}
if (lineNvisible) {
@@ -225,7 +225,7 @@ uint8_t eve_textw_draw(EVEWidget *_widget, uint8_t tag0) {
eve_touch_set_opt(_widget->tagN, TEXTW_TOUCH_OPT);
_widget->tagN++;
}
- _draw_line(widget, lineN, 0, 0, 0, _widget->g.w, 0);
+ draw_line(widget, lineN, 0, 0, 0, _widget->g.w, 0);
}
} else {
widget->line0 = 0;