-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.h
110 lines (81 loc) · 2.75 KB
/
config.h
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
#pragma once
/*
* Copyright (C) 2024 Patrick Pedersen
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config_enums.h"
#define ANY_MODE_ON_OFF (MODE == MODE_ON_OFF || MODE == MODE_ON_OFF_INVERTED)
////////////////////////////////////////////
// Debug Configuration
////////////////////////////////////////////
#define DEBUG 0
////////////////////////////////////////////
// WiFi configuration
////////////////////////////////////////////
#define WIFI_SSID "YOUR SSID"
#define WIFI_PSK "YOUR PSK"
#define TCP_PORT 8080
#define CLIENT_TIMEOUT 30 * 1000 // ms
#define USE_STATIC_IP // Comment out for DHCP
// Only needs to be set if USE_STATIC_IP defined
#ifdef USE_STATIC_IP
#define STATIC_IP "192.168.1.10"
#define GATEWAY "192.168.1.1"
#define SUBNET "255.255.255.0"
#endif
////////////////////////////////////////////
// Push Button/Switch Configuration
////////////////////////////////////////////
#define PHYSICAL_INPUT PHYS_SWITCH // PHYS_BUTTON, PHYS_SWITCH or comment out if not used
#define PHYSICAL_PIN 4
#if PHYSICAL_INPUT == PHYS_BUTTON
#define DEBOUNCE_TIME 20 // ms
#define SAMPLES 10
#endif
////////////////////////////////////////////
// Action Configuration
////////////////////////////////////////////
#define ACTION_PIN 5
/**
* Possible values:
* - MODE_ON_OFF
* - MODE_ON_OFF_INVERTED
* - MODE_TOGGLE
* - MODE_PULSE_LOW
* - MODE_PULSE_HIGH
*/
#define MODE MODE_ON_OFF_INVERTED
////////////////////////////////////////////
// ON/OFF Mode Configuration
////////////////////////////////////////////
#if ANY_MODE_ON_OFF
// TCP Messages
#define TCP_OFF_DATA 0x00
#define TCP_ON_DATA 0x01
#define TCP_GET_STATE 0x03
// Boot state
#define BOOT_STATE OFF
////////////////////////////////////////////
// Toggle Mode Configuration
////////////////////////////////////////////
#elif MODE == MODE_TOGGLE
#define TCP_TOGGLE_DATA 0x01
#define BOOT_STATE 1 // 0: OFF, 1: ON
////////////////////////////////////////////
// Pulse Mode Configuration
////////////////////////////////////////////
#elif MODE == MODE_PULSE_LOW || MODE == MODE_PULSE_HIGH
#define TCP_PULSE_DATA 0x01
#define PULSE_TIME 250 // ms
#else
#error "No mode selected"
#endif