temp_sensor.h
1 /*
2  * EEZ PSU Firmware
3  * Copyright (C) 2015-present, Envox d.o.o.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14 
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #pragma once
20 
21 namespace eez {
22 namespace psu {
23 namespace temp_sensor {
24 
25 static const int MIN_ADC = 0;
26 static const int MIN_U = 0;
27 static const int MAX_ADC = 1023;
28 static const int MAX_U = 5;
29 
31 
32 static const int MAX_NUM_TEMP_SENSORS = 5;
33 
35 
36 #define TEMP_SENSOR(NAME, INSTALLED, PIN, CAL_POINTS, CH_NUM, QUES_REG_BIT, SCPI_ERROR) NAME
37 enum Type {
39  NUM_TEMP_SENSORS
40 };
41 #undef TEMP_SENSOR
42 
44 
45 class TempSensor {
46 public:
47  TempSensor(const char *name, int installed, int pin, float p1_volt, float p1_cels, float p2_volt, float p2_cels, int ch_num, int ques_bit, int scpi_error);
48 
49  psu::TestResult g_testResult;
50  const char *name;
51  int installed;
52  int pin;
53  float p1_volt;
54  float p1_cels;
55  float p2_volt;
56  float p2_cels;
57  int ch_num;
58  int ques_bit;
59  int scpi_error;
60 
61  void init();
62  bool test();
63 
64  float read();
65 };
66 
68 
69 extern TempSensor sensors[NUM_TEMP_SENSORS];
70 
71 }
72 }
73 } // namespace eez::psu::temp_sensor
Namespace for the everything from the EEZ.
Definition: actions.cpp:41
Definition: temp_sensor.h:45
#define TEMP_SENSORS
temperature sensors
Definition: conf_advanced.h:120