37#ifndef DRIVER_TPL0501_H
38#define DRIVER_TPL0501_H
105#define DRIVER_TPL0501_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
113#define DRIVER_TPL0501_LINK_SPI_INIT(HANDLE, FUC) (HANDLE)->spi_init = FUC
121#define DRIVER_TPL0501_LINK_SPI_DEINIT(HANDLE, FUC) (HANDLE)->spi_deinit = FUC
129#define DRIVER_TPL0501_LINK_SPI_WRITE_COMMAND(HANDLE, FUC) (HANDLE)->spi_write_cmd = FUC
137#define DRIVER_TPL0501_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
145#define DRIVER_TPL0501_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
219 float percentage, uint8_t *reg,
220 float *wl_ohm,
float *hw_ohm);
236 uint8_t reg,
float *percentage,
237 float *wl_ohm,
float *hw_ohm);
uint8_t tpl0501_percentage_convert_to_data(tpl0501_handle_t *handle, uint8_t reg, float *percentage, float *wl_ohm, float *hw_ohm)
convert the register raw data to percentage
uint8_t tpl0501_info(tpl0501_info_t *info)
get chip's information
uint8_t tpl0501_deinit(tpl0501_handle_t *handle)
close the chip
uint8_t tpl0501_percentage_convert_to_register(tpl0501_handle_t *handle, float percentage, uint8_t *reg, float *wl_ohm, float *hw_ohm)
convert the percentage to the register raw data
uint8_t tpl0501_init(tpl0501_handle_t *handle)
initialize the chip
struct tpl0501_info_s tpl0501_info_t
tpl0501 information structure definition
uint8_t tpl0501_write(tpl0501_handle_t *handle, uint8_t raw)
write data
struct tpl0501_handle_s tpl0501_handle_t
tpl0501 handle structure definition
uint8_t tpl0501_set_reg(tpl0501_handle_t *handle, uint8_t raw)
set the chip register
tpl0501 handle structure definition
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* spi_deinit)(void)
uint8_t(* spi_write_cmd)(uint8_t *buf, uint16_t len)
tpl0501 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v