diff options
author | Uros Majstorovic <majstor@majstor.org> | 2021-11-28 23:53:05 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2021-11-28 23:53:05 +0100 |
commit | acce7d8e05ac38776d6340342f6a7868df4f7f28 (patch) | |
tree | c0e2f3934b82967e4c2aff4a3dfcc5802bc94232 /fw/fe310/eos/i2c | |
parent | 0b0972ce96a59fb9b59c0b166e0174ba4d8dd198 (diff) |
lcd driver added; fixed startup code;
Diffstat (limited to 'fw/fe310/eos/i2c')
-rw-r--r-- | fw/fe310/eos/i2c/bq25895.c | 11 | ||||
-rw-r--r-- | fw/fe310/eos/i2c/bq25895.h | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/fw/fe310/eos/i2c/bq25895.c b/fw/fe310/eos/i2c/bq25895.c index db4a6ab..b619fe3 100644 --- a/fw/fe310/eos/i2c/bq25895.c +++ b/fw/fe310/eos/i2c/bq25895.c @@ -7,16 +7,13 @@ #include "i2c.h" #include "i2c/bq25895.h" -void eos_bq25895_init(uint8_t wakeup_cause) { - int rst = (wakeup_cause == EOS_PWR_WAKE_RST); +int eos_bq25895_init(uint8_t wakeup_cause) { + int rst = (wakeup_cause == EOS_INIT_RST); int i, rv = EOS_OK; uint8_t data = 0; rv = eos_i2c_start(100000); - if (rv) { - printf("I2C BUSY\n"); - return; - } + if (rv) return rv; if (rst) { rv = eos_i2c_write8(BQ25895_ADDR, 0x14, 0x80); // reset if (rv) printf("I2C ERROR 0x14\n"); @@ -36,4 +33,6 @@ void eos_bq25895_init(uint8_t wakeup_cause) { if (!rv) printf("REG%02x: %02x\n", i, data); } eos_i2c_stop(); + + return EOS_OK; } diff --git a/fw/fe310/eos/i2c/bq25895.h b/fw/fe310/eos/i2c/bq25895.h index 39c6b68..cbef36e 100644 --- a/fw/fe310/eos/i2c/bq25895.h +++ b/fw/fe310/eos/i2c/bq25895.h @@ -2,4 +2,4 @@ #define BQ25895_ADDR 0x6A -void eos_bq25895_init(uint8_t wakeup_cause); +int eos_bq25895_init(uint8_t wakeup_cause); |