56 float ref_voltage_check;
481 ref_voltage = (float)(rand() % 200) / 100.0f;
503 ref_voltage = (float)(rand() % 200) / 100.0f;
driver pcf8591 register test header file
uint8_t pcf8591_dac_convert_to_register(pcf8591_handle_t *handle, float dac, uint8_t *reg)
convert a dac value to a register raw data
struct pcf8591_info_s pcf8591_info_t
pcf8591 information structure definition
uint8_t pcf8591_info(pcf8591_info_t *info)
get chip's information
uint8_t pcf8591_set_addr_pin(pcf8591_handle_t *handle, pcf8591_address_t addr_pin)
set the address pin
uint8_t pcf8591_get_channel(pcf8591_handle_t *handle, pcf8591_channel_t *channel)
get the adc channel
uint8_t pcf8591_init(pcf8591_handle_t *handle)
initialize the chip
pcf8591_mode_t
pcf8591 mode definition
uint8_t pcf8591_get_auto_increment(pcf8591_handle_t *handle, pcf8591_bool_t *enable)
get the adc auto increment read mode
pcf8591_bool_t
pcf8591 bool enumeration definition
uint8_t pcf8591_set_mode(pcf8591_handle_t *handle, pcf8591_mode_t mode)
set the adc mode
uint8_t pcf8591_set_reference_voltage(pcf8591_handle_t *handle, float ref_voltage)
set the adc reference voltage
uint8_t pcf8591_set_channel(pcf8591_handle_t *handle, pcf8591_channel_t channel)
set the adc channel
uint8_t pcf8591_get_addr_pin(pcf8591_handle_t *handle, pcf8591_address_t *addr_pin)
get the address pin
pcf8591_address_t
pcf8591 address enumeration definition
uint8_t pcf8591_get_mode(pcf8591_handle_t *handle, pcf8591_mode_t *mode)
get the adc mode
uint8_t pcf8591_get_reference_voltage(pcf8591_handle_t *handle, float *ref_voltage)
get the adc reference voltage
uint8_t pcf8591_deinit(pcf8591_handle_t *handle)
close the chip
struct pcf8591_handle_s pcf8591_handle_t
pcf8591 handle structure definition
pcf8591_channel_t
pcf8591 channel definition
uint8_t pcf8591_set_auto_increment(pcf8591_handle_t *handle, pcf8591_bool_t enable)
set the adc auto increment read mode
@ PCF8591_MODE_AIN0_AIN1_AND_ANI2_AIN3
@ PCF8591_MODE_AIN012_AIN3
@ PCF8591_MODE_AIN0123_GND
@ PCF8591_MODE_AIN0_GND_AND_AIN1_GND_AND_AIN2_AIN3
uint8_t pcf8591_interface_iic_init(void)
interface iic bus init
void pcf8591_interface_delay_ms(uint32_t ms)
interface delay ms
void pcf8591_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t pcf8591_interface_iic_write_cmd(uint8_t addr, uint8_t *buf, uint16_t len)
interface iic bus write command
uint8_t pcf8591_interface_iic_deinit(void)
interface iic bus deinit
uint8_t pcf8591_interface_iic_read_cmd(uint8_t addr, uint8_t *buf, uint16_t len)
interface iic bus read command
#define DRIVER_PCF8591_LINK_IIC_READ_COMMAND(HANDLE, FUC)
link iic_read_cmd function
#define DRIVER_PCF8591_LINK_INIT(HANDLE, STRUCTURE)
initialize pcf8591_handle_t structure
#define DRIVER_PCF8591_LINK_IIC_INIT(HANDLE, FUC)
link iic_init function
#define DRIVER_PCF8591_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
#define DRIVER_PCF8591_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
#define DRIVER_PCF8591_LINK_IIC_WRITE_COMMAND(HANDLE, FUC)
link iic_write_cmd function
#define DRIVER_PCF8591_LINK_IIC_DEINIT(HANDLE, FUC)
link iic_deinit function
uint8_t pcf8591_register_test(pcf8591_address_t addr)
register test
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v