diff options
author | Konstantin Đorđević <[email protected]> | 2019-02-11 23:21:41 +0100 |
---|---|---|
committer | Konstantin Đorđević <[email protected]> | 2019-03-02 15:15:55 +0100 |
commit | ddb0f39ebf317c7a23c69ed45efb1882746a01b0 (patch) | |
tree | 1395072c58d02ebcda3d87c0c28401581695062c /users/konstantin/unicode.h | |
parent | 2f07627a5dd38ab1370804f4feb1972250928803 (diff) | |
download | qmk_firmware-ddb0f39ebf317c7a23c69ed45efb1882746a01b0.tar.gz qmk_firmware-ddb0f39ebf317c7a23c69ed45efb1882746a01b0.zip |
Generate UNICODE and UNICODEMAP constants using macros
Diffstat (limited to 'users/konstantin/unicode.h')
-rw-r--r-- | users/konstantin/unicode.h | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/users/konstantin/unicode.h b/users/konstantin/unicode.h index 09af7e1c7f..d76f2a1700 100644 --- a/users/konstantin/unicode.h +++ b/users/konstantin/unicode.h @@ -2,10 +2,33 @@ #include "quantum.h" -#define COMMA UC(0x002C) -#define L_PAREN UC(0x0028) -#define R_PAREN UC(0x0029) -#define EQUALS UC(0x003D) -#define TIMES UC(0x00D7) -#define DIVIDE UC(0x00F7) -#define MINUS UC(0x2212) +#define FOREACH_UNICODE(M) \ + M(COMMA, 0x002C) \ + M(L_PAREN, 0x0028) \ + M(R_PAREN, 0x0029) \ + M(EQUALS, 0x003D) \ + M(TIMES, 0x00D7) \ + M(DIVIDE, 0x00F7) \ + M(MINUS, 0x2212) + +#define UC_KEYCODE(name, code) name = UC(code), + +#define X_NAME(name, code) X_ ## name, +#define X_ENTRY(name, code) [X_ ## name] = code, +#define X_KEYCODE(name, code) name = X(X_ ## name), + +#if defined(UNICODE_ENABLE) + enum unicode_keycodes { + FOREACH_UNICODE(UC_KEYCODE) + }; +#elif defined(UNICODEMAP_ENABLE) + enum unicode_names { + FOREACH_UNICODE(X_NAME) + }; + + extern const uint32_t PROGMEM unicode_map[]; + + enum unicode_keycodes { + FOREACH_UNICODE(X_KEYCODE) + }; +#endif |