From fc98d3809e0db36d634f290417b9152f87f83e3e Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 4 Sep 2022 18:37:42 +0200 Subject: new phone firmware --- fw/fe310/phone/test.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 fw/fe310/phone/test.c (limited to 'fw/fe310/phone/test.c') diff --git a/fw/fe310/phone/test.c b/fw/fe310/phone/test.c new file mode 100644 index 0000000..df3871e --- /dev/null +++ b/fw/fe310/phone/test.c @@ -0,0 +1,70 @@ +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "app/app.h" +#include "app/status.h" + +#include "test.h" + +static int reg_read(uint8_t reg, uint8_t *data) { + return eos_i2c_read8(BQ25895_ADDR, reg, data, 1); +} + +static int reg_write(uint8_t reg, uint8_t data) { + return eos_i2c_write8(BQ25895_ADDR, reg, &data, 1); +} + +int test_uievt(EVEPage *page, uint16_t evt, void *param) { + int ret = 0; + + switch (evt) { + case EVE_UIEVT_GEST_TOUCH: { + uint8_t data = 0; + int rv, i; + + printf("PAGE TOUCH\n"); + printf("BQ25895:\n"); + for (i=0; i<0x15; i++) { + rv = reg_read(i, &data); + if (!rv) printf("REG%02x: %02x\n", i, data); + } + break; + } + + default: { + ret = eve_form_uievt(page, evt, param); + break; + } + } + + return ret; +} + +int test_app(EVEWindow *window, EVEViewStack *stack) { + EVEFormSpec spec[] = { + APP_SPACERW(1,1), + }; + EVEPage *page = eve_form_create(window, stack, spec, APP_SPEC_SIZE(spec), test_uievt, test_close); + if (page == NULL) return EVE_ERR_NOMEM; + app_status_set_msg("TEST!"); + + return EVE_OK; +} + +void test_close(EVEPage *page) { + eve_form_destroy(page); +} -- cgit v1.2.3