aboutsummaryrefslogtreecommitdiff
path: root/main/config.def.h
blob: 1ec8a5c6c8f471c4dd7309e28a29222411b25b92 (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
#pragma once
#include <pico/cyw43_arch.h>
#include <cyw43_country.h>

/**
 * \ingroup main
 * \defgroup main_config Config
 * \brief Configuration options
 *
 * The main controller firmware is configured statically (i.e. through
 * compile-time defined options). Because the configuration is likely to
 * contain Wi-Fi credentials, this file is not tracked under version control.
 *
 * Before compiling the main controller fimrware, a file (`config.h`) must be
 * created by the user with the following format:
 *
 * ```c
 * #pragma once
 *
 * // define non-default options here
 *
 * #include "config.def.h"
 * ```
 *
 * \note `config.def.h` contains preprocessor logic that tries to ensure a
 * correct configuration. The default configuration has the following settings:
 * - Wi-Fi is disabled (prints a warning during compilation because it was not
 *   explicitly disabled by the user)
 * - The TCP server is disabled (due to Wi-Fi being disabled)
 *
 * \note The exact default values of each configuration option, and all
 * available options are listed below.
 *
 * \{
 */

/**
 * \name Network (Wi-Fi) configuration
 * \{
 */
#ifndef CFG_NET_SSID
/**
 * \brief Network name (SSID)
 * \note Not defining \c CFG_NET_SSID will implicitly enable \c CFG_NET_DISABLE
 */
#define CFG_NET_SSID ""
#ifndef CFG_NET_DISABLE
/**
 * \brief Disable network communication completely
 * \note Enabling this option will implicitly enable \c CFG_SRV_DISABLE
 */
#define CFG_NET_DISABLE
#warning No SSID defined! Disabling network communication!
#endif
#endif

#ifndef CFG_NET_PASS
//! Network password
#define CFG_NET_PASS ""
#endif

#ifndef CFG_NET_AUTH
//! Network security type
#define CFG_NET_AUTH CYW43_AUTH_OPEN
#endif

#ifndef CFG_NET_CONN_TIMEOUT
//! Max duration (milliseconds) for establishing Wi-Fi connection
#define CFG_NET_CONN_TIMEOUT 10e3
#endif

#ifdef CFG_NET_DISABLE
#undef CFG_NET_COUNTRY
//! Radio communications country
#define CFG_NET_COUNTRY CYW43_COUNTRY_WORLDWIDE
#endif
#ifndef CFG_NET_COUNTRY
#define CFG_NET_COUNTRY CYW43_COUNTRY_NETHERLANDS
#endif
/// \}

/**
 * \name TCP server configuration
 * \{
 */
#ifndef CFG_SRV_PORT
//! TCP server port
#define CFG_SRV_PORT 9191
#endif
#ifdef CFG_NET_DISABLE
//! Disable the TCP server
#define CFG_SRV_DISABLE
#endif
/// \}

/**
 * \name I2C configuration
 * \{
 */
#ifndef CFG_SDA0_PIN
//! I2C 0 SDA pin
#define CFG_SDA0_PIN 16
#endif
#ifndef CFG_SCL0_PIN
//! I2C 0 SCL pin
#define CFG_SCL0_PIN 17
#endif
#ifndef CFG_SDA1_PIN
//! I2C 1 SDA pin
#define CFG_SDA1_PIN 18
#endif
#ifndef CFG_SCL1_PIN
//! I2C 1 SCL pin
#define CFG_SCL1_PIN 19
#endif
/// \}

/**
 * \name Auxiliary options
 * \{
 */
#ifndef CFG_LED_PIN
//! Status LED pin
#define CFG_LED_PIN CYW43_WL_GPIO_LED_PIN
#endif
#ifndef CFG_PB_MOD_MAX
//! Maximum number of simultaniously connected puzzle modules
#define CFG_PB_MOD_MAX 8
#endif
/// \}

/// \}