summaryrefslogtreecommitdiff
path: root/fw
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-09-04 20:49:39 +0200
committerUros Majstorovic <majstor@majstor.org>2024-09-04 20:49:39 +0200
commiteef5b5504018cfef386dab7e088c12b619039413 (patch)
tree02c96fe377408830b377dbd0db73e82410bf0601 /fw
parentba6cbdfbecc9cb9bc5f4078b63e6889538e6ed93 (diff)
error codes fix
Diffstat (limited to 'fw')
-rw-r--r--fw/fe310/eos/dev/bq25895.c8
-rw-r--r--fw/fe310/eos/dev/ili9806e.c2
-rw-r--r--fw/fe310/eos/dev/lcd.c2
-rw-r--r--fw/fe310/eos/dev/net.c10
-rw-r--r--fw/fe310/eos/eos.h3
5 files changed, 14 insertions, 11 deletions
diff --git a/fw/fe310/eos/dev/bq25895.c b/fw/fe310/eos/dev/bq25895.c
index 11323c7..85635bb 100644
--- a/fw/fe310/eos/dev/bq25895.c
+++ b/fw/fe310/eos/dev/bq25895.c
@@ -24,14 +24,16 @@ int eos_bq25895_init(uint8_t wakeup_cause) {
if (rst) {
rv = reg_write(0x14, 0x80); // reset
if (rv) printf("I2C ERROR 0x14\n");
- rv = reg_write(0x14, 0x00); // disable watchdog
+ rv = reg_write(0x14, 0x00);
if (rv) printf("I2C ERROR 0x14\n");
rv = reg_write(0x07, 0x8d); // disable watchdog
if (rv) printf("I2C ERROR 0x07\n");
- rv = reg_write(0x00, 0x28); // 2.1A input current
+ rv = reg_write(0x00, 0x2a); // disable ILIM pin, 2.1A input current
if (rv) printf("I2C ERROR 0x00\n");
- rv = reg_write(0x02, 0x30); // enable ICO, disaable MaxCharge and D+/D-
+ rv = reg_write(0x02, 0x31); // enable ICO, disaable MaxCharge and HVDCP
if (rv) printf("I2C ERROR 0x02\n");
+ // rv = reg_write(0x03, 0x1a); // disable OTG
+ // if (rv) printf("I2C ERROR 0x02\n");
}
printf("BQ25895:\n");
diff --git a/fw/fe310/eos/dev/ili9806e.c b/fw/fe310/eos/dev/ili9806e.c
index b8bc67f..8876769 100644
--- a/fw/fe310/eos/dev/ili9806e.c
+++ b/fw/fe310/eos/dev/ili9806e.c
@@ -47,7 +47,7 @@ int eos_ili9806e_init(void) {
if (memcmp(chip_id, "\x98\x06\x04", sizeof(chip_id))) {
eos_spi_cs_clear();
- return EOS_ERR_ABSENT;
+ return EOS_ERR_NOTFOUND;
}
eos_spi9bit_write(0, 0x20); // set DE/VSYNC mode
diff --git a/fw/fe310/eos/dev/lcd.c b/fw/fe310/eos/dev/lcd.c
index 4557fb0..59215dc 100644
--- a/fw/fe310/eos/dev/lcd.c
+++ b/fw/fe310/eos/dev/lcd.c
@@ -81,7 +81,7 @@ static int lcd_init(void) {
}
rv = eos_ili9806e_init();
- if (rv == EOS_ERR_ABSENT) eve_lcd_absent();
+ if (rv == EOS_ERR_NOTFOUND) eve_lcd_absent();
lcd_deselect();
if (rv) lcd_disable();
diff --git a/fw/fe310/eos/dev/net.c b/fw/fe310/eos/dev/net.c
index 11250bc..d340e29 100644
--- a/fw/fe310/eos/dev/net.c
+++ b/fw/fe310/eos/dev/net.c
@@ -40,13 +40,13 @@ static EOSMsgQ net_send_q;
static EOSMsgItem net_sndq_array[EOS_NET_SIZE_BUFQ];
static volatile uint8_t net_state_flags = 0;
-static unsigned char net_state_type = 0;
+static volatile unsigned char net_state_type = 0;
static uint32_t net_state_len_tx = 0;
-static uint32_t net_state_len_rx = 0;
-unsigned char *net_state_buf = NULL;
+static volatile uint32_t net_state_len_rx = 0;
+static unsigned char *net_state_buf = NULL;
-static uint8_t net_state_next_cnt = 0;
-static unsigned char *net_state_next_buf = NULL;
+static volatile uint8_t net_state_next_cnt = 0;
+static unsigned char * volatile net_state_next_buf = NULL;
static eos_evt_handler_t net_handler[EOS_NET_MAX_MTYPE];
static uint16_t net_wrapper_acq[EOS_EVT_MAX_EVT];
diff --git a/fw/fe310/eos/eos.h b/fw/fe310/eos/eos.h
index fabaaab..5158acd 100644
--- a/fw/fe310/eos/eos.h
+++ b/fw/fe310/eos/eos.h
@@ -9,7 +9,8 @@
#define EOS_ERR_FULL -11
#define EOS_ERR_EMPTY -12
#define EOS_ERR_NOTFOUND -13
-#define EOS_ERR_ABSENT -14
+
+#define EOS_ERR_NOMEM -100
#define EOS_ERR_NET -20