37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
//
|
|
// Created by cfif on 29.05.2026.
|
|
//
|
|
|
|
#ifndef HVAC_DEV_V2_DIG_POT_H
|
|
#define HVAC_DEV_V2_DIG_POT_H
|
|
|
|
#include "stdint.h"
|
|
|
|
typedef struct {
|
|
uint16_t adc;
|
|
int16_t temp;
|
|
float resistance;
|
|
} TablePoint;
|
|
|
|
uint32_t get_resistance_by_temperature_linear(const TablePoint *table, int table_size, int16_t temperature);
|
|
uint32_t find_steps_for_resistance(uint32_t target_ohm, uint8_t *step_100k, uint8_t *step_10k);
|
|
|
|
uint32_t find_steps_for_resistance_auto(uint32_t target_ohm,
|
|
uint8_t *step_100k_1,
|
|
uint8_t *step_100k_2,
|
|
uint8_t *step_100k_3,
|
|
uint8_t *step_10k);
|
|
|
|
|
|
#define size_ambient_lookup_table_20000 4095
|
|
#define size_duct_lookup_table_3000 4095
|
|
#define size_duct_lookup_table_20000 4095
|
|
#define size_incar_lookup_table_20000 4095
|
|
|
|
extern const TablePoint ambient_lookup_table_20000[4095];
|
|
extern const TablePoint duct_lookup_table_3000[4095];
|
|
extern const TablePoint duct_lookup_table_20000[4095];
|
|
extern const TablePoint incar_lookup_table_20000[4095];
|
|
|
|
#endif //HVAC_DEV_V2_DIG_POT_H
|