LibDriver NTC
Loading...
Searching...
No Matches
driver_ntc.h File Reference

driver ntc header file More...

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

Go to the source code of this file.

Data Structures

struct  ntc_table_s
 ntc table structure definition More...
struct  ntc_handle_s
 ntc handle structure definition More...
struct  ntc_info_s
 ntc information structure definition More...

Macros

#define NTC_FILTER_BUFFER_SIZE   32
 ntc filter buffer size definition
#define DRIVER_NTC_LINK_INIT(HANDLE, STRUCTURE)
 initialize ntc_handle_t structure
#define DRIVER_NTC_LINK_ADC_INIT(HANDLE, FUC)
 link adc_init function
#define DRIVER_NTC_LINK_ADC_DEINIT(HANDLE, FUC)
 link adc_deinit function
#define DRIVER_NTC_LINK_ADC_READ(HANDLE, FUC)
 link adc_read function
#define DRIVER_NTC_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_NTC_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct ntc_table_s ntc_table_t
 ntc table structure definition
typedef struct ntc_handle_s ntc_handle_t
 ntc handle structure definition
typedef struct ntc_info_s ntc_info_t
 ntc information structure definition

Enumerations

enum  ntc_circuit_t { NTC_CIRCUIT_VCC_NTC_R_GND = 0x00 , NTC_CIRCUIT_VCC_R_NTC_GND = 0x01 }
 ntc circuit enumeration definition More...
enum  ntc_algorithm_t { NTC_ALGORITHM_BETA_FORMULA = 0x00 , NTC_ALGORITHM_STEINHART_HART = 0x01 , NTC_ALGORITHM_LOOKUP_TABLE = 0x02 }
 ntc algorithm enumeration definition More...
enum  ntc_filter_t {
  NTC_FILTER_NONE = 0x00 , NTC_FILTER_FIRST_ORDER_LAG = 0x01 , NTC_FILTER_MEDIAN = 0x02 , NTC_FILTER_ANTI_SPIKE_AVERAGE = 0x03 ,
  NTC_FILTER_MOVING_AVERAGE = 0x04 , NTC_FILTER_WEIGHTED_MOVING_AVERAGE = 0x05 , NTC_FILTER_LIMITING = 0x06 , NTC_FILTER_KALMAN = 0x07
}
 ntc filter enumeration definition More...

Functions

uint8_t ntc_info (ntc_info_t *info)
 get chip's information
uint8_t ntc_init (ntc_handle_t *handle)
 initialize the chip
uint8_t ntc_deinit (ntc_handle_t *handle)
 close the chip
uint8_t ntc_read_temperature (ntc_handle_t *handle, float *ohm, float *degrees_celsius)
 read temperature
uint8_t ntc_calculate_temperature (ntc_handle_t *handle, float ohm, float *degrees_celsius)
 calculate temperature
uint8_t ntc_calculate_temperature_with_filter (ntc_handle_t *handle, float *ohm, uint16_t len, float *degrees_celsius)
 calculate temperature with filter
uint8_t ntc_set_algorithm (ntc_handle_t *handle, ntc_algorithm_t algorithm)
 set algorithm
uint8_t ntc_get_algorithm (ntc_handle_t *handle, ntc_algorithm_t *algorithm)
 get algorithm
uint8_t ntc_set_algorithm_beta_formula_beta_value (ntc_handle_t *handle, float beta)
 set algorithm beta formula beta value
uint8_t ntc_get_algorithm_beta_formula_beta_value (ntc_handle_t *handle, float *beta)
 get algorithm beta formula beta value
uint8_t ntc_set_algorithm_beta_formula_r25_ohm (ntc_handle_t *handle, float r25_ohm)
 set algorithm beta formula r25 ohm
uint8_t ntc_get_algorithm_beta_formula_r25_ohm (ntc_handle_t *handle, float *r25_ohm)
 get algorithm beta formula r25 ohm
uint8_t ntc_set_algorithm_steinhart_hart (ntc_handle_t *handle, double a, double b, double c)
 set algorithm steinhart hart
uint8_t ntc_get_algorithm_steinhart_hart (ntc_handle_t *handle, double *a, double *b, double *c)
 get algorithm steinhart hart
uint8_t ntc_load_algorithm_lookup_table (ntc_handle_t *handle, const ntc_table_t *table, uint16_t table_len)
 load algorithm lookup table
uint8_t ntc_set_circuit (ntc_handle_t *handle, ntc_circuit_t circuit)
 set circuit
uint8_t ntc_get_circuit (ntc_handle_t *handle, ntc_circuit_t *circuit)
 get circuit
uint8_t ntc_set_circuit_fixed_resistor (ntc_handle_t *handle, float r_fixed_ohm)
 set circuit fixed resistor
uint8_t ntc_get_circuit_fixed_resistor (ntc_handle_t *handle, float *r_fixed_ohm)
 get circuit fixed resistor
uint8_t ntc_set_filter (ntc_handle_t *handle, ntc_filter_t filter)
 set filter
uint8_t ntc_get_filter (ntc_handle_t *handle, ntc_filter_t *filter)
 get filter
uint8_t ntc_reset_filter (ntc_handle_t *handle)
 reset the filter
uint8_t ntc_set_filter_first_order_lag (ntc_handle_t *handle, float alpha)
 set filter first order lag
uint8_t ntc_set_filter_median_length (ntc_handle_t *handle, uint16_t length)
 set filter median length
uint8_t ntc_set_filter_anti_spike_average_length (ntc_handle_t *handle, uint16_t length)
 set filter anti spike average length
uint8_t ntc_set_filter_moving_average_length (ntc_handle_t *handle, uint16_t length)
 set filter moving average length
uint8_t ntc_set_filter_weighted_moving_average_length (ntc_handle_t *handle, float *weight, uint16_t length)
 set filter weighted moving average length
uint8_t ntc_set_filter_limiting (ntc_handle_t *handle, float degrees_celsius)
 set filter limiting
uint8_t ntc_set_filter_kalman (ntc_handle_t *handle, float q_process_noise_covariance, float r_measurement_noise_covariance, float p_estimation_error_covariance, float x_estimated_value)
 set filter kalman

Detailed Description

driver ntc 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
2026-05-31

history

Date Version Author Description
2026/05/31 1.0 Shifeng Li first upload

Definition in file driver_ntc.h.