diff options
author | Uros Majstorovic <majstor@majstor.org> | 2025-02-16 20:11:47 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2025-02-16 20:11:47 +0100 |
commit | 064631db87182694459056ceeb331506b553d0f0 (patch) | |
tree | d1113214d11a6f407548c4f16008adb1e7c73475 /fw/fe310/eos/dev/drv/tps61052.c | |
parent | aeb896b55c384d7f9a6e9a29f74cf560c6392c5b (diff) |
drivers made independent from microcontroller/os
Diffstat (limited to 'fw/fe310/eos/dev/drv/tps61052.c')
-rw-r--r-- | fw/fe310/eos/dev/drv/tps61052.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/fw/fe310/eos/dev/drv/tps61052.c b/fw/fe310/eos/dev/drv/tps61052.c index 2908a45..405c8af 100644 --- a/fw/fe310/eos/dev/drv/tps61052.c +++ b/fw/fe310/eos/dev/drv/tps61052.c @@ -1,9 +1,7 @@ #include <stdlib.h> #include <stdint.h> -#include "eos.h" -#include "soc/i2c.h" - +#include "platform.h" #include "tps61052.h" #define TPS61052_ADDR 0x33 @@ -11,14 +9,14 @@ static int reg_read(uint8_t reg, uint8_t *data) { int rv; - rv = eos_i2c_read8(TPS61052_ADDR, reg, data, 1); + rv = drv_i2c_read8(TPS61052_ADDR, reg, data, 1); return rv; } static int reg_write(uint8_t reg, uint8_t data) { int rv; - rv = eos_i2c_write8(TPS61052_ADDR, reg, &data, 1); + rv = drv_i2c_write8(TPS61052_ADDR, reg, &data, 1); return rv; } @@ -30,7 +28,7 @@ int tps61052_get_tc(uint8_t *tc) { if (rv) return rv; *tc &= 0x07; - return EOS_OK; + return DRV_OK; } int tps61052_set_tc(uint8_t tc) { @@ -55,7 +53,7 @@ int tps61052_get_dim(uint8_t *dim) { *dim = *dim >> 3; *dim &= 0x01; - return EOS_OK; + return DRV_OK; } int tps61052_set_dim(uint8_t dim) { @@ -81,7 +79,7 @@ int tps61052_get_ov(uint8_t *ov) { *ov = *ov >> 4; *ov &= 0x03; - return EOS_OK; + return DRV_OK; } int tps61052_set_ov(uint8_t ov) { @@ -107,7 +105,7 @@ int tps61052_get_mode0(uint8_t *mode) { *mode = *mode >> 6; *mode &= 0x03; - return EOS_OK; + return DRV_OK; } int tps61052_set_mode0(uint8_t mode) { @@ -133,7 +131,7 @@ int tps61052_get_fc(uint8_t *fc) { if (rv) return rv; *fc &= 0x07; - return EOS_OK; + return DRV_OK; } int tps61052_set_fc(uint8_t fc) { @@ -158,7 +156,7 @@ int tps61052_get_sft(uint8_t *sft) { *sft = *sft >> 3; *sft &= 0x01; - return EOS_OK; + return DRV_OK; } int tps61052_set_sft(uint8_t sft) { @@ -184,7 +182,7 @@ int tps61052_get_stt(uint8_t *stt) { *stt = *stt >> 4; *stt &= 0x01; - return EOS_OK; + return DRV_OK; } int tps61052_set_stt(uint8_t stt) { @@ -210,7 +208,7 @@ int tps61052_get_to(uint8_t *to) { *to = *to >> 5; *to &= 0x01; - return EOS_OK; + return DRV_OK; } int tps61052_get_mode1(uint8_t *mode) { @@ -221,7 +219,7 @@ int tps61052_get_mode1(uint8_t *mode) { *mode = *mode >> 6; *mode &= 0x03; - return EOS_OK; + return DRV_OK; } int tps61052_set_mode1(uint8_t mode) { @@ -248,7 +246,7 @@ int tps61052_get_adc(uint8_t *adc) { *adc = *adc >> 3; *adc &= 0x07; - return EOS_OK; + return DRV_OK; } int tps61052_get_lf(uint8_t *lf) { @@ -259,7 +257,7 @@ int tps61052_get_lf(uint8_t *lf) { *lf = *lf >> 6; *lf &= 0x01; - return EOS_OK; + return DRV_OK; } int tps61052_get_ot(uint8_t *ot) { @@ -270,7 +268,7 @@ int tps61052_get_ot(uint8_t *ot) { *ot = *ot >> 7; *ot &= 0x01; - return EOS_OK; + return DRV_OK; } int tps61052_set_ilim(uint8_t ilim) { @@ -296,7 +294,7 @@ int tps61052_get_stim(uint8_t *stim) { if (rv) return rv; *stim &= 0x1F; - return EOS_OK; + return DRV_OK; } int tps61052_set_stim(uint8_t stim) { @@ -321,7 +319,7 @@ int tps61052_get_dctim(uint8_t *dctim) { *dctim = *dctim >> 5; *dctim &= 0x07; - return EOS_OK; + return DRV_OK; } int tps61052_set_dctim(uint8_t dctim) { |