42#define CHIP_NAME                 "Texas Instruments HDC2080"         
   43#define MANUFACTURER_NAME         "Texas Instruments"                 
   44#define SUPPLY_VOLTAGE_MIN        1.62f                               
   45#define SUPPLY_VOLTAGE_MAX        3.6f                                
   46#define MAX_CURRENT               90.0f                               
   47#define TEMPERATURE_MIN           -40.0f                              
   48#define TEMPERATURE_MAX           125.0f                              
   49#define DRIVER_VERSION            1000                                
   54#define HDC2080_REG_TEMPERATURE_LOW        0x00         
   55#define HDC2080_REG_TEMPERATURE_HIGH       0x01         
   56#define HDC2080_REG_HUMIDITY_LOW           0x02         
   57#define HDC2080_REG_HUMIDITY_HIGH          0x03         
   58#define HDC2080_REG_INTERRUPT_DRDY         0x04         
   59#define HDC2080_REG_TEMPERATURE_MAX        0x05         
   60#define HDC2080_REG_HUMIDITY_MAX           0x06         
   61#define HDC2080_REG_INTERRUPT_ENABLE       0x07         
   62#define HDC2080_REG_TEMP_OFFSET_ADJUST     0x08         
   63#define HDC2080_REG_HUM_OFFSET_ADJUST      0x09         
   64#define HDC2080_REG_TEMP_THR_L             0x0A         
   65#define HDC2080_REG_TEMP_THR_H             0x0B         
   66#define HDC2080_REG_RH_THR_L               0x0C         
   67#define HDC2080_REG_RH_THR_H               0x0D         
   68#define HDC2080_REG_CONF                   0x0E         
   69#define HDC2080_REG_MEASUREMENT            0x0F         
   70#define HDC2080_REG_MANUFACTURER_ID_LOW    0xFC         
   71#define HDC2080_REG_MANUFACTURER_ID_HIGH   0xFD         
   72#define HDC2080_REG_DEVICE_ID_LOW          0xFE         
   73#define HDC2080_REG_DEVICE_ID_HIGH         0xFF         
   86static uint8_t a_hdc2080_iic_read(
hdc2080_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 
  109static uint8_t a_hdc2080_iic_write(
hdc2080_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 
  137    handle->
iic_addr = (uint8_t)addr_pin;      
 
 
  192        handle->
debug_print(
"hdc2080: iic_init is null.\n");                   
 
  198        handle->
debug_print(
"hdc2080: iic_deinit is null.\n");                 
 
  204        handle->
debug_print(
"hdc2080: iic_read is null.\n");                   
 
  210        handle->
debug_print(
"hdc2080: iic_write is null.\n");                  
 
  216        handle->
debug_print(
"hdc2080: delay_ms is null.\n");                   
 
  223        handle->
debug_print(
"hdc2080: iic init failed.\n");                    
 
  230        handle->
debug_print(
"hdc2080: read manufacturer id failed.\n");        
 
  235    id = buf[0] | (uint16_t)buf[1] << 8;                                       
 
  238        handle->
debug_print(
"hdc2080: manufacturer id is invalid.\n");         
 
  246        handle->
debug_print(
"hdc2080: read device id failed.\n");              
 
  251    id = buf[0] | (uint16_t)buf[1] << 8;                                       
 
  254        handle->
debug_print(
"hdc2080: device id is invalid.\n");               
 
  263        handle->
debug_print(
"hdc2080: read config failed.\n");                 
 
  273        handle->
debug_print(
"hdc2080: write config failed.\n");                
 
 
  311        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
  319        handle->
debug_print(
"hdc2080: write config failed.\n");          
 
  325        handle->
debug_print(
"hdc2080: iic deinit failed.\n");            
 
 
  362        handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
  367    prev |= resolution << 6;                                                    
 
  371        handle->
debug_print(
"hdc2080: write config failed.\n");                 
 
 
  407        handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
 
  444        handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
  449    prev |= resolution << 4;                                                    
 
  453        handle->
debug_print(
"hdc2080: write config failed.\n");                 
 
 
  489        handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
 
  526        handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
  535        handle->
debug_print(
"hdc2080: write config failed.\n");                 
 
 
  571        handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
 
  608        handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
  617        handle->
debug_print(
"hdc2080: write config failed.\n");                 
 
 
  653        handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
 
  689        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
  698        handle->
debug_print(
"hdc2080: write config failed.\n");          
 
 
  735        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
  744        handle->
debug_print(
"hdc2080: write config failed.\n");          
 
 
  780        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
 
  817        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
  826        handle->
debug_print(
"hdc2080: write config failed.\n");          
 
 
  862        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
 
  899        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
  908        handle->
debug_print(
"hdc2080: write config failed.\n");          
 
 
  944        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
 
  981        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
  986    prev |= polarity << 1;                                               
 
  990        handle->
debug_print(
"hdc2080: write config failed.\n");          
 
 
 1026        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
 
 1063        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
 1072        handle->
debug_print(
"hdc2080: write config failed.\n");          
 
 
 1108        handle->
debug_print(
"hdc2080: read config failed.\n");           
 
 
 1146        handle->
debug_print(
"hdc2080: write config failed.\n");              
 
 
 1182        handle->
debug_print(
"hdc2080: read config failed.\n");              
 
 
 1220        handle->
debug_print(
"hdc2080: write config failed.\n");              
 
 
 1256        handle->
debug_print(
"hdc2080: read config failed.\n");              
 
 
 1294        handle->
debug_print(
"hdc2080: write config failed.\n");              
 
 
 1330        handle->
debug_print(
"hdc2080: read config failed.\n");              
 
 
 1368        handle->
debug_print(
"hdc2080: write config failed.\n");              
 
 
 1404        handle->
debug_print(
"hdc2080: read config failed.\n");              
 
 
 1438    prev = (uint8_t)(offset);                                                       
 
 1442        handle->
debug_print(
"hdc2080: write config failed.\n");                     
 
 
 1478        handle->
debug_print(
"hdc2080: read config failed.\n");                      
 
 1482    *offset = (int8_t)(prev);                                                       
 
 
 1512    prev = (uint8_t)(offset);                                                       
 
 1516        handle->
debug_print(
"hdc2080: write config failed.\n");                     
 
 
 1552        handle->
debug_print(
"hdc2080: read config failed.\n");                      
 
 1556    *offset = (int8_t)(prev);                                                       
 
 
 1590        handle->
debug_print(
"hdc2080: read config failed.\n");                       
 
 1594    prev &= ~(1 << interrupt);                                                       
 
 1595    prev |= enable << interrupt;                                                     
 
 1599        handle->
debug_print(
"hdc2080: write config failed.\n");                      
 
 
 1636        handle->
debug_print(
"hdc2080: read config failed.\n");                       
 
 
 1674        handle->
debug_print(
"hdc2080: write config failed.\n");                   
 
 
 1710        handle->
debug_print(
"hdc2080: read config failed.\n");                   
 
 
 1748        handle->
debug_print(
"hdc2080: write config failed.\n");                      
 
 
 1784        handle->
debug_print(
"hdc2080: read config failed.\n");                      
 
 
 1821        handle->
debug_print(
"hdc2080: read config failed.\n");                     
 
 
 1852    *reg = (uint8_t)(percent / 100.0f * (
float)(256.0f));        
 
 
 1879    *percent = (float)(reg) / 256.0f * 100.0f;        
 
 
 1906    *reg = (uint8_t)((deg + 40.5f) / 165.0f * (
float)(256.0f));        
 
 
 1933    *deg = (float)(reg) / 256.0f * 165.0f - 40.5f;        
 
 
 1960    *reg = (int8_t)(percent / 0.2f);        
 
 
 1987    *percent = (float)(reg) * 0.2f;        
 
 
 2014    *reg = (int8_t)(deg / 0.16f);        
 
 
 2041    *deg = (float)(reg) * 0.16f;        
 
 
 2061                                          uint16_t *humidity_raw, 
float *humidity_s)
 
 2078        handle->
debug_print(
"hdc2080: read temperature failed.\n");                    
 
 2082    *temperature_raw = buf[0] | (uint16_t)(buf[1]) << 8;                               
 
 2083    *temperature_s = (float)(*temperature_raw) / 65536.0f * 165.0f - 40.5f;            
 
 2087        handle->
debug_print(
"hdc2080: read humidity failed.\n");                       
 
 2091    *humidity_raw = buf[0] | (uint16_t)(buf[1]) << 8;                                  
 
 2092    *humidity_s = (float)(*humidity_raw) / 65536.0f * 100.0f;                          
 
 
 2126        handle->
debug_print(
"hdc2080: read temperature failed.\n");                    
 
 2130    *temperature_raw = buf[0] | (uint16_t)(buf[1]) << 8;                               
 
 2131    *temperature_s = (float)(*temperature_raw) / 65536.0f * 165.0f - 40.5f;            
 
 
 2165        handle->
debug_print(
"hdc2080: read humidity failed.\n");                       
 
 2169    *humidity_raw = buf[0] | (uint16_t)(buf[1]) << 8;                                  
 
 2170    *humidity_s = (float)(*humidity_raw) / 65536.0f * 100.0f;                          
 
 
 2191    uint32_t timeout = 500;
 
 2205        handle->
debug_print(
"hdc2080: read config failed.\n");                      
 
 2214        handle->
debug_print(
"hdc2080: write config failed.\n");                     
 
 2218    for (i = 0; i < timeout; i++)                                                   
 
 2223            handle->
debug_print(
"hdc2080: read config failed.\n");                  
 
 2227        if (((prev >> 0) & 0x01) == 0)                                              
 
 
 2267    if (a_hdc2080_iic_write(handle, reg, buf, len) != 0)     
 
 
 2301    if (a_hdc2080_iic_read(handle, reg, buf, len) != 0)     
 
 
#define HDC2080_REG_INTERRUPT_ENABLE
#define HDC2080_REG_HUMIDITY_MAX
#define HDC2080_REG_INTERRUPT_DRDY
#define HDC2080_REG_RH_THR_L
#define HDC2080_REG_HUMIDITY_LOW
#define HDC2080_REG_TEMP_THR_H
#define HDC2080_REG_TEMPERATURE_LOW
chip register definition
#define SUPPLY_VOLTAGE_MAX
#define HDC2080_REG_TEMP_THR_L
#define HDC2080_REG_DEVICE_ID_LOW
#define HDC2080_REG_MEASUREMENT
#define HDC2080_REG_HUM_OFFSET_ADJUST
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define HDC2080_REG_RH_THR_H
#define HDC2080_REG_TEMP_OFFSET_ADJUST
#define HDC2080_REG_TEMPERATURE_MAX
#define CHIP_NAME
chip information definition
#define HDC2080_REG_MANUFACTURER_ID_LOW
driver hdc2080 header file
uint8_t hdc2080_set_measurement(hdc2080_handle_t *handle, hdc2080_bool_t enable)
enable or disable measurement
uint8_t hdc2080_init(hdc2080_handle_t *handle)
initialize the chip
uint8_t hdc2080_set_temperature_offset_adjustment(hdc2080_handle_t *handle, int8_t offset)
set temperature offset adjustment
uint8_t hdc2080_set_temperature_low_threshold(hdc2080_handle_t *handle, uint8_t threshold)
set temperature low threshold
uint8_t hdc2080_get_addr_pin(hdc2080_handle_t *handle, hdc2080_address_t *addr_pin)
get the iic address pin
uint8_t hdc2080_set_auto_measurement_mode(hdc2080_handle_t *handle, hdc2080_auto_measurement_mode_t mode)
set auto measurement mode
uint8_t hdc2080_get_temperature_low_threshold(hdc2080_handle_t *handle, uint8_t *threshold)
get temperature low threshold
struct hdc2080_handle_s hdc2080_handle_t
hdc2080 handle structure definition
uint8_t hdc2080_set_humidity_resolution(hdc2080_handle_t *handle, hdc2080_resolution_t resolution)
set humidity resolution
uint8_t hdc2080_read_temperature_humidity(hdc2080_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
read the temperature and humidity data
uint8_t hdc2080_get_humidity_low_threshold(hdc2080_handle_t *handle, uint8_t *threshold)
get humidity low threshold
uint8_t hdc2080_soft_reset(hdc2080_handle_t *handle)
soft reset
uint8_t hdc2080_deinit(hdc2080_handle_t *handle)
close the chip
uint8_t hdc2080_humidity_offset_convert_to_register(hdc2080_handle_t *handle, float percent, int8_t *reg)
convert the humidity offset to the register raw data
uint8_t hdc2080_set_temperature_resolution(hdc2080_handle_t *handle, hdc2080_resolution_t resolution)
set temperature resolution
uint8_t hdc2080_temperature_offset_convert_to_register(hdc2080_handle_t *handle, float deg, int8_t *reg)
convert the temperature offset to the register raw data
uint8_t hdc2080_temperature_convert_to_data(hdc2080_handle_t *handle, uint8_t reg, float *deg)
convert the register raw data to the temperature
uint8_t hdc2080_humidity_convert_to_data(hdc2080_handle_t *handle, uint8_t reg, float *percent)
convert the register raw data to the humidity
uint8_t hdc2080_set_interrupt_pin(hdc2080_handle_t *handle, hdc2080_bool_t enable)
enable or disable interrupt pin
uint8_t hdc2080_temperature_offset_convert_to_data(hdc2080_handle_t *handle, int8_t reg, float *deg)
convert the register raw data to the temperature offset
uint8_t hdc2080_get_interrupt_pin(hdc2080_handle_t *handle, hdc2080_bool_t *enable)
get interrupt pin status
uint8_t hdc2080_get_heater(hdc2080_handle_t *handle, hdc2080_bool_t *enable)
get heater status
uint8_t hdc2080_set_humidity_low_threshold(hdc2080_handle_t *handle, uint8_t threshold)
set humidity low threshold
uint8_t hdc2080_get_temperature_offset_adjustment(hdc2080_handle_t *handle, int8_t *offset)
get temperature offset adjustment
uint8_t hdc2080_get_humidity_max(hdc2080_handle_t *handle, uint8_t *max)
get humidity max
uint8_t hdc2080_set_addr_pin(hdc2080_handle_t *handle, hdc2080_address_t addr_pin)
set the iic address pin
hdc2080_bool_t
hdc2080 bool enumeration definition
uint8_t hdc2080_get_mode(hdc2080_handle_t *handle, hdc2080_mode_t *mode)
get the chip mode
uint8_t hdc2080_get_measurement(hdc2080_handle_t *handle, hdc2080_bool_t *enable)
get measurement status
hdc2080_resolution_t
hdc2080 resolution enumeration definition
uint8_t hdc2080_get_interrupt_polarity(hdc2080_handle_t *handle, hdc2080_interrupt_polarity_t *polarity)
get interrupt polarity
uint8_t hdc2080_set_mode(hdc2080_handle_t *handle, hdc2080_mode_t mode)
set the chip mode
uint8_t hdc2080_set_humidity_high_threshold(hdc2080_handle_t *handle, uint8_t threshold)
set humidity high threshold
hdc2080_auto_measurement_mode_t
hdc2080 auto measurement mode enumeration definition
hdc2080_interrupt_polarity_t
hdc2080 interrupt polarity enumeration definition
hdc2080_interrupt_mode_t
hdc2080 interrupt mode enumeration definition
uint8_t hdc2080_set_humidity_max(hdc2080_handle_t *handle, uint8_t max)
set humidity max
uint8_t hdc2080_get_humidity_offset_adjustment(hdc2080_handle_t *handle, int8_t *offset)
get humidity offset adjustment
hdc2080_interrupt_t
hdc2080 interrupt enumeration definition
uint8_t hdc2080_get_temperature_high_threshold(hdc2080_handle_t *handle, uint8_t *threshold)
get temperature high threshold
hdc2080_mode_t
hdc2080 mode enumeration definition
uint8_t hdc2080_get_auto_measurement_mode(hdc2080_handle_t *handle, hdc2080_auto_measurement_mode_t *mode)
get auto measurement mode
uint8_t hdc2080_set_interrupt_polarity(hdc2080_handle_t *handle, hdc2080_interrupt_polarity_t polarity)
set interrupt polarity
uint8_t hdc2080_get_interrupt_mode(hdc2080_handle_t *handle, hdc2080_interrupt_mode_t *mode)
get interrupt mode
uint8_t hdc2080_set_interrupt_mode(hdc2080_handle_t *handle, hdc2080_interrupt_mode_t mode)
set interrupt mode
struct hdc2080_info_s hdc2080_info_t
hdc2080 information structure definition
uint8_t hdc2080_set_humidity_offset_adjustment(hdc2080_handle_t *handle, int8_t offset)
set humidity offset adjustment
uint8_t hdc2080_set_heater(hdc2080_handle_t *handle, hdc2080_bool_t enable)
enable or disable heater
uint8_t hdc2080_humidity_convert_to_register(hdc2080_handle_t *handle, float percent, uint8_t *reg)
convert the humidity to the register raw data
uint8_t hdc2080_info(hdc2080_info_t *info)
get chip's information
uint8_t hdc2080_get_temperature_max(hdc2080_handle_t *handle, uint8_t *max)
get temperature max
uint8_t hdc2080_set_interrupt(hdc2080_handle_t *handle, hdc2080_interrupt_t interrupt, hdc2080_bool_t enable)
enable or disable interrupt
uint8_t hdc2080_set_temperature_max(hdc2080_handle_t *handle, uint8_t max)
set temperature max
uint8_t hdc2080_get_humidity_resolution(hdc2080_handle_t *handle, hdc2080_resolution_t *resolution)
get humidity resolution
uint8_t hdc2080_temperature_convert_to_register(hdc2080_handle_t *handle, float deg, uint8_t *reg)
convert the temperature to the register raw data
uint8_t hdc2080_get_interrupt_status(hdc2080_handle_t *handle, uint8_t *status)
get interrupt status
uint8_t hdc2080_read_humidity(hdc2080_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
read the humidity data
uint8_t hdc2080_set_temperature_high_threshold(hdc2080_handle_t *handle, uint8_t threshold)
set temperature high threshold
uint8_t hdc2080_get_humidity_high_threshold(hdc2080_handle_t *handle, uint8_t *threshold)
get humidity high threshold
uint8_t hdc2080_humidity_offset_convert_to_data(hdc2080_handle_t *handle, int8_t reg, float *percent)
convert the register raw data to the humidity offset
uint8_t hdc2080_read_poll(hdc2080_handle_t *handle)
read poll
uint8_t hdc2080_get_temperature_resolution(hdc2080_handle_t *handle, hdc2080_resolution_t *resolution)
get temperature resolution
uint8_t hdc2080_get_interrupt(hdc2080_handle_t *handle, hdc2080_interrupt_t interrupt, hdc2080_bool_t *enable)
get interrupt status
uint8_t hdc2080_read_temperature(hdc2080_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
read the temperature
hdc2080_address_t
hdc2080 address enumeration definition
uint8_t hdc2080_get_reg(hdc2080_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get chip register
uint8_t hdc2080_set_reg(hdc2080_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set chip register
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)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v