aboutsummaryrefslogtreecommitdiff
path: root/quantum/send_string.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/send_string.h')
-rw-r--r--quantum/send_string.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/quantum/send_string.h b/quantum/send_string.h
new file mode 100644
index 000000000..570522eb0
--- /dev/null
+++ b/quantum/send_string.h
@@ -0,0 +1,47 @@
1/* Copyright 2021
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <stdint.h>
18
19#include "progmem.h"
20#include "send_string_keycodes.h"
21
22#define SEND_STRING(string) send_string_P(PSTR(string))
23#define SEND_STRING_DELAY(string, interval) send_string_with_delay_P(PSTR(string), interval)
24
25// Look-Up Tables (LUTs) to convert ASCII character to keycode sequence.
26extern const uint8_t ascii_to_keycode_lut[128];
27extern const uint8_t ascii_to_shift_lut[16];
28extern const uint8_t ascii_to_altgr_lut[16];
29extern const uint8_t ascii_to_dead_lut[16];
30
31// clang-format off
32#define KCLUT_ENTRY(a, b, c, d, e, f, g, h) \
33 ( ((a) ? 1 : 0) << 0 \
34 | ((b) ? 1 : 0) << 1 \
35 | ((c) ? 1 : 0) << 2 \
36 | ((d) ? 1 : 0) << 3 \
37 | ((e) ? 1 : 0) << 4 \
38 | ((f) ? 1 : 0) << 5 \
39 | ((g) ? 1 : 0) << 6 \
40 | ((h) ? 1 : 0) << 7 )
41// clang-format on
42
43void send_string(const char *str);
44void send_string_with_delay(const char *str, uint8_t interval);
45void send_string_P(const char *str);
46void send_string_with_delay_P(const char *str, uint8_t interval);
47void send_char(char ascii_code);