LibDriver HDC302X
Loading...
Searching...
No Matches
driver_hdc302x.h File Reference

driver hdc302x header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_hdc302x.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hdc302x_handle_s
 hdc302x handle structure definition More...
struct  hdc302x_info_s
 hdc302x information structure definition More...

Macros

#define DRIVER_HDC302X_LINK_INIT(HANDLE, STRUCTURE)
 initialize hdc302x_handle_t structure
#define DRIVER_HDC302X_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_HDC302X_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_HDC302X_LINK_IIC_READ_ADDRESS16(HANDLE, FUC)
 link iic_read_address16 function
#define DRIVER_HDC302X_LINK_IIC_WRITE_ADDRESS16(HANDLE, FUC)
 link iic_write_address16 function
#define DRIVER_HDC302X_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_HDC302X_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function
#define DRIVER_HDC302X_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
 link receive_callback function

Typedefs

typedef struct hdc302x_handle_s hdc302x_handle_t
 hdc302x handle structure definition
typedef struct hdc302x_info_s hdc302x_info_t
 hdc302x information structure definition

Enumerations

enum  hdc302x_address_t { HDC302X_ADDRESS_00 = (0x44 << 1) , HDC302X_ADDRESS_01 = (0x46 << 1) , HDC302X_ADDRESS_10 = (0x45 << 1) , HDC302X_ADDRESS_11 = (0x47 << 1) }
 hdc302x address enumeration definition More...
enum  hdc302x_low_power_mode_t { HDC302X_LOW_POWER_MODE_0 = 0 , HDC302X_LOW_POWER_MODE_1 = 1 , HDC302X_LOW_POWER_MODE_2 = 2 , HDC302X_LOW_POWER_MODE_3 = 3 }
 hdc302x low power mode enumeration definition More...
enum  hdc302x_auto_mode_t {
  HDC302X_AUTO_MODE_0P5_HZ = 0 , HDC302X_AUTO_MODE_1_HZ = 1 , HDC302X_AUTO_MODE_2_HZ = 2 , HDC302X_AUTO_MODE_4_HZ = 3 ,
  HDC302X_AUTO_MODE_10_HZ = 4
}
 hdc302x auto mode enumeration definition More...
enum  hdc302x_status_t {
  HDC302X_STATUS_OVERALL_ALERT = (1 << 15) , HDC302X_STATUS_HEATER = (1 << 13) , HDC302X_STATUS_RH_TRACKING_ALERT = (1 << 11) , HDC302X_STATUS_T_TRACKING_ALERT = (1 << 10) ,
  HDC302X_STATUS_RH_HIGH_TRACKING_ALERT = (1 << 9) , HDC302X_STATUS_RH_LOW_TRACKING_ALERT = (1 << 8) , HDC302X_STATUS_T_HIGH_TRACKING_ALERT = (1 << 7) , HDC302X_STATUS_T_LOW_TRACKING_ALERT = (1 << 6) ,
  HDC302X_STATUS_DEVICE_RESET_DETECTED = (1 << 4) , HDC302X_STATUS_CHECKSUM_VERY = (1 << 0)
}
 hdc302x status enumeration definition More...

Functions

uint8_t hdc302x_info (hdc302x_info_t *info)
 get chip's information
uint8_t hdc302x_set_addr (hdc302x_handle_t *handle, hdc302x_address_t addr)
 set the iic address
uint8_t hdc302x_get_addr (hdc302x_handle_t *handle, hdc302x_address_t *addr)
 get the iic address
uint8_t hdc302x_irq_handler (hdc302x_handle_t *handle)
 irq handler
uint8_t hdc302x_init (hdc302x_handle_t *handle)
 initialize the chip
uint8_t hdc302x_deinit (hdc302x_handle_t *handle)
 close the chip
uint8_t hdc302x_set_low_power_mode (hdc302x_handle_t *handle, hdc302x_low_power_mode_t mode)
 set low power mode
uint8_t hdc302x_get_low_power_mode (hdc302x_handle_t *handle, hdc302x_low_power_mode_t *mode)
 get low power mode
uint8_t hdc302x_set_auto_mode (hdc302x_handle_t *handle, hdc302x_auto_mode_t mode)
 set auto mode
uint8_t hdc302x_get_auto_mode (hdc302x_handle_t *handle, hdc302x_auto_mode_t *mode)
 get auto mode
uint8_t hdc302x_soft_reset (hdc302x_handle_t *handle)
 soft reset
uint8_t hdc302x_single_read (hdc302x_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 single read
uint8_t hdc302x_start_continuous_read (hdc302x_handle_t *handle)
 start continuous read
uint8_t hdc302x_stop_continuous_read (hdc302x_handle_t *handle)
 stop continuous read
uint8_t hdc302x_continuous_read (hdc302x_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 continuous read
uint8_t hdc302x_continuous_read_humidity (hdc302x_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
 continuous read humidity
uint8_t hdc302x_read_temperature_min (hdc302x_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
 read temperature min
uint8_t hdc302x_read_temperature_max (hdc302x_handle_t *handle, uint16_t *temperature_raw, float *temperature_s)
 read temperature max
uint8_t hdc302x_read_humidity_min (hdc302x_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
 read humidity min
uint8_t hdc302x_read_humidity_max (hdc302x_handle_t *handle, uint16_t *humidity_raw, float *humidity_s)
 read humidity max
uint8_t hdc302x_write_set_low_alert (hdc302x_handle_t *handle, uint16_t threshold)
 write set low alert
uint8_t hdc302x_write_clear_low_alert (hdc302x_handle_t *handle, uint16_t threshold)
 write clear low alert
uint8_t hdc302x_write_set_high_alert (hdc302x_handle_t *handle, uint16_t threshold)
 write set high alert
uint8_t hdc302x_write_clear_high_alert (hdc302x_handle_t *handle, uint16_t threshold)
 write clear high alert
uint8_t hdc302x_read_set_low_alert (hdc302x_handle_t *handle, uint16_t *threshold)
 read set low alert
uint8_t hdc302x_read_set_high_alert (hdc302x_handle_t *handle, uint16_t *threshold)
 read set high alert
uint8_t hdc302x_read_clear_low_alert (hdc302x_handle_t *handle, uint16_t *threshold)
 read clear low alert
uint8_t hdc302x_read_clear_high_alert (hdc302x_handle_t *handle, uint16_t *threshold)
 read clear high alert
uint8_t hdc302x_enable_heater (hdc302x_handle_t *handle)
 enable heater
uint8_t hdc302x_disable_heater (hdc302x_handle_t *handle)
 disable heater
uint8_t hdc302x_set_heater_power (hdc302x_handle_t *handle, uint16_t power)
 set heater power
uint8_t hdc302x_get_heater_power (hdc302x_handle_t *handle, uint16_t *power)
 get heater power
uint8_t hdc302x_get_nist_id (hdc302x_handle_t *handle, uint8_t id[6])
 get nist id
uint8_t hdc302x_get_status (hdc302x_handle_t *handle, uint16_t *status)
 get status
uint8_t hdc302x_clear_status (hdc302x_handle_t *handle)
 clear status
uint8_t hdc302x_nvm_program_alert_threshold (hdc302x_handle_t *handle)
 nvm program alert threshold
uint8_t hdc302x_nvm_program_temperature_humidity_offset (hdc302x_handle_t *handle, uint16_t offset)
 nvm program temperature humidity offset
uint8_t hdc302x_nvm_read_temperature_humidity_offset (hdc302x_handle_t *handle, uint16_t *offset)
 nvm read temperature humidity offset
uint8_t hdc302x_nvm_program_config (hdc302x_handle_t *handle, uint16_t config)
 nvm program config
uint8_t hdc302x_nvm_read_config (hdc302x_handle_t *handle, uint16_t *config)
 nvm read config
uint8_t hdc302x_alert_threshold_convert_to_register (hdc302x_handle_t *handle, float temperature_deg, float humidity_percentage, uint16_t *reg)
 convert the alert threshold to the register raw data
uint8_t hdc302x_alert_threshold_convert_to_data (hdc302x_handle_t *handle, uint16_t reg, float *temperature_deg, float *humidity_percentage)
 convert the alert threshold to the real data
uint8_t hdc302x_offset_convert_to_register (hdc302x_handle_t *handle, uint8_t temperature_symbol, float temperature_deg, uint8_t humidity_symbol, float humidity_percentage, uint16_t *reg)
 convert the offset to the register raw data
uint8_t hdc302x_offset_convert_to_data (hdc302x_handle_t *handle, uint16_t reg, uint8_t *temperature_symbol, float *temperature_deg, uint8_t *humidity_symbol, float *humidity_percentage)
 convert the offset to the real data
uint8_t hdc302x_set_reg (hdc302x_handle_t *handle, uint16_t command, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t hdc302x_get_reg (hdc302x_handle_t *handle, uint16_t command, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver hdc302x header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2025-12-25

history

Date Version Author Description
2025/12/25 1.0 Shifeng Li first upload

Definition in file driver_hdc302x.h.