diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-05-13 12:26:19 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-05-13 12:26:19 +0200 |
commit | 9ccb4db8d59ec9dab33ee8617d462f21a8bb4fa8 (patch) | |
tree | a4f8ba9375a4ee82bae6ddc0cb3a35227f6f9469 /fw/fe310/eos/eos.c | |
parent | 45f0d9b890b086493f9bb06428c46cd802324223 (diff) |
touch controller/eve fixes
Diffstat (limited to 'fw/fe310/eos/eos.c')
-rw-r--r-- | fw/fe310/eos/eos.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/fw/fe310/eos/eos.c b/fw/fe310/eos/eos.c index b52ed93..0260073 100644 --- a/fw/fe310/eos/eos.c +++ b/fw/fe310/eos/eos.c @@ -15,17 +15,19 @@ #include "wifi.h" #include "cell.h" #include "sock.h" +#include "eve_eos.h" + +#include "eve/eve.h" +#include "i2c/gt911.h" #include "i2c/bq25895.h" -#include "eve/eve_eos.h" #include "board.h" - #include "eos.h" +extern const uint32_t _eos_touch_matrix[6]; + void eos_init(void) { uint8_t wakeup_cause = eos_pwr_wakeup_cause(); - uint32_t touch_matrix[6] = {0xfa46,0xfffffcf6,0x422fe,0xffffff38,0x10002,0xf3cb0}; - int touch_calibrate = 0; int rv; eos_evtq_init(wakeup_cause); @@ -55,16 +57,16 @@ void eos_init(void) { eos_i2c_stop(); if (rv) printf("BQ25895 INIT ERR:%d\n", rv); - rv = eos_eve_init(wakeup_cause, EVE_GPIO_DIR, touch_calibrate, touch_matrix); + rv = eos_eve_init(wakeup_cause, EVE_GPIO_DIR, _eos_touch_matrix); if (rv) printf("EVE INIT ERR:%d\n", rv); rv = eos_lcd_init(wakeup_cause); + if (rv == EOS_ERR_ABSENT) eve_lcd_absent(); if (rv) printf("LCD INIT ERR:%d\n", rv); - 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]); - } + rv = eos_gt911_init(wakeup_cause); + if (rv) printf("CTP INIT ERR:%d\n", rv); + eos_run(wakeup_cause); } @@ -81,3 +83,13 @@ void eos_run(uint8_t wakeup_cause) { rv = eos_net_run(wakeup_cause); if (rv) printf("NET RUN ERR:%d\n", rv); } + +void eos_run_once(void) { + eos_i2c_start(); + eos_gt911_cfg_print(); + eos_gt911_set_threshold(); + eos_gt911_cfg_print(); + eos_i2c_stop(); + + eos_eve_calibrate(); +} |