STIMA  3
i2c-leaf-config.h
Go to the documentation of this file.
1 
3 /*********************************************************************
4 Copyright (C) 2017 Marco Baldinetti <m.baldinetti@digiteco.it>
5 authors:
6 Paolo patruno <p.patruno@iperbole.bologna.it>
7 Marco Baldinetti <m.baldinetti@digiteco.it>
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of
12 the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 **********************************************************************/
22 
23 #ifndef _I2C_LEAF_CONFIG_H
24 #define _I2C_LEAF_CONFIG_H
25 
26 #include <sensors_config.h>
27 
28 /*********************************************************************
29 * MODULE
30 *********************************************************************/
35 #define MODULE_MAIN_VERSION (3)
36 
41 #define MODULE_MINOR_VERSION (18)
42 
47 #define MODULE_CONFIGURATION_VERSION (1)
48 
53 #define MODULE_TYPE (STIMA_MODULE_TYPE_LEAF)
54 
55 /*********************************************************************
56 * CONFIGURATION
57 *********************************************************************/
62 #define CONFIGURATION_DEFAULT_IS_ONESHOT (false)
63 
68 #define CONFIGURATION_DEFAULT_IS_CONTINUOUS (true)
69 
74 #define CONFIGURATION_DEFAULT_I2C_ADDRESS (I2C_LEAF_DEFAULT_ADDRESS)
75 
80 #define CONFIGURATION_DEFAULT_LEAF_CALIBRATION_THRESHOLD (512)
81 
86 #define CONFIGURATION_RESET_PIN (8)
87 
92 #define LEAF_POWER_PIN (2)
93 
98 #define LEAF_ANALOG_PIN (A0)
99 #define SDCARD_CHIP_SELECT_PIN 7
104 
105 
110 #define SPI_SPEED SD_SCK_MHZ(4)
111 
116 #define I2C_MAX_TIME (600)
117 
118 /*********************************************************************
119 * POWER DOWN
120 *********************************************************************/
125 #define USE_POWER_DOWN (true)
126 
131 #define DEBOUNCING_POWER_DOWN_TIME_MS (10)
132 
137 #define USE_TIMER_1 (true)
138 
143 #define USE_LEAF_POWER_DOWN (true)
144 
145 /*********************************************************************
146 * WATCHDOG
147 *********************************************************************/
156 #define WDT_TIMER (WDTO_8S)
157 
158 /*********************************************************************
159 * LEAF SENSORS
160 *********************************************************************/
161 // observations with processing every 1-10 minutes (minutes for processing sampling)
162 // report every 5-60 minutes (> OBSERVATIONS_MINUTES)
163 
168 #define SENSORS_SAMPLE_TIME_MS (4000)
169 
170 /*********************************************************************
171 * TIMER1
172 *********************************************************************/
177 #define TIMER1_INTERRUPT_TIME_MS (2000)
178 
183 #if (F_CPU == 8000000L)
184 #define TIMER1_OVERFLOW_TIME_MS (8388)
185 #elif (F_CPU == 16000000L)
186 #define TIMER1_OVERFLOW_TIME_MS (4194)
187 #endif
188 
193 #define TIMER1_TCNT1_VALUE ((uint16_t)(0xFFFF - (float)(1.0 * 0xFFFF * TIMER1_INTERRUPT_TIME_MS / TIMER1_OVERFLOW_TIME_MS)))
194 
199 #define TIMER_COUNTER_VALUE_MAX_MS (SENSORS_SAMPLE_TIME_MS)
200 
201 /*********************************************************************
202 * TASKS
203 *********************************************************************/
204 
209 #define LEAF_VALUES_READ_DELAY_MS (2)
210 
215 #define LEAF_READ_COUNT (10)
216 
221 #define TRANSACTION_TIMEOUT_MS (5000)
222 
223 #endif
#define SDCARD_CHIP_SELECT_PIN
Chip select for SDcard SPI.
Definition: i2c-leaf-config.h:103