From 6a31936e80ae2743376dcbf9d39cd92461c4deca Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Thu, 25 Nov 2021 01:59:07 +0100 Subject: i2s init/start/running fixed; i2c start returns error if i2s is running --- fw/fe310/test/cam.c | 4 ++-- fw/fe310/test/test.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'fw/fe310/test') diff --git a/fw/fe310/test/cam.c b/fw/fe310/test/cam.c index caab2cc..3162b40 100644 --- a/fw/fe310/test/cam.c +++ b/fw/fe310/test/cam.c @@ -139,9 +139,9 @@ void app_cam(EVEWindow *window, EVEViewStack *stack) { eve_gpio_set(EVE_GPIO_CAM, 1); eos_time_sleep(100); - eos_i2c_start(100000); - rv = eos_ov2640_init(); + rv = eos_i2c_start(100000); + if (!rv) rv = eos_ov2640_init(); if (!rv) rv = eos_ov2640_set_pixfmt(PIXFORMAT_JPEG); if (!rv) rv = eos_ov2640_set_framesize(FRAMESIZE_VGA); eos_i2c_stop(); diff --git a/fw/fe310/test/test.c b/fw/fe310/test/test.c index 9e5c790..cda0255 100644 --- a/fw/fe310/test/test.c +++ b/fw/fe310/test/test.c @@ -26,16 +26,20 @@ int app_test_uievt(EVEForm *form, uint16_t evt, void *param) { uint8_t data = 0; - int ret = 0, i; + int rv, ret = 0, i; switch (evt) { case EVE_UIEVT_PAGE_TOUCH: printf("PAGE TOUCH\n"); printf("BQ25895:\n"); - eos_i2c_start(400000); + rv = eos_i2c_start(400000); + if (rv) { + printf("I2C BUSY\n"); + return 0; + } for (i=0; i<0x15; i++) { - ret = eos_i2c_read8(BQ25895_ADDR, i, &data); - if (!ret) printf("REG%02x: %02x\n", i, data); + rv = eos_i2c_read8(BQ25895_ADDR, i, &data); + if (!rv) printf("REG%02x: %02x\n", i, data); } eos_i2c_stop(); break; -- cgit v1.2.3