summaryrefslogtreecommitdiff
path: root/fw
diff options
context:
space:
mode:
Diffstat (limited to 'fw')
-rw-r--r--fw/fe310/eos/eos.c12
-rw-r--r--fw/fe310/eos/eve/eve.c47
-rw-r--r--fw/fe310/eos/eve/eve.h3
-rw-r--r--fw/fe310/eos/eve/screen/window.c3
4 files changed, 30 insertions, 35 deletions
diff --git a/fw/fe310/eos/eos.c b/fw/fe310/eos/eos.c
index 0909958..a96f391 100644
--- a/fw/fe310/eos/eos.c
+++ b/fw/fe310/eos/eos.c
@@ -20,10 +20,11 @@
#include "eos.h"
-static uint32_t eve_touch[6] = {0xfa46,0xfffffcf6,0x422fe,0xffffff38,0x10002,0xf3cb0};
-
void eos_init(void) {
uint8_t wakeup_cause = eos_power_wakeup_cause();
+ uint32_t touch_matrix[6] = {0xfa46,0xfffffcf6,0x422fe,0xffffff38,0x10002,0xf3cb0};
+ int touch_calibrate = 0;
+
printf("WAKE:%d\n", wakeup_cause);
eos_evtq_init();
@@ -43,6 +44,9 @@ void eos_init(void) {
eos_net_wake(wakeup_cause);
- eve_set_touch_calibration(eve_touch);
- eve_init(wakeup_cause == EOS_PWR_WAKE_RST, EVE_GPIO_DIR);
+ eve_init(wakeup_cause == EOS_PWR_WAKE_RST, touch_calibrate, touch_matrix, EVE_GPIO_DIR);
+ if (touch_calibrate) {
+ printf("TOUCH MATRIX:\n");
+ printf("uint32_t touch_matrix[6] = {0x%x,0x%x,0x%x,0x%x,0x%x,0x%x}\n", touch_matrix[0], touch_matrix[1], touch_matrix[2], touch_matrix[3], touch_matrix[4], touch_matrix[5]);
+ }
}
diff --git a/fw/fe310/eos/eve/eve.c b/fw/fe310/eos/eve/eve.c
index 0423bb9..d625fec 100644
--- a/fw/fe310/eos/eve/eve.c
+++ b/fw/fe310/eos/eve/eve.c
@@ -1,6 +1,5 @@
#include <stdlib.h>
#include <stdarg.h>
-#include <stdio.h>
#include "eve.h"
@@ -13,7 +12,6 @@ static uint16_t cmd_offset;
static char dl_burst;
static uint32_t dl_addr;
-static uint32_t *touch_calib;
static uint8_t brigtness;
static uint8_t power_state;
@@ -364,11 +362,7 @@ void eve_brightness(uint8_t b) {
eve_write8(REG_PWM_DUTY, b);
}
-void eve_set_touch_calibration(uint32_t *matrix) {
- touch_calib = matrix;
-}
-
-static int _init(uint8_t gpio_dir) {
+static int _init(int touch_calibrate, uint32_t *touch_matrix, uint8_t gpio_dir) {
uint8_t chipid = 0;
uint16_t timeout = 0;
@@ -425,15 +419,8 @@ static int _init(uint8_t gpio_dir) {
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]);
- } else {
- uint32_t touch_calib[6];
+ if (touch_calibrate) {
+ eve_write8(REG_PWM_DUTY, 0x40);
eve_cmd_dl(CMD_DLSTART);
eve_cmd_dl(CLEAR_COLOR_RGB(0,0,0));
eve_cmd_dl(CLEAR(1,1,1));
@@ -442,15 +429,21 @@ static int _init(uint8_t gpio_dir) {
eve_cmd_dl(DISPLAY());
eve_cmd_dl(CMD_SWAP);
eve_cmd_exec(1);
-
- touch_calib[0] = eve_read32(REG_TOUCH_TRANSFORM_A);
- touch_calib[1] = eve_read32(REG_TOUCH_TRANSFORM_B);
- touch_calib[2] = eve_read32(REG_TOUCH_TRANSFORM_C);
- touch_calib[3] = eve_read32(REG_TOUCH_TRANSFORM_D);
- touch_calib[4] = eve_read32(REG_TOUCH_TRANSFORM_E);
- touch_calib[5] = eve_read32(REG_TOUCH_TRANSFORM_F);
-
- printf("TOUCH TRANSFORM:{0x%x,0x%x,0x%x,0x%x,0x%x,0x%x}\n", touch_calib[0], touch_calib[1], touch_calib[2], touch_calib[3], touch_calib[4], touch_calib[5]);
+ eve_write8(REG_PWM_DUTY, 0);
+
+ touch_matrix[0] = eve_read32(REG_TOUCH_TRANSFORM_A);
+ touch_matrix[1] = eve_read32(REG_TOUCH_TRANSFORM_B);
+ touch_matrix[2] = eve_read32(REG_TOUCH_TRANSFORM_C);
+ touch_matrix[3] = eve_read32(REG_TOUCH_TRANSFORM_D);
+ touch_matrix[4] = eve_read32(REG_TOUCH_TRANSFORM_E);
+ touch_matrix[5] = eve_read32(REG_TOUCH_TRANSFORM_F);
+ } else {
+ eve_write32(REG_TOUCH_TRANSFORM_A, touch_matrix[0]);
+ eve_write32(REG_TOUCH_TRANSFORM_B, touch_matrix[1]);
+ eve_write32(REG_TOUCH_TRANSFORM_C, touch_matrix[2]);
+ eve_write32(REG_TOUCH_TRANSFORM_D, touch_matrix[3]);
+ eve_write32(REG_TOUCH_TRANSFORM_E, touch_matrix[4]);
+ eve_write32(REG_TOUCH_TRANSFORM_F, touch_matrix[5]);
}
eve_write8(REG_CTOUCH_EXTENDED, 0x00);
@@ -461,13 +454,13 @@ static int _init(uint8_t gpio_dir) {
return EVE_OK;
}
-int eve_init(int pwr_on, uint8_t gpio_dir) {
+int eve_init(int pwr_on, int touch_calibrate, uint32_t *touch_matrix, uint8_t gpio_dir) {
eve_spi_start();
pwr_on = 1; // override this for now
if (pwr_on) {
- int rv = _init(gpio_dir);
+ int rv = _init(touch_calibrate, touch_matrix, gpio_dir);
if (rv) return rv;
} else {
power_state = EVE_PSTATE_SLEEP;
diff --git a/fw/fe310/eos/eve/eve.h b/fw/fe310/eos/eve/eve.h
index 39e96cb..2f26edf 100644
--- a/fw/fe310/eos/eve/eve.h
+++ b/fw/fe310/eos/eve/eve.h
@@ -66,6 +66,5 @@ void eve_standby(void);
void eve_sleep(void);
void eve_wake(void);
void eve_brightness(uint8_t b);
-void eve_set_touch_calibration(uint32_t *matrix);
-int eve_init(int pwr_on, uint8_t gpio_dir);
+int eve_init(int pwr_on, int touch_calibrate, uint32_t *touch_matrix, uint8_t gpio_dir);
diff --git a/fw/fe310/eos/eve/screen/window.c b/fw/fe310/eos/eve/screen/window.c
index d4b15f0..c259b19 100644
--- a/fw/fe310/eos/eve/screen/window.c
+++ b/fw/fe310/eos/eve/screen/window.c
@@ -1,5 +1,6 @@
#include <stdlib.h>
#include <string.h>
+#include <stdio.h>
#include "eve.h"
#include "eve_kbd.h"
@@ -214,8 +215,6 @@ int eve_window_touch(EVEWindow *window, EVETouch *touch, uint16_t evt, uint8_t t
return 0;
}
-#include <stdio.h>
-
void eve_window_root_draw(EVEWindowRoot *root) {
uint8_t tag0 = 0x80;
int rv;