STIMA  3
i2c-th-config.h
1 
2 /*********************************************************************
3 Copyright (C) 2022 Marco Baldinetti <m.baldinetti@digiteco.it>
4 authors:
5 Paolo patruno <p.patruno@iperbole.bologna.it>
6 Marco Baldinetti <m.baldinetti@digiteco.it>
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 **********************************************************************/
21 
22 #ifndef _I2C_TH_CONFIG_H
23 #define _I2C_TH_CONFIG_H
24 
25 #include <sensors_config.h>
26 
27 /*********************************************************************
28 * MODULE
29 *********************************************************************/
34 #define MODULE_MAIN_VERSION (3)
35 
40 #define MODULE_MINOR_VERSION (19)
41 
46 #define MODULE_CONFIGURATION_VERSION (2)
47 
52 #define MODULE_TYPE (STIMA_MODULE_TYPE_TH)
53 
54 /*********************************************************************
55 * CONFIGURATION
56 *********************************************************************/
61 #define CONFIGURATION_DEFAULT_IS_ONESHOT (false)
62 
67 #define CONFIGURATION_DEFAULT_I2C_ADDRESS (I2C_TH_DEFAULT_ADDRESS)
68 
73 #define CONFIGURATION_RESET_PIN (8)
74 
79 #define TH_POWER_PIN (5)
80 #define SDCARD_CHIP_SELECT_PIN 7
85 
90 #define SPI_SPEED SD_SCK_MHZ(4)
91 
92 /*********************************************************************
93 * POWER DOWN
94 *********************************************************************/
99 #define USE_POWER_DOWN (true)
100 
105 #define DEBOUNCING_POWER_DOWN_TIME_MS (10)
106 
111 #define USE_TIMER_1 (true)
112 
113 /*********************************************************************
114 * WATCHDOG
115 *********************************************************************/
124 #define WDT_TIMER (WDTO_8S)
125 
126 
127 
128 /*********************************************************************
129 * SENSORS
130 *********************************************************************/
131 
136 #define SENSOR_ERROR_COUNT_MAX (20)
137 
138 /*********************************************************************
139 * HUMIDITY AND TEMPERATURE SENSORS
140 *********************************************************************/
141 
146 #define OBSERVATIONS_MINUTES (1)
147 
148  // observations with processing every 1-10 minutes (minutes for processing sampling)
149 // report every 5-60 minutes (> OBSERVATIONS_MINUTES)
150 
156 #define SENSORS_SAMPLE_TIME_MS (4000)
157 
158 
159 #define SAMPLES_COUNT_MAX (((OBSERVATIONS_MINUTES * 60000UL) / SENSORS_SAMPLE_TIME_MS) + 10)
160 
165 #define OBSERVATION_SAMPLES_COUNT (((OBSERVATIONS_MINUTES * 60000UL) / SENSORS_SAMPLE_TIME_MS ))
166 
167 
169 //\def OBSERVATION_COUNT
170 //\brief Observations buffer length.
171 //*/
172 //#define OBSERVATION_COUNT (STATISTICAL_DATA_COUNT * 25)
173 
174 
179 #define OBSERVATION_SAMPLE_ERROR_MAX ((uint16_t)(round(OBSERVATION_SAMPLES_COUNT/10.))+1)
180 
181 
182 #define RMAP_REPORT_ERROR_MAX ((uint16_t)(1))
183 #define RMAP_REPORT_VALID_MIN ((uint16_t)(2))
184 
185 
186 
187 /*********************************************************************
188 * TIMER1
189 *********************************************************************/
194 #define TIMER1_INTERRUPT_TIME_MS (SENSORS_SAMPLE_TIME_MS)
195 
200 #define TIMER1_TCNT1_VALUE (0xFFFFUL - (TIMER1_INTERRUPT_TIME_MS*1000UL/(1024 / (F_CPU/1000000)))+1)
201 
206 #define TIMER1_VALUE_MAX_MS (TIMER1_INTERRUPT_TIME_MS * 3)
207 
208 /*********************************************************************
209 * TASKS
210 *********************************************************************/
215 #define SENSORS_RETRY_COUNT_MAX (3)
216 
221 #define SENSORS_RETRY_DELAY_MS (50)
222 
227 #define TRANSACTION_TIMEOUT_MS (5000)
228 
229 
230 #endif
#define SDCARD_CHIP_SELECT_PIN
Chip select for SDcard SPI.
Definition: i2c-leaf-config.h:103