57 float percentage_check;
104 for (i = 0; i < times; i++)
108 percentage = (float)(rand() % 0xFFFFUL) / 65536.0f * 100.0f;
driver tpl0501 write test header file
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
void tpl0501_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t tpl0501_interface_spi_deinit(void)
interface spi bus deinit
void tpl0501_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t tpl0501_interface_spi_write_cmd(uint8_t *buf, uint16_t len)
interface spi bus write command
uint8_t tpl0501_interface_spi_init(void)
interface spi bus init
#define DRIVER_TPL0501_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
#define DRIVER_TPL0501_LINK_SPI_INIT(HANDLE, FUC)
link spi_init function
#define DRIVER_TPL0501_LINK_SPI_DEINIT(HANDLE, FUC)
link spi_deinit function
#define DRIVER_TPL0501_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
#define DRIVER_TPL0501_LINK_INIT(HANDLE, STRUCTURE)
initialize tpl0501_handle_t structure
#define DRIVER_TPL0501_LINK_SPI_WRITE_COMMAND(HANDLE, FUC)
link spi_write_cmd function
uint8_t tpl0501_write_test(uint32_t times)
write test
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v