aboutsummaryrefslogtreecommitdiff
path: root/config-check.h
blob: e33e1ad3bdefc0b1bbf4a6febb86c3a64133b731 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef CONFIG_CHECK_H
#define CONFIG_CHECK_H

/*
 * You have to edit config.h to your likings. The file has to include this:
 *
 * #define CONFIF_VERSION <value>
 *
 * where value is the value defined below in this file.
 *
 * Read the "Configuration Section" below for the defines you can set.
 */

#include "config.h"

// Arduino IDE or the pre-processed code doesn't complain when an include file is not found.
#if CONFIG_VERSION != 20150725
#error *** Read the notes in config-check.h ***
#endif

/*
 * 20150725: Initial version
 * 20150808: Changed values of DEBUG_SINK.
 */

/*
 *
 * Configuration Section.
 *
 * This lists all available configuration items. The items that have default values doesn't have to be included in config.h. The items that are of boolean types evaluate to false if defined to '0' or true for any other value. Some items are default to true if not defined to false.
 *
 */

/*******************************************************************************
 * Board version: SM_BOARD_VERSION
 *
 * You have to set this to match your board. The build will fail if
 * you don't set it.
 *
 * Values:
 *  1: prototype-a, the hand assembled PCB
 *  2: prototype-b, the china produced PCB
 *  3: attiny85
 *
 * No default, has to be specified in config.h
 */

 /*******************************************************************************
 * Wait for serial before starting: WAIT_FOR_SERIAL_BEFORE_STARING
 *
 * Type: boolean
 *
 * If enabled the code won't start until you open the serial port
 * monitor or otherwise connect to the serial port.
 *
 * This is useful to have defined when using the device with the
 * Arduino IDE, but when you want to use it with a plant you don't
 * want this to be set.
 */

#ifndef WAIT_FOR_SERIAL_BEFORE_STARING
#define WAIT_FOR_SERIAL_BEFORE_STARING 1
#endif

#if WAIT_FOR_SERIAL_BEFORE_STARING == 0
#undef WAIT_FOR_SERIAL_BEFORE_STARING
#endif

/*******************************************************************************
 * Persistent configuration: PERSISTENT_CONFIGURATION_SUPPORT
 *
 * Type: boolean
 *
 * If enabled the settings for each sensor will be persisted in EEPROM
 */

#ifndef PERSISTENT_CONFIGURATION_SUPPORT
#define PERSISTENT_CONFIGURATION_SUPPORT 1
#endif

#if PERSISTENT_CONFIGURATION_SUPPORT == 0
#undef PERSISTENT_CONFIGURATION_SUPPORT
#endif

/*******************************************************************************
 * Use low power mode: USE_LOW_POWER_MODE
 *
 * Type: boolean
 *
 * If enabled the device will try to use as little power as possible.
 *
 * Not fully functional yet so it is disabled by default.
 */

// Disabled by default for now

#if USE_LOW_POWER_MODE == 0
#undef USE_LOW_POWER_MODE
#endif

/*******************************************************************************
 * Debug sink: DEBUG_SINK
 *
 * Selects where all debug logging will go.
 *
 * Values:
 *  0: no logging, all logging is discarded
 *  1: Use Serial. Uses the platforms default Serial port, usually the USB or hardware serial ports on your board.
 *  2: Use Software serial
 */

#ifndef DEBUG_SINK
// Default to Serial
#define DEBUG_SINK 1
#endif

/*******************************************************************************
 * Board specific sanity checks
 */

#ifdef __AVR_ATtiny85__

#ifdef PERSISTENT_CONFIGURATION_SUPPORT
#warning PERSISTENT_CONFIGURATION_SUPPORT is not implemented for ATtiny85-based boards
#undef PERSISTENT_CONFIGURATION_SUPPORT
#endif

#ifdef USE_LOW_POWER_MODE
#warning USE_LOW_POWER_MODE is not implemented for ATtiny85-based boards.
#undef USE_LOW_POWER_MODE
#endif

#if DEBUG_SINK != 0 && DEBUG_SINK != 2
#warning DEBUG_SINK must be 0 or 2 on ATTiny85 boards
#undef DEBUG_SINK
#define DEBUG_SINK 1
#endif

#endif // __AVR_ATtiny85__

#endif