#ifndef DRV_BF8915A_H_ #define DRV_BF8915A_H_ #include #include "drv_spi.h" #define BF8915A_WRCFGA_ADDR (0x0001) #define BF8915A_WRCFGB_ADDR (0x0002) #define BF8915A_WRCFGC_ADDR (0x0003) #define BF8915A_WRCFGD_ADDR (0x0004) #define BF8915A_RDCFGA_ADDR (0x0005) #define BF8915A_RDCFGB_ADDR (0x0006) #define BF8915A_RDCFGC_ADDR (0x0007) #define BF8915A_RDCFGD_ADDR (0x0008) #define BF8915A_RDCVA_ADDR (0x0009) #define BF8915A_RDCVB_ADDR (0x000A) #define BF8915A_RDCVC_ADDR (0x000B) #define BF8915A_RDCVD_ADDR (0x000C) #define BF8915A_RDCVE_ADDR (0x000D) #define BF8915A_RDCVF_ADDR (0x000E) #define BF8915A_RDGPIOA_ADDR (0x000F) #define BF8915A_RDGPIOB_ADDR (0x0010) #define BF8915A_RDGPIOC_ADDR (0x0011) #define BF8915A_RDSTATA_ADDR (0x0012) #define BF8915A_RDSTATB_ADDR (0x0013) #define BF8915A_RDSTATC_ADDR (0x0014) #define BF8915A_RDSTATD_ADDR (0x0015) #define BF8915A_SOFTRST_ADDR (0x0055) typedef struct { uint16_t addr; uint8_t value[6]; }Bf8915InitArr; typedef struct { SpiDev spi; uint8_t cs; uint8_t pwr; uint8_t arr_len; const Bf8915InitArr *arr; }Bf8915Item; #define LTC6811_STATIC_INIT(_name, _spi, _cs, _pwr) \ Bf8915Item _name = \ { \ (_spi), \ (_cs), \ (_pwr), \ } kit_ret_e drv_bf8915_init(Bf8915Item *item); bool drv_bf8915_read_volt(Bf8915Item *item, uint8_t *buf); kit_ret_e drv_bf8915_write_register(Bf8915Item *item, uint16_t reg, uint8_t *buf); kit_ret_e drv_bf8915_read_register(Bf8915Item *item, uint16_t reg, uint8_t *buf); #endif