38#ifndef DRIVER_ADS1115_H
39#define DRIVER_ADS1115_H
178 uint8_t (*
iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
179 uint8_t (*
iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
218#define DRIVER_ADS1115_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
226#define DRIVER_ADS1115_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
234#define DRIVER_ADS1115_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
242#define DRIVER_ADS1115_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC
250#define DRIVER_ADS1115_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC
258#define DRIVER_ADS1115_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
266#define DRIVER_ADS1115_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
uint8_t ads1115_get_channel(ads1115_handle_t *handle, ads1115_channel_t *channel)
get the adc channel
uint8_t ads1115_set_addr_pin(ads1115_handle_t *handle, ads1115_address_t addr_pin)
set the iic address pin
uint8_t ads1115_get_addr_pin(ads1115_handle_t *handle, ads1115_address_t *addr_pin)
get the iic address pin
uint8_t ads1115_start_continuous_read(ads1115_handle_t *handle)
start the chip reading
ads1115_channel_t
ads1115 channel enumeration definition
uint8_t ads1115_init(ads1115_handle_t *handle)
initialize the chip
uint8_t ads1115_set_rate(ads1115_handle_t *handle, ads1115_rate_t rate)
set the sample rate
ads1115_address_t
ads1115 address enumeration definition
uint8_t ads1115_get_rate(ads1115_handle_t *handle, ads1115_rate_t *rate)
get the sample rate
uint8_t ads1115_deinit(ads1115_handle_t *handle)
close the chip
uint8_t ads1115_set_range(ads1115_handle_t *handle, ads1115_range_t range)
set the adc range
struct ads1115_info_s ads1115_info_t
ads1115 information structure definition
ads1115_rate_t
ads1115 channel rate enumeration definition
uint8_t ads1115_get_range(ads1115_handle_t *handle, ads1115_range_t *range)
get the adc range
uint8_t ads1115_single_read(ads1115_handle_t *handle, int16_t *raw, float *v)
read data from the chip once
ads1115_bool_t
ads1115 bool enumeration definition
struct ads1115_handle_s ads1115_handle_t
ads1115 handle structure definition
uint8_t ads1115_info(ads1115_info_t *info)
get chip's information
uint8_t ads1115_stop_continuous_read(ads1115_handle_t *handle)
stop the chip reading
ads1115_range_t
ads1115 range enumeration definition
uint8_t ads1115_set_channel(ads1115_handle_t *handle, ads1115_channel_t channel)
set the adc channel
uint8_t ads1115_continuous_read(ads1115_handle_t *handle, int16_t *raw, float *v)
read data from the chip continuously
@ ADS1115_CHANNEL_AIN1_GND
@ ADS1115_CHANNEL_AIN1_AIN3
@ ADS1115_CHANNEL_AIN0_AIN1
@ ADS1115_CHANNEL_AIN0_GND
@ ADS1115_CHANNEL_AIN3_GND
@ ADS1115_CHANNEL_AIN2_GND
@ ADS1115_CHANNEL_AIN0_AIN3
@ ADS1115_CHANNEL_AIN2_AIN3
uint8_t ads1115_get_reg(ads1115_handle_t *handle, uint8_t reg, int16_t *value)
get the chip register
uint8_t ads1115_set_reg(ads1115_handle_t *handle, uint8_t reg, int16_t value)
set the chip register
uint8_t ads1115_set_alert_pin(ads1115_handle_t *handle, ads1115_pin_t pin)
set the alert pin active status
uint8_t ads1115_get_alert_pin(ads1115_handle_t *handle, ads1115_pin_t *pin)
get the alert pin active status
uint8_t ads1115_set_compare(ads1115_handle_t *handle, ads1115_bool_t enable)
enable or disable the interrupt compare
uint8_t ads1115_get_comparator_queue(ads1115_handle_t *handle, ads1115_comparator_queue_t *comparator_queue)
get the interrupt comparator queue
uint8_t ads1115_convert_to_register(ads1115_handle_t *handle, float s, int16_t *reg)
convert a adc value to a register raw data
uint8_t ads1115_set_compare_threshold(ads1115_handle_t *handle, int16_t high_threshold, int16_t low_threshold)
set the interrupt compare threshold
uint8_t ads1115_set_compare_mode(ads1115_handle_t *handle, ads1115_compare_t compare)
set the interrupt compare mode
ads1115_comparator_queue_t
ads1115 comparator queue enumeration definition
uint8_t ads1115_set_comparator_queue(ads1115_handle_t *handle, ads1115_comparator_queue_t comparator_queue)
set the interrupt comparator queue
ads1115_compare_t
ads1115 compare mode enumeration definition
uint8_t ads1115_get_compare_threshold(ads1115_handle_t *handle, int16_t *high_threshold, int16_t *low_threshold)
get the interrupt compare threshold
uint8_t ads1115_get_compare_mode(ads1115_handle_t *handle, ads1115_compare_t *compare)
get the interrupt compare mode
uint8_t ads1115_get_compare(ads1115_handle_t *handle, ads1115_bool_t *enable)
get the interrupt compare status
uint8_t ads1115_convert_to_data(ads1115_handle_t *handle, int16_t reg, float *s)
convert a register raw data to a converted adc data
ads1115_pin_t
ads1115 pin enumeration definition
@ ADS1115_COMPARATOR_QUEUE_NONE_CONV
@ ADS1115_COMPARATOR_QUEUE_2_CONV
@ ADS1115_COMPARATOR_QUEUE_1_CONV
@ ADS1115_COMPARATOR_QUEUE_4_CONV
@ ADS1115_COMPARE_THRESHOLD
ads1115 handle structure definition
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
ads1115 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v