e12
 
Loading...
Searching...
No Matches
e12_variants.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 e12.io
3 * All rights reserved.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19#ifndef H_E12_VARIANTS
20#define H_E12_VARIANTS
21
22#ifdef ARDUINO_SAMD_ZERO //__SAMD21__
23#warning "SAMD21 detected"
24#define Serial SerialUSB
25#define E12_INTR_PIN 3
26#define WAKEUP_INTR_PIN 2
27#define ONE_WIRE_BUS 4
28#elif ARDUINO_RASPBERRY_PI_PICO
29#define E12_INTR_PIN 2
30#define WAKEUP_INTR_PIN 22
31#define ONE_WIRE_BUS 15
32#include "pico/stdlib.h" // For standard functions
33#include "pico/time.h" // Specifically for repeating timers
34#elif defined(ARDUINO_AVR_UNO) // Standard Arduino Uno (ATmega328P)
35#warning "Standard Uno AVR detected"
36#define E12_INTR_PIN 2
37#define WAKEUP_INTR_PIN 3
38#define ONE_WIRE_BUS 4
39#else
40#endif
41
42#ifdef __AVR__
43#define NODE_DEBUG 0
44#else
45#define NODE_DEBUG 1
46#endif
47
48
49#if NODE_DEBUG
50#define E12_PRINT(x) Serial.print(F(x))
51#define E12_PRINTLN(x) Serial.println(F(x))
52#define E12_PRINT_F(format, ...) \
53 { \
54 char buf[64]; \
55 snprintf_P(buf, sizeof(buf), PSTR(format), ##__VA_ARGS__); \
56 Serial.println(buf); \
57 }
58#else
59// On Uno, these consume ZERO RAM and ZERO Flash
60#define E12_PRINT(x)
61#define E12_PRINTLN(x)
62#define E12_PRINT_F(format, ...)
63#endif
64
65#endif