]> git.scottworley.com Git - tattlekey/blame - client/config.h
client: Change wire format!: Expand `ago` field: 16 bits → 32 bits
[tattlekey] / client / config.h
CommitLineData
a4a617fd
SW
1/* tattlekey: A one-key UDP keyboard
2 * Copyright (C) 2023 Scott Worley <scottworley@scottworley.com>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
fbc57595
SW
18#ifndef CONFIG_H
19#define CONFIG_H
20
1e0a316e
SW
21#include "lwip/arch.h"
22
1d699cc3 23/* Wi-Fi credentials */
e8a53974
SW
24extern const char config_wifi_ssid[];
25extern const char config_wifi_pass[];
fbc57595 26
1d699cc3 27/* Network address of the server to contact */
e8a53974
SW
28extern const char config_tattle_server_ip_address[];
29extern const u16_t config_tattle_port;
1e0a316e 30
1d699cc3 31/* For distinguishing reports from multiple tattlekey devices. */
e8a53974 32extern const u16_t config_this_tattler_identity;
1e0a316e 33
d1521eda
SW
34/* Which GPIO pin is the button connected to?
35 * The button should span this pin and ground, connecting this pin to ground
36 * when pressed.
37 * https://projects.raspberrypi.org/en/projects/introduction-to-the-pico/10
38 * recommends pins 18, 22, or 28. */
e8a53974 39extern const uint config_button_pin;
d1521eda 40
2f7a1e89
SW
41/* Don't bother reporting each separate button press when it is pressed many
42 * times in short succession. (We also use this to de-bounce. :) */
e8a53974 43extern const u32_t config_minimum_seconds_between_button_presses;
2f7a1e89 44
24ed3618
SW
45/* Send each report multiple times. Re-sends are sent with exponential delay:
46 * #1 sent immediately
47 * #2 after 1 seconds
48 * #3 after 2 seconds
49 * #4 after 4 seconds
50 * #5 after 8 seconds
51 * ...
52 * #11 after 8 minutes
53 * #12 after 17 minutes
54 * #13 after 34 minutes
55 * #14 after 68 minutes
56 * #15 after 2 hours
57 * #16 after 4 hours
58 * #17 after 9 hours
59 * etc.
60 * This provides some robustness against network outages, automatically
61 * replaying the log periodically to be collected after connectivity
9266b741 62 * is restored. */
e8a53974 63extern const uint config_resend_count;
ff379463 64
a36c278f
SW
65/* These control the size of the per-send-count press queues.
66When the button is pressed more than config_maximum_queue_size times
67within the resend interval, some presses will be reported fewer
68than config_resend_count times. This is usually fine because it's
69the old, longest-delyed, most-redundant reports that get dropped;
70fresh, timely reports of new button presses will not get anywhere near
71config_resend_count in a resend interval because the early resend interals
72are so short. */
e8a53974 73extern const uint config_maximum_queue_size;
a36c278f
SW
74
75/* This is paranoia about unanticipated delays. Setting this to zero
76would pobably be fine, but imposing a minimum queue size is an easy
77safety measure. */
e8a53974 78extern const uint config_minimum_queue_size;
a36c278f 79
fbc57595 80#endif