From c85dfd2aa6d1bf0423974eadfaf3c2dd543410f2 Mon Sep 17 00:00:00 2001 From: Ben Blazak Date: Tue, 8 Jan 2013 19:05:26 -0800 Subject: [PATCH] intermediate checkin: LOTS of things still changing --- TODO | 3 - doc/references.md | 7 + firmware/keyboard.h | 402 +++++++++------- .../keyboard/ergodox/controller/mcp23018.md | 2 +- .../keyboard/ergodox/controller/teensy-2-0.md | 2 +- .../ergodox/layout/qwerty-kinesis-mod.c | 135 ++++++ firmware/keyboard/ergodox/matrix.h | 93 ++++ firmware/lib/from-pjrc/readme.md | 10 - .../lib/from-pjrc/usb_keyboard/usb_keyboard.h | 44 +- firmware/lib/layout/key-functions.h | 176 +++++++ firmware/lib/layout/keys.h | 225 +++++++++ firmware/lib/usb/TODO/TODO.c | 2 +- firmware/lib/usb/TODO/common.h | 2 +- ...s from hid device class definition 1.11.md | 2 +- ...sb 2.0 spec sec 9 (usb device framework).h | 2 +- firmware/lib/usb/usage-page/keyboard.h | 452 +++++++++--------- .../lib/usb/usage-page/keyboard/short-names.h | 315 ------------ firmware/lib/usb/usage-page/led.h | 166 +++---- firmware/options.mk | 3 +- firmware/readme.md | 99 ++-- 20 files changed, 1285 insertions(+), 857 deletions(-) delete mode 100644 TODO create mode 100644 firmware/keyboard/ergodox/layout/qwerty-kinesis-mod.c create mode 100644 firmware/keyboard/ergodox/matrix.h delete mode 100644 firmware/lib/from-pjrc/readme.md create mode 100644 firmware/lib/layout/key-functions.h create mode 100644 firmware/lib/layout/keys.h delete mode 100644 firmware/lib/usb/usage-page/keyboard/short-names.h diff --git a/TODO b/TODO deleted file mode 100644 index 889c02d..0000000 --- a/TODO +++ /dev/null @@ -1,3 +0,0 @@ -- rewrite/rework 'references.md' -- write 'firmware/coding-conventions.md' - diff --git a/doc/references.md b/doc/references.md index b80acf9..61938de 100644 --- a/doc/references.md +++ b/doc/references.md @@ -1,3 +1,5 @@ + + # References @@ -113,6 +115,11 @@ (http://stackoverflow.com/questions/4606301/gcc-why-the-lm-flag-is-needed-to-link-the-math-library) (on ) +* [cdecl] + (http://cdecl.org) + Nice little web interface to a really helpful (when you're dealing with + confusing type signatures in C) command line program. + ### C++ Stuff * [Google C++ Style Guide] diff --git a/firmware/keyboard.h b/firmware/keyboard.h index f27615f..e3e35bf 100644 --- a/firmware/keyboard.h +++ b/firmware/keyboard.h @@ -1,11 +1,14 @@ /* ---------------------------------------------------------------------------- * Copyright (c) 2012 Ben Blazak - * Released under The MIT License (MIT) (see "license.md") + * Released under The MIT License (see "license.md") * Project located at * ------------------------------------------------------------------------- */ /** - * - file description: The keyboard interface + * - description: | + * The keyboard interface, and related definitions + * + * Prefix: `kb__` */ @@ -14,14 +17,38 @@ // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- + #include #include +#include + +#include "../firmware/lib/layout/key-functions.h" + +// ---------------------------------------------------------------------------- + +#if MAKE__KEYBOARD == 'ergodox' + + #define KB__ROWS 6 + #define KB__COLUMNS 14 + +#endif + +// ---------------------------------------------------------------------------- + +typedef struct { + kf__function_pointer_t press_function; + uint16_t press_value; + kf__function_pointer_t release_function; + uint16_t release_value; +} kb__key_t; + +typedef const kb__key_t * const PROGMEM kb__key_pointer_t // ---------------------------------------------------------------------------- // controller int8_t kb__init (void); -int8_t kb__update_matrix (bool matrix[MAKE__KB_ROWS][MAKE__KB_COLUMNS]); +int8_t kb__update_matrix (bool matrix[KB__ROWS][KB__COLUMNS]); // LED void kb__led__on (int8_t led); @@ -32,175 +59,220 @@ void kb__led__all_on (void); void kb__led__all_off (void); void kb__led__all_set (float n); // ------- -void kb__led_state__power_on (void); -void kb__led_state__ready (void); -void kb__led_delay__usb_init (void); +void kb__led__state__power_on (void); +void kb__led__state__ready (void); +void kb__led__delay__usb_init (void); // layout void kb__led__logical_on (char led); void kb__led__logical_off (char led); // ------- -// TODO -// struct main__key kb__layout__get_key ( uint8_t layer, uint8_t row, uint8_t column ); - -// ---------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// documentation : functions -------------------------------------------------- -// ---------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// controller ----------------------------------------------------------------- - -/** - * - function: - * name: kb__init - * description: Initialize the keyboard. - * return value: - * type: int8_t - * values: - * - { name: 0, description: success } - * - { name: '[other]', description: error } - * notes: - * - Should be called exactly once by `main()` before entering the run - * loop. - * - * - function: - * name: kb__update_matrix - * description: - * Update the given matrix to the current state of the keyboard. - * arguments: - * - type: bool[][] - * name: matrix - * description: A pointer to the matrix to update. - * notes: - * - Matrix dimensions are `[MAKE__KB_ROWS][MAKE__KB_COLUMNS]`. - * return value: - * type: int8_t - * values: - * - { name: 0, description: success } - * - { name: '[other]', description: error } - */ - -// ---------------------------------------------------------------------------- -// LED ------------------------------------------------------------------------ - -/** - * - .ignore: - * - * - &kb__led___int8_t__led - * type: int8_t - * name: led - * description: - * The number of the LED to set. Should an integer between 1 and 5 - * inclusive; behavior is undefined otherwise. - * notes: - * - For US keyboards, likely only LEDs 1 through 3 will be present. But - * the function should handle 4 through 5 gracefully anyway. - * - * - &kb__led___float__n - * type: float - * name: n - * description: - * The percent of the highest possible brightness at which to set the - * LED. Should be a float between 0 and 1 inclusive; behavior is - * undefined otherwise. - */ - -/** - * - function: - * name: kb__led__on - * description: Set the given LED 'on'. - * arguments: - * - *kb__led___int8_t__led - * - * - function: - * name: kb__led__off - * description: Set the given LED 'off'. - * arguments: - * - *kb__led___int8_t__led - * - * - function: - * name: kb__led__set - * description: Set the given LED's brightness (by percent). - * arguments: - * - *kb__led___int8_t__led - * - *kb__led___float__n - */ - -/** - * - function: - * name: kb__led__all_on - * description: Set all the LEDs 'on'. - * - * - function: - * name: kb__led__all_off - * description: Set all the LEDs 'off'. - * - * - function: - * name: kb__led__all_set - * description: Set all the LEDs brightness (by percent). - * arguments: - * - *kb__led___float__n - */ - -/** - * - function: - * name: kb__led_state__power_on - * description: - * Set the LEDs to the state that indicates the keyboard just powered on. - * - * - function: - * name: kb__led_state__ready - * description: - * Set the LEDs to the state that indicates the keyboard is ready to - * receive keystrokes. - * - * - function: - * name: kb__led_delay__usb_init - * description: - * Delay for a total of ~1 second, to allow the host to load drivers and - * such. - */ - -// ---------------------------------------------------------------------------- -// layout --------------------------------------------------------------------- - -/** - * - .ignore: - * - * - &kb__led__logical___arguments - * - type: char - * name: led - * values: - * - { name: N, description: numlock } - * - { name: C, description: capslock } - * - { name: S, description: scroll lock } - * - { name: O, description: compose } - * - { name: K, description: kana } - */ - -/** - * - function: - * name: kb__led__logical_on - * description: - * Set LEDs on based on their meaning (e.g. 'numlock', 'capslock'). - * arguments: *kb__led__logical___arguments - * - * - function: - * name: kb__led__logical_off - * description: - * Set LEDs off based on their meaning (e.g. 'numlock', 'capslock'). - * arguments: *kb__led__logical___arguments - */ - -/** - * # TODO - * - function: - * name: kb__layout__get_key - */ +void kb__layout__exec_key ( bool pressed, + int8_t layer, + int8_t row, + int8_t column ); // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- #endif // ERGODOX_FIRMWARE__FIRMWARE__KEYBOARD__H + + +// TODO: rewrite, coz of changes +/** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # documentation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # macros ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-- + + - macro: + name: '`KB__ROWS`' + values: + - { name: '`6`', description: for the ErgoDox } + + - macro: + name: '`KB__COLUMNS`' + values: + - { name: '`14`', description: for the ErgoDox } + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # typedefs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - typedef: + type: '`struct`' + name: '`kb__key_t`' + description: The type of each key in the layout matrix. + values: + - type: '`uint8_t`' + name: '`value`' + description: + The value passed to the appropriate function when the key changes + state. The function may do as it wishes with this value, but it + will most commonly be a keycode to send to the host. + - type: '`kf__function_pointer_t`' + name: '`press`' + description: + The function to call when the key changes from 'released' to + 'pressed'. + - type: '`kf__function_pointer_t`' + name: '`release`' + description: + The function to call when the key changes from 'pressed' to + 'released'. + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + # controller ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- + + - function: + name: '`kb__init`' + description: Initialize the keyboard. + return value: + type: '`int8_t`' + values: + - { name: '`0`', description: success } + - { name: '[other]', description: error } + notes: + - Should be called exactly once by `main()` before entering the run + loop. + + - function: + name: '`kb__update_matrix`' + description: + Update the given matrix to the current state of the keyboard. + arguments: + - type: '`bool[][]`' + name: '`matrix`' + description: A pointer to the matrix to update. + notes: + - Matrix dimensions are `[KB__ROWS][KB__COLUMNS]`. + return value: + type: '`int8_t`' + values: + - { name: '`0`', description: success } + - { name: '[other]', description: error } + + # LED ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-- + + - .ignore: + + - &kb__led___int8_t__led + type: '`int8_t`' + name: '`led`' + description: + The number of the LED to set. Should an integer between 1 and 5 + inclusive; behavior is undefined otherwise. + notes: + - For US keyboards, likely only LEDs 1 through 3 will be present. But + the function should handle 4 through 5 gracefully anyway. + + - &kb__led___float__n + type: '`float`' + name: '`n`' + description: + The percent of the highest possible brightness at which to set the + LED. Should be a float between 0 and 1 inclusive; behavior is + undefined otherwise. + + # ~~~~~~~ + + - function: + name: '`kb__led__on`' + description: Set the given LED 'on'. + arguments: + - *kb__led___int8_t__led + + - function: + name: '`kb__led__off`' + description: Set the given LED 'off'. + arguments: + - *kb__led___int8_t__led + + - function: + name: '`kb__led__set`' + description: Set the given LED's brightness (by percent). + arguments: + - *kb__led___int8_t__led + - *kb__led___float__n + + # ~~~~~~~ + + - function: + name: '`kb__led__all_on`' + description: Set all the LEDs 'on'. + + - function: + name: '`kb__led__all_off`' + description: Set all the LEDs 'off'. + + - function: + name: '`kb__led__all_set`' + description: Set all the LEDs brightness (by percent). + arguments: + - *kb__led___float__n + + # ~~~~~~~ + + - function: + name: '`kb__led__state__power_on`' + description: + Set the LEDs to the state that indicates the keyboard just powered on. + + - function: + name: '`kb__led__state__ready`' + description: + Set the LEDs to the state that indicates the keyboard is ready to + receive keystrokes. + + - function: + name: '`kb__led__delay__usb_init`' + description: + Delay for a total of ~1 second, to allow the host to load drivers and + such. + + # layout ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-- + + - .ignore: + + - &kb__led__logical___arguments + - type: '`char`' + name: '`led`' + values: + - { name: '`N`', description: numlock } + - { name: '`C`', description: capslock } + - { name: '`S`', description: scroll lock } + - { name: '`O`', description: compose } + - { name: '`K`', description: kana } + + # ~~~~~~~ + + - function: + name: '`kb__led__logical_on`' + description: + Set LEDs on based on their meaning (e.g. 'numlock', 'capslock'). + arguments: *kb__led__logical___arguments + + - function: + name: '`kb__led__logical_off`' + description: + Set LEDs off based on their meaning (e.g. 'numlock', 'capslock'). + arguments: *kb__led__logical___arguments + + # ~~~~~~~ + + - function: + name: '`kb__layout__get_key`' + description: + Look up and return the contents of the layout matrix at the given + point. + arguments: + - { type: '`uint8_t`', name: '`layer`' } + - { type: '`uint8_t`', name: '`row`' } + - { type: '`uint8_t`', name: '`column`' } + return value: + type: '`kb__key_t`' + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **/ + diff --git a/firmware/keyboard/ergodox/controller/mcp23018.md b/firmware/keyboard/ergodox/controller/mcp23018.md index 7d25328..6fec4d9 100644 --- a/firmware/keyboard/ergodox/controller/mcp23018.md +++ b/firmware/keyboard/ergodox/controller/mcp23018.md @@ -143,6 +143,6 @@ ------------------------------------------------------------------------------- Copyright © 2012 Ben Blazak -Released under The MIT License (MIT) (see "license.md") +Released under The MIT License (see "license.md") Project located at diff --git a/firmware/keyboard/ergodox/controller/teensy-2-0.md b/firmware/keyboard/ergodox/controller/teensy-2-0.md index 488d19d..b4a5f49 100644 --- a/firmware/keyboard/ergodox/controller/teensy-2-0.md +++ b/firmware/keyboard/ergodox/controller/teensy-2-0.md @@ -143,6 +143,6 @@ ------------------------------------------------------------------------------- Copyright © 2012 Ben Blazak -Released under The MIT License (MIT) (see "license.md") +Released under The MIT License (see "license.md") Project located at diff --git a/firmware/keyboard/ergodox/layout/qwerty-kinesis-mod.c b/firmware/keyboard/ergodox/layout/qwerty-kinesis-mod.c new file mode 100644 index 0000000..06b6e2d --- /dev/null +++ b/firmware/keyboard/ergodox/layout/qwerty-kinesis-mod.c @@ -0,0 +1,135 @@ +/* ---------------------------------------------------------------------------- + * Copyright (c) 2013 Ben Blazak + * Released under The MIT License (see "license.md") + * Project located at + * ------------------------------------------------------------------------- */ + +/** + * - description: | + * A QWERTY layout adapted from the default Kinesis layout. + */ + + +#include +#include +#include "../../../../firmware/lib/layout/key-functions.h" +#include "../../../../firmware/lib/usb/usage-page/keyboard.h" +#include "../../../../firmware/keyboard.h" +#include "../../../../firmware/keyboard/ergodox/matrix.h" + + +// ---------------------------------------------------------------------------- +// layout +// ---------------------------------------------------------------------------- + +#define KEY_T const kb__key_t * const PROGMEM + +#define KEYS__DEFAULT(name, value) \ + KEY_T name = { \ + .press_function = &kf__press, \ + .press_value = value, \ + .release_function = &kf__release, \ + .release_value = value, \ + } + +#define KEYS__SHIFTED(name, value) \ + const uint16_t PROGMEM name##__press[] = { 2, \ + &kf__press, KEY__LeftShift, \ + &kf__press, value }; \ + const uint16_t PROGMEM name##__release[] = { 2, \ + &kf__release, KEY__LeftShift, \ + &kf__release, value }; \ + KEY_T name = { &kf__macro, &name##__press, \ + &kf__macro, &name##__release } + +// ---------------------------------------------------------------------------- + +// TODO +// - finish transcribing layout + +// include default key definitions +#include "../../../../firmware/lib/layout/keys.h" + +// special meaning +KEY_T Transp = NULL; // transparent +KEY_T NA = { NULL, 0, NULL, 0 }; // do nothing +// special function +KEYS__DEFAULT( Power, KEY__Power ); +KEYS__DEFAULT( VolumeU, KEY__VolumeUp ); +KEYS__DEFAULT( VolumeD, KEY__VolumeDown ); +KEYS__DEFAULT( Mute, KEY__Mute ); +// layer +KEY_T L0pu1 = { &kf__layer__push, 0x01, NULL, 0 }; +KEY_T L0po = { &kf__layer__pop, 0x0, NULL, 0 }; +KEY_T L0pu1po = { &kf__layer__push, 0x01, &kf__layer__pop, 0x0 }; +KEY_T L1pu2po = { &kf__layer__push, 0x12, &kf__layer__pop, 0x1 }; +KEY_T L2pu3 = { &kf__layer__push, 0x23, NULL, 0 }; +KEY_T L2po = { &kf__layer__pop, 0x2, NULL, 0 }; + + +// ---------------------------------------------------------------------------- + +KEY_T layout[][KB__ROWS][KB__COLUMNS] = { +// ---------------------------------------------------------------------------- + MATRIX__LAYER( // layer 0 : default +// unused +NA, +// left hand ...... ......... ......... ......... ......... ......... ......... + Equal, K1, K2, K3, K4, K5, Esc, + Bkslash, Q, W, E, R, T, L0pu1, + Tab, A, S, D, F, G, + ShiftL, Z, X, C, V, B, L0pu1po, + GUIL, Grave, Bkslash, ArrowL, ArrowR, + CtrlL, AltL, + NA, NA, Home, + Bs, Del, End, +// right hand ..... ......... ......... ......... ......... ......... ......... + L2pu3, K6, K7, K8, K9, K0, Dash, + BrktL, Y, U, I, O, P, BrktR, + H, J, K, L, Semicol, Slash, + L0pu1po, N, M, Comma, Period, Slash, ShiftR, + ArrowL, ArrowD, ArrowU, ArrowR, GUIR, + AltR, CtrlR, + PageU, Nothing, NA, + PageD, Enter, Space ), +// ---------------------------------------------------------------------------- + MATRIX__LAYER( // layer 1 : function and symbol keys +// TODO: still checking this, especially for shifted keys +// unused +NA, +// left hand ...... ......... ......... ......... ......... ......... ......... + NA, F1, F2, F3, F4, F5, F11, + Transp, BraceL, BraceR, BrktL, BrktR, NA, L0po, + Transp, Semicol, Slash, Dash, KP0, Semicol, + Transp, KP6, KP7, KP8, KP9, Equal, L1pu2po, + Transp, Transp, Transp, Transp, Transp, + Transp, Transp, + Transp, Transp, Transp, + Transp, Transp, Transp, +// right hand ..... ......... ......... ......... ......... ......... ......... + F12, F6, F7, F8, F9, F10, Power, + Transp, NA, Dash, Comma, Period, Dollar, VolumeU, + Bkslash, KP1, ParenL, ParenR, Equal, VolumeD, + L1pu2po, Asterisk, KP2, KP3, KP4, KP5, Mute, + Transp, Transp, Transp, Transp, Transp, + Transp, Transp, + Transp, Transp, Transp, + Transp, Transp, Transp ), +}; + + +// ---------------------------------------------------------------------------- +// LED control +// ---------------------------------------------------------------------------- + +// TODO +// - also, should this be moved to its own file? + + +// ---------------------------------------------------------------------------- +// matrix control +// ---------------------------------------------------------------------------- + +// TODO +// - also, should this be moved to its own file? + diff --git a/firmware/keyboard/ergodox/matrix.h b/firmware/keyboard/ergodox/matrix.h new file mode 100644 index 0000000..93c0512 --- /dev/null +++ b/firmware/keyboard/ergodox/matrix.h @@ -0,0 +1,93 @@ +/* ---------------------------------------------------------------------------- + * Copyright (c) 2012, 2013 Ben Blazak + * Released under The MIT License (see "license.md") + * Project located at + * ------------------------------------------------------------------------- */ + +/** + * - description: | + * Information about the matrix + * + * Prefix: `MATRIX__` + */ + + +#ifndef ERGODOX_FIRMWARE__FIRMWARE__KEYBOARD__ERGODOX__MATRIX_H +#define ERGODOX_FIRMWARE__FIRMWARE__KEYBOARD__ERGODOX__MATRIX_H +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- + + +/** + * - macro: + * name: '`MATRIX__LAYER`" + * description: | + * Mapping from spatial position to matrix position. + * + * - Spatial position: Where the key is spatially, relative to other + * keys, both on the keyboard and in the layout. + * - Matrix position: The coordinate in the matrix to which a key is + * scanned by the update functions. + * + * - Location numbers are in the format `row##column`, where both 'row' + * and 'column' are single digit hex numbers corresponding to the + * matrix position (which also corresponds to the row and column pin + * labels used in the Teensy and MCP23018 files). + * + * - Coordinates: + * - optional keys + * k15, k16 (left hand thumb group) + * k17, k18 (right hand thumb group) + * - unused keys + * k36, k00 (left hand) + * k37, k0D (right hand) + * notes: + * - | + * ``` + * --- other info ------------------------------------- + * rows x columns = positions; used, unused + * per hand: 6 x 7 = 42; 40, 2 + * total: 6 x 14 = 84; 80, 4 + * + * left hand : rows 0..5, cols 0..6 + * right hand : rows 0..5, cols 7..D + * ---------------------------------------------------- + * ``` + */ +#define MATRIX__LAYER( \ + /* for unused positions */ \ + na, \ + \ + /* left hand, spatial positions */ \ + k50,k51,k52,k53,k54,k55,k56, \ + k40,k41,k42,k43,k44,k45,k46, \ + k30,k31,k32,k33,k34,k35, \ + k20,k21,k22,k23,k24,k25,k26, \ + k10,k11,k12,k13,k14, \ + k05,k06, \ + k15,k16,k04, \ + k03,k02,k01, \ + \ + /* right hand, spatial positions */ \ + k57,k58,k59,k5A,k5B,k5C,k5D, \ + k47,k48,k49,k4A,k4B,k4C,k4D, \ + k38,k39,k3A,k3B,k3C,k3D, \ + k27,k28,k29,k2A,k2B,k2C,k2D, \ + k19,k1A,k1B,k1C,k1D, \ + k07,k08, \ + k09,k17,k18, \ + k0C,k0B,k0A ) \ + \ + /* matrix positions */ \ + {{ na,k01,k02,k03,k04,k05,k06, k07,k08,k09,k0A,k0B,k0C, na }, \ + { k10,k11,k12,k13,k14,k15,k16, k17,k18,k19,k1A,k1B,k1C,k1D }, \ + { k20,k21,k22,k23,k24,k25,k26, k27,k28,k29,k2A,k2B,k2C,k2D }, \ + { k30,k31,k32,k33,k34,k35, na, na,k38,k39,k3A,k3B,k3C,k3D }, \ + { k40,k41,k42,k43,k44,k45,k46, k47,k48,k49,k4A,k4B,k4C,k4D }, \ + { k50,k51,k52,k53,k54,k55,k56, k57,k58,k59,k5A,k5B,k5C,k5D }} + + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +#endif // ERGODOX_FIRMWARE__FIRMWARE__KEYBOARD__ERGODOX__MATRIX_H + diff --git a/firmware/lib/from-pjrc/readme.md b/firmware/lib/from-pjrc/readme.md deleted file mode 100644 index 49687ca..0000000 --- a/firmware/lib/from-pjrc/readme.md +++ /dev/null @@ -1,10 +0,0 @@ -# Files from [PJRC] (http://pjrc.com/teensy/) - -* [usb_keyboard] (http://pjrc.com/teensy/usb_keyboard.zip) - -------------------------------------------------------------------------------- - -Copyright © 2012 Ben Blazak -Released under The MIT License (MIT) (see "license.md") -Project located at - diff --git a/firmware/lib/from-pjrc/usb_keyboard/usb_keyboard.h b/firmware/lib/from-pjrc/usb_keyboard/usb_keyboard.h index 30072ae..d43dad2 100644 --- a/firmware/lib/from-pjrc/usb_keyboard/usb_keyboard.h +++ b/firmware/lib/from-pjrc/usb_keyboard/usb_keyboard.h @@ -1,21 +1,35 @@ /* ---------------------------------------------------------------------------- - * Originally from PJRC + * (See '.c' file for copyright and such) * ------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------------- - * Modified 2012 by Ben Blazak - * ------------------------------------------------------------------------- */ +/** + * - description: | + * The USB interface + * + * Prefix: `usb__` + * + * File History: + * * Originally from [PJRC] (http://pjrc.com/teensy/) : [usb_keyboard] + * (http://pjrc.com/teensy/usb_keyboard.zip). Modified 2012, Ben Blazak. + * I'd like to rewrite it someday (partly to add a few extra features + * (like mous keys), mostly to learn how); but alas, someday has not yet + * come. + */ -#ifndef usb_serial_h__ -#define usb_serial_h__ +#ifndef ERGODOX_FIRMWARE__FIRMWARE__LIB__FROM_PJRC__USB_KEYBOARD__USB_KEYBOARD__H +#define ERGODOX_FIRMWARE__FIRMWARE__LIB__FROM_PJRC__USB_KEYBOARD__USB_KEYBOARD__H +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- #include +// ---------------------------------------------------------------------------- + void usb__init (void); // initialize everything uint8_t usb__is_configured (void); // is the USB port configured? -int8_t usb__kb__send (void); +int8_t usb__kb__send (void); extern uint8_t usb__kb__modifier_keys; extern uint8_t usb__kb__keys[6]; @@ -23,10 +37,11 @@ extern volatile uint8_t usb__kb__leds; // ---------------------------------------------------------------------------- -// Everything below this point is only intended for usb_serial.c +// Everything below this point is only intended for usb_serial.c -------------- // ---------------------------------------------------------------------------- #ifdef USB_SERIAL_PRIVATE_INCLUDE + #include #include #include @@ -72,7 +87,7 @@ extern volatile uint8_t usb__kb__leds; #define PLL_CONFIG() (PLLCSR = 0x16) #define USB_CONFIG() (USBCON = ((1< + * Released under The MIT License (see "license.md") + * Project located at + * ------------------------------------------------------------------------- */ + +/** + * - description: | + * Some generally useful key-functions, and related definitions + * + * Prefix: `kf__` + */ + + +#ifndef ERGODOX_FIRMWARE__FIRMWARE__LIB__LAYOUT__KEY_FUNCTIONS__H +#define ERGODOX_FIRMWARE__FIRMWARE__LIB__LAYOUT__KEY_FUNCTIONS__H +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- + +#include + +// ---------------------------------------------------------------------------- + +typedef void (*kf__function_pointer_t)(uint16_t value); + +// ---------------------------------------------------------------------------- + +// basic +void kf__press (uint16_t value); +void kf__release (uint16_t value); +void kf__send (uint16_t value); +void kf__toggle (uint16_t value); +void kf__macro (uint16_t value); +void kf__layer__push (uint16_t value); +void kf__layer__pop (uint16_t value); + +// device +void kf__jump_to_bootloader (uint16_t value); + +// special +void kf__two_keys_capslock_press_release (uint16_t value); + + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +#endif // ERGODOX_FIRMWARE__FIRMWARE__LIB__LAYOUT__KEY_FUNCTIONS__H + + +// TODO: +// - move documentation to the '.c' files +// - rewrite, coz of changes +/** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # documentation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # typedefs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - typedef + type: '`void (*kf__function_pointer_t)(void)`' + name: '`kf__function_pointer_t`' + description: The pointer type for all key-functions. + notes: + - All key-functions must have the same type so that we can easily store + pointers to them, and call them using the pointers without knowing + which function specifically is being pointed to. + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + # basic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - function: + name: '`kf__press_release`' + description: Generate a normal keypress or keyrelease. + + - function: + name: '`kf__toggle`' + description: Toggle the key pressed or unpressed. + + - function: + name: '`kf__transparent`' + description: + Execute the key that would have been executed if the current layer was + not active. + + + # layer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - .ignore: + + - &kf__layer__push + description: + Push a layer element containing the layer value specified in the keymap + to the top of the stack. + + - &kf__layer__pop + description: + Pop the layer element created by the corresponding "layer push" + function out of the layer stack. + notes: + - The layer element is popped out of the stack no matter where it is in + the stack, without touching any of the other elements. + + # ~~~~~~~ + + - function: { name: '`kf__layer__push_0`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_1`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_2`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_3`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_4`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_5`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_6`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_7`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_8`', << : *kf__layer__push } + - function: { name: '`kf__layer__push_9`', << : *kf__layer__push } + + - function: { name: '`kf__layer__pop_0`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_1`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_2`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_3`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_4`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_5`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_6`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_7`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_8`', << : *kf__layer__pop } + - function: { name: '`kf__layer__pop_9`', << : *kf__layer__pop } + + # device ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - function: + name: '`kf__jump_to_bootloader`' + description: For reflashing the controller + + # special ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - function: + name: '`kf__shift_press_release`' + description: + Generate a "shift" press or release before the normal keypress or + keyrelease. + + - function: + name: '`kf__two_keys_capslock_press_release`' + description: + When assigned to two keys (e.g. the physical left and right shift keys) + (in both the press and release matrices), pressing and holding down on + of the keys will make the second key toggle capslock. + notes: + - If either of the shifts are pressed when the second key is pressed, + they will be released so that capslock will register properly when + pressed. Capslock will then be pressed and released, and the + original state of the shifts will be restored. + + - function: + name: '`kf__layer__push_numpad`' + description: + Set the numpad to on (put the numpad layer, specified in the keymap, in + a layer element at the top of the layer stack) and toggle numlock + (regardless of whether or not numlock is currently on) + notes: + - Meant to be assigned (along with "numpad off") *instead* of a normal + numlock key. + + - function: + name: '`kf__layer__pop_numpad`' + description: + Set the numpad to off (pop the layer element created by "numpad on" out + of the stack) and toggle numlock (regardless of whether or not numlock + is currently on). + notes: + - Meant to be assigned (along with "numpad on") *instead* of a normal + numlock key. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **/ + diff --git a/firmware/lib/layout/keys.h b/firmware/lib/layout/keys.h new file mode 100644 index 0000000..167406c --- /dev/null +++ b/firmware/lib/layout/keys.h @@ -0,0 +1,225 @@ +/* ---------------------------------------------------------------------------- + * Copyright (c) 2013 Ben Blazak + * Released under The MIT License (see "license.md") + * Project located at + * ------------------------------------------------------------------------- */ + +/** + * - description: | + * Partial key descriptions for the "Boot Keyboard Required" keys (see + * <../../../firmware/lib/usb/usage-page/keyboard.h>). + * + * Prefixes: `KEYS__`, [none] + * + * Usage: `#define` `KEYS__DEFAULT` before `#include`ing. + * + * Note: This header is meant to be included, not as an interface to + * anything, but in order to centralize a bit of code that would otherwise + * be duplicated by most layouts. + */ + + +#ifndef ERGODOX_FIRMWARE__FIRMWARE__LIB__LAYOUT__KEYS__H +#define ERGODOX_FIRMWARE__FIRMWARE__LIB__LAYOUT__KEYS__H +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- + + +#include "../../../firmware/lib/usb/usage-page/keyboard.h" + +// ---------------------------------------------------------------------------- + +#ifndef KEYS__DEFAULT + #error "You must define `KEYS__DEFAULT`" +#endif +#ifndef KEYS__SHIFTED + #error "You must define `KEYS__SHIFTED`" +#endif + +// ---------------------------------------------------------------------------- + +// letters +KEYS__DEFAULT( A, KEY__a_A ); +KEYS__DEFAULT( B, KEY__b_B ); +KEYS__DEFAULT( C, KEY__c_C ); +KEYS__DEFAULT( D, KEY__d_D ); +KEYS__DEFAULT( E, KEY__e_E ); +KEYS__DEFAULT( F, KEY__f_F ); +KEYS__DEFAULT( G, KEY__g_G ); +KEYS__DEFAULT( H, KEY__h_H ); +KEYS__DEFAULT( I, KEY__i_I ); +KEYS__DEFAULT( J, KEY__j_J ); +KEYS__DEFAULT( K, KEY__k_K ); +KEYS__DEFAULT( L, KEY__l_L ); +KEYS__DEFAULT( M, KEY__m_M ); +KEYS__DEFAULT( N, KEY__n_N ); +KEYS__DEFAULT( O, KEY__o_O ); +KEYS__DEFAULT( P, KEY__p_P ); +KEYS__DEFAULT( Q, KEY__q_Q ); +KEYS__DEFAULT( R, KEY__r_R ); +KEYS__DEFAULT( S, KEY__s_S ); +KEYS__DEFAULT( T, KEY__t_T ); +KEYS__DEFAULT( U, KEY__u_U ); +KEYS__DEFAULT( V, KEY__v_V ); +KEYS__DEFAULT( W, KEY__w_W ); +KEYS__DEFAULT( X, KEY__x_X ); +KEYS__DEFAULT( Y, KEY__y_Y ); +KEYS__DEFAULT( Z, KEY__z_Z ); +// --- (shifted) --- +KEYS__SHIFTED( CA, KEY__a_A ); +KEYS__SHIFTED( CB, KEY__b_B ); +KEYS__SHIFTED( CC, KEY__c_C ); +KEYS__SHIFTED( CD, KEY__d_D ); +KEYS__SHIFTED( CE, KEY__e_E ); +KEYS__SHIFTED( CF, KEY__f_F ); +KEYS__SHIFTED( CG, KEY__g_G ); +KEYS__SHIFTED( CH, KEY__h_H ); +KEYS__SHIFTED( CI, KEY__i_I ); +KEYS__SHIFTED( CJ, KEY__j_J ); +KEYS__SHIFTED( CK, KEY__k_K ); +KEYS__SHIFTED( CL, KEY__l_L ); +KEYS__SHIFTED( CM, KEY__m_M ); +KEYS__SHIFTED( CN, KEY__n_N ); +KEYS__SHIFTED( CO, KEY__o_O ); +KEYS__SHIFTED( CP, KEY__p_P ); +KEYS__SHIFTED( CQ, KEY__q_Q ); +KEYS__SHIFTED( CR, KEY__r_R ); +KEYS__SHIFTED( CS, KEY__s_S ); +KEYS__SHIFTED( CT, KEY__t_T ); +KEYS__SHIFTED( CU, KEY__u_U ); +KEYS__SHIFTED( CV, KEY__v_V ); +KEYS__SHIFTED( CW, KEY__w_W ); +KEYS__SHIFTED( CX, KEY__x_X ); +KEYS__SHIFTED( CY, KEY__y_Y ); +KEYS__SHIFTED( CZ, KEY__z_Z ); + +// numbers +KEYS__DEFAULT( K0, KEY__0_RightParenthesis ); +KEYS__DEFAULT( K1, KEY__1_Exclamation ); +KEYS__DEFAULT( K2, KEY__2_At ); +KEYS__DEFAULT( K3, KEY__3_Pound ); +KEYS__DEFAULT( K4, KEY__4_Dollar ); +KEYS__DEFAULT( K5, KEY__5_Percent ); +KEYS__DEFAULT( K6, KEY__6_Caret ); +KEYS__DEFAULT( K7, KEY__7_Ampersand ); +KEYS__DEFAULT( K8, KEY__8_Asterisk ); +KEYS__DEFAULT( K9, KEY__9_LeftParenthesis ); +// --- (shifted) --- +KEYS__SHIFTED( ParenR, KEY__0_RightParenthesis ); +KEYS__SHIFTED( Exclam, KEY__1_Exclamation ); +KEYS__SHIFTED( At, KEY__2_At ); +KEYS__SHIFTED( Pound, KEY__3_Pound ); +KEYS__SHIFTED( Dollar, KEY__4_Dollar ); +KEYS__SHIFTED( Percent, KEY__5_Percent ); +KEYS__SHIFTED( Caret, KEY__6_Caret ); +KEYS__SHIFTED( Amp, KEY__7_Ampersand ); +KEYS__SHIFTED( Asterisk, KEY__8_Asterisk ); +KEYS__SHIFTED( ParenL, KEY__9_LeftParenthesis ); +// --- (keypad) --- +KEYS__DEFAULT( KP0, KEYPAD__0_Insert ); +KEYS__DEFAULT( KP1, KEYPAD__1_End ); +KEYS__DEFAULT( KP2, KEYPAD__2_DownArrow ); +KEYS__DEFAULT( KP3, KEYPAD__3_PageDown ); +KEYS__DEFAULT( KP4, KEYPAD__4_LeftArrow ); +KEYS__DEFAULT( KP5, KEYPAD__5 ); +KEYS__DEFAULT( KP6, KEYPAD__6_RightArrow ); +KEYS__DEFAULT( KP7, KEYPAD__7_Home ); +KEYS__DEFAULT( KP8, KEYPAD__8_UpArrow ); +KEYS__DEFAULT( KP9, KEYPAD__9_PageUp ); + +// function +KEYS__DEFAULT( F1, KEY__F1 ); +KEYS__DEFAULT( F2, KEY__F2 ); +KEYS__DEFAULT( F3, KEY__F3 ); +KEYS__DEFAULT( F4, KEY__F4 ); +KEYS__DEFAULT( F5, KEY__F5 ); +KEYS__DEFAULT( F6, KEY__F6 ); +KEYS__DEFAULT( F7, KEY__F7 ); +KEYS__DEFAULT( F8, KEY__F8 ); +KEYS__DEFAULT( F9, KEY__F9 ); +KEYS__DEFAULT( F10, KEY__F10 ); +KEYS__DEFAULT( F11, KEY__F11 ); +KEYS__DEFAULT( F12, KEY__F12 ); + +// whitespace and symbols +KEYS__DEFAULT( Enter, KEY__ReturnEnter ); +KEYS__DEFAULT( Space, KEY__Spacebar ); +KEYS__DEFAULT( Tab, KEY__Tab ); +// --- +KEYS__DEFAULT( Bkslash, KEY__Backslash_Pipe ); +KEYS__DEFAULT( BrktL, KEY__LeftBracket_LeftBrace ); +KEYS__DEFAULT( BrktR, KEY__RightBracket_RightBrace ); +KEYS__DEFAULT( Comma, KEY__Comma_LessThan ); +KEYS__DEFAULT( Dash, KEY__Dash_Underscore ); +KEYS__DEFAULT( Equal, KEY__Equal_Plus ); +KEYS__DEFAULT( Grave, KEY__GraveAccent_Tilde ); +KEYS__DEFAULT( Period, KEY__Period_GreaterThan ); +KEYS__DEFAULT( Quote, KEY__SingleQuote_DoubleQuote ); +KEYS__DEFAULT( Semicol, KEY__Semicolon_Colon ); +KEYS__DEFAULT( Slash, KEY__Slash_Question ); +// --- (shifted) --- +KEYS__SHIFTED( Pipe, KEY__Backslash_Pipe ); +KEYS__SHIFTED( BraceL, KEY__LeftBracket_LeftBrace ); +KEYS__SHIFTED( BraceR, KEY__RightBracket_RightBrace ); +KEYS__SHIFTED( LessThan, KEY__Comma_LessThan ); +KEYS__SHIFTED( Undersc, KEY__Dash_Underscore ); +KEYS__SHIFTED( Plus, KEY__Equal_Plus ); +KEYS__SHIFTED( Tilde, KEY__GraveAccent_Tilde ); +KEYS__SHIFTED( GrtrThan, KEY__Period_GreaterThan ); +KEYS__SHIFTED( DblQuote, KEY__SingleQuote_DoubleQuote ); +KEYS__SHIFTED( Colon, KEY__Semicolon_Colon ); +KEYS__SHIFTED( Question, KEY__Slash_Question ); +// --- (keypad) --- +KEYS__DEFAULT( KPEnter, KEYPAD__Enter ); +// --- +KEYS__DEFAULT( KPDec, KEYPAD__Period_Delete ); +// --- +KEYS__DEFAULT( KPAdd, KEYPAD__Plus ); +KEYS__DEFAULT( KPSub, KEYPAD__Minus ); +KEYS__DEFAULT( KPMul, KEYPAD__Asterisk ); +KEYS__DEFAULT( KPDiv, KEYPAD__Slash ); + +// text control +KEYS__DEFAULT( ArrowU, KEY__UpArrow ); +KEYS__DEFAULT( ArrowD, KEY__DownArrow ); +KEYS__DEFAULT( ArrowL, KEY__LeftArrow ); +KEYS__DEFAULT( ArrowR, KEY__RightArrow ); +KEYS__DEFAULT( Bs, KEY__DeleteBackspace ); +KEYS__DEFAULT( Del, KEY__DeleteForward ); +KEYS__DEFAULT( End, KEY__End ); +KEYS__DEFAULT( Esc, KEY__Escape ); +KEYS__DEFAULT( Home, KEY__Home ); +KEYS__DEFAULT( Ins, KEY__Insert ); +KEYS__DEFAULT( PageU, KEY__PageUp ); +KEYS__DEFAULT( PageD, KEY__PageDown ); + +// modifier +KEYS__DEFAULT( AltR, KEY__RightAlt ); +KEYS__DEFAULT( AltL, KEY__LeftAlt ); +KEYS__DEFAULT( CtrlL, KEY__LeftControl ); +KEYS__DEFAULT( CtrlR, KEY__RightControl ); +KEYS__DEFAULT( GUIL, KEY__LeftGUI ); +KEYS__DEFAULT( GUIR, KEY__RightGUI ); +KEYS__DEFAULT( ShiftL, KEY__LeftShift ); +KEYS__DEFAULT( ShiftR, KEY__RightShift ); + +// lock +KEYS__DEFAULT( Caps, KEY__CapsLock ); +KEYS__DEFAULT( Scrl, KEY__ScrollLock ); +// --- (keypad) --- +KEYS__DEFAULT( Num, KEYPAD__NumLock_Clear ); + +// special function +KEYS__DEFAULT( App, KEY__Application ); +KEYS__DEFAULT( Pause, KEY__Pause ); +KEYS__DEFAULT( PrScr, KEY__PrintScreen ); + +// international and language +KEYS__DEFAULT( NonUSBackslash, KEY__NonUS_Backslash_Pipe ); +KEYS__DEFAULT( NonUSPound, KEY__NonUS_Pound_Tilde ); + + +// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +#endif // ERGODOX_FIRMWARE__FIRMWARE__LIB__LAYOUT__KEYS__H + diff --git a/firmware/lib/usb/TODO/TODO.c b/firmware/lib/usb/TODO/TODO.c index 3d7e0d5..fd74670 100644 --- a/firmware/lib/usb/TODO/TODO.c +++ b/firmware/lib/usb/TODO/TODO.c @@ -8,7 +8,7 @@ * - Device Class Definition for Human Interface Devices (HID): version 1.11 * ---------------------------------------------------------------------------- * Copyright (c) 2012 Ben Blazak - * Released under The MIT License (MIT) (see "license.md") + * Released under The MIT License (see "license.md") * Project located at * ------------------------------------------------------------------------- */ diff --git a/firmware/lib/usb/TODO/common.h b/firmware/lib/usb/TODO/common.h index 2da9e7e..6ba6a70 100644 --- a/firmware/lib/usb/TODO/common.h +++ b/firmware/lib/usb/TODO/common.h @@ -4,7 +4,7 @@ * See "notes from usb 2.0 spec sec 9 (usb device framework).h". * ---------------------------------------------------------------------------- * Copyright (c) 2012 Ben Blazak - * Released under The MIT License (MIT) (see "license.md") + * Released under The MIT License (see "license.md") * Project located at * ------------------------------------------------------------------------- */ diff --git a/firmware/lib/usb/TODO/notes from hid device class definition 1.11.md b/firmware/lib/usb/TODO/notes from hid device class definition 1.11.md index 3faa927..21a1b04 100644 --- a/firmware/lib/usb/TODO/notes from hid device class definition 1.11.md +++ b/firmware/lib/usb/TODO/notes from hid device class definition 1.11.md @@ -22,6 +22,6 @@ ------------------------------------------------------------------------------- Copyright © 2012 Ben Blazak -Released under The MIT License (MIT) (see "license.md") +Released under The MIT License (see "license.md") Project located at diff --git a/firmware/lib/usb/TODO/notes from usb 2.0 spec sec 9 (usb device framework).h b/firmware/lib/usb/TODO/notes from usb 2.0 spec sec 9 (usb device framework).h index ad0f7c7..7a674f6 100644 --- a/firmware/lib/usb/TODO/notes from usb 2.0 spec sec 9 (usb device framework).h +++ b/firmware/lib/usb/TODO/notes from usb 2.0 spec sec 9 (usb device framework).h @@ -23,7 +23,7 @@ * * ---------------------------------------------------------------------------- * Copyright (c) 2012 Ben Blazak - * Released under The MIT License (MIT) (see "license.md") + * Released under The MIT License (see "license.md") * Project located at * ------------------------------------------------------------------------- */ diff --git a/firmware/lib/usb/usage-page/keyboard.h b/firmware/lib/usb/usage-page/keyboard.h index 2cc04c4..85d007f 100644 --- a/firmware/lib/usb/usage-page/keyboard.h +++ b/firmware/lib/usb/usage-page/keyboard.h @@ -5,9 +5,11 @@ * ------------------------------------------------------------------------- */ /** - * - file description: | + * - description: | * USB Keyboard Key Codes (usage page 0x07) * + * Prefixes: `KEY__`, `KEYPAD__` + * * Taken from [the HID Usage Tables pdf][1], Section 10, which can be * found on [the HID Page][2] at * @@ -33,246 +35,246 @@ // ---------------------------------------------------------------------------- -// Name ID // PC Mac Unix Boot Keyboard Req. -// --------------------------- ---- -- --- ---- --------------------- +// Name ID // PC Mac Unix Boot Keyboard Req. +// ---------------------------- ---- -- --- ---- -------------------- -// (Reserved) 0x00 // √ √ √ 84/101/104 +// (Reserved) 0x00 // √ √ √ 84/101/104 -#define KEY_ErrorRollOver 0x01 // √ √ √ 84/101/104 -#define KEY_POSTFail 0x02 // √ √ √ 84/101/104 -#define KEY_ErrorUndefined 0x03 // √ √ √ 84/101/104 -#define KEY_a_A 0x04 // √ √ √ 84/101/104 -#define KEY_b_B 0x05 // √ √ √ 84/101/104 -#define KEY_c_C 0x06 // √ √ √ 84/101/104 -#define KEY_d_D 0x07 // √ √ √ 84/101/104 -#define KEY_e_E 0x08 // √ √ √ 84/101/104 -#define KEY_f_F 0x09 // √ √ √ 84/101/104 -#define KEY_g_G 0x0A // √ √ √ 84/101/104 -#define KEY_h_H 0x0B // √ √ √ 84/101/104 -#define KEY_i_I 0x0C // √ √ √ 84/101/104 -#define KEY_j_J 0x0D // √ √ √ 84/101/104 -#define KEY_k_K 0x0E // √ √ √ 84/101/104 -#define KEY_l_L 0x0F // √ √ √ 84/101/104 -#define KEY_m_M 0x10 // √ √ √ 84/101/104 -#define KEY_n_N 0x11 // √ √ √ 84/101/104 -#define KEY_o_O 0x12 // √ √ √ 84/101/104 -#define KEY_p_P 0x13 // √ √ √ 84/101/104 -#define KEY_q_Q 0x14 // √ √ √ 84/101/104 -#define KEY_r_R 0x15 // √ √ √ 84/101/104 -#define KEY_s_S 0x16 // √ √ √ 84/101/104 -#define KEY_t_T 0x17 // √ √ √ 84/101/104 -#define KEY_u_U 0x18 // √ √ √ 84/101/104 -#define KEY_v_V 0x19 // √ √ √ 84/101/104 -#define KEY_w_W 0x1A // √ √ √ 84/101/104 -#define KEY_x_X 0x1B // √ √ √ 84/101/104 -#define KEY_y_Y 0x1C // √ √ √ 84/101/104 -#define KEY_z_Z 0x1D // √ √ √ 84/101/104 -#define KEY_1_Exclamation 0x1E // √ √ √ 84/101/104 -#define KEY_2_At 0x1F // √ √ √ 84/101/104 -#define KEY_3_Pound 0x20 // √ √ √ 84/101/104 -#define KEY_4_Dollar 0x21 // √ √ √ 84/101/104 -#define KEY_5_Percent 0x22 // √ √ √ 84/101/104 -#define KEY_6_Caret 0x23 // √ √ √ 84/101/104 -#define KEY_7_Ampersand 0x24 // √ √ √ 84/101/104 -#define KEY_8_Asterisk 0x25 // √ √ √ 84/101/104 -#define KEY_9_LeftParenthesis 0x26 // √ √ √ 84/101/104 -#define KEY_0_RightParenthesis 0x27 // √ √ √ 84/101/104 -#define KEY_ReturnEnter 0x28 // √ √ √ 84/101/104 -#define KEY_Escape 0x29 // √ √ √ 84/101/104 -#define KEY_DeleteBackspace 0x2A // √ √ √ 84/101/104 -#define KEY_Tab 0x2B // √ √ √ 84/101/104 -#define KEY_Spacebar 0x2C // √ √ √ 84/101/104 -#define KEY_Dash_Underscore 0x2D // √ √ √ 84/101/104 -#define KEY_Equal_Plus 0x2E // √ √ √ 84/101/104 -#define KEY_LeftBracket_LeftBrace 0x2F // √ √ √ 84/101/104 -#define KEY_RightBracket_RightBrace 0x30 // √ √ √ 84/101/104 -#define KEY_Backslash_Pipe 0x31 // √ √ √ 84/101/104 -#define KEY_NonUS_Pound_Tilde 0x32 // √ √ √ 84/101/104 -#define KEY_Semicolon_Colon 0x33 // √ √ √ 84/101/104 -#define KEY_SingleQuote_DoubleQuote 0x34 // √ √ √ 84/101/104 -#define KEY_GraveAccent_Tilde 0x35 // √ √ √ 84/101/104 -#define KEY_Comma_LessThan 0x36 // √ √ √ 84/101/104 -#define KEY_Period_GreaterThan 0x37 // √ √ √ 84/101/104 -#define KEY_Slash_Question 0x38 // √ √ √ 84/101/104 -#define KEY_CapsLock 0x39 // √ √ √ 84/101/104 -#define KEY_F1 0x3A // √ √ √ 84/101/104 -#define KEY_F2 0x3B // √ √ √ 84/101/104 -#define KEY_F3 0x3C // √ √ √ 84/101/104 -#define KEY_F4 0x3D // √ √ √ 84/101/104 -#define KEY_F5 0x3E // √ √ √ 84/101/104 -#define KEY_F6 0x3F // √ √ √ 84/101/104 -#define KEY_F7 0x40 // √ √ √ 84/101/104 -#define KEY_F8 0x41 // √ √ √ 84/101/104 -#define KEY_F9 0x42 // √ √ √ 84/101/104 -#define KEY_F10 0x43 // √ √ √ 84/101/104 -#define KEY_F11 0x44 // √ √ √ 101/104 -#define KEY_F12 0x45 // √ √ √ 101/104 -#define KEY_PrintScreen 0x46 // √ √ √ 101/104 -#define KEY_ScrollLock 0x47 // √ √ √ 84/101/104 -#define KEY_Pause 0x48 // √ √ √ 101/104 -#define KEY_Insert 0x49 // √ √ √ 101/104 -#define KEY_Home 0x4A // √ √ √ 101/104 -#define KEY_PageUp 0x4B // √ √ √ 101/104 -#define KEY_DeleteForward 0x4C // √ √ √ 101/104 -#define KEY_End 0x4D // √ √ √ 101/104 -#define KEY_PageDown 0x4E // √ √ √ 101/104 -#define KEY_RightArrow 0x4F // √ √ √ 101/104 -#define KEY_LeftArrow 0x50 // √ √ √ 101/104 -#define KEY_DownArrow 0x51 // √ √ √ 101/104 -#define KEY_UpArrow 0x52 // √ √ √ 101/104 +#define KEY__ErrorRollOver 0x01 // √ √ √ 84/101/104 +#define KEY__POSTFail 0x02 // √ √ √ 84/101/104 +#define KEY__ErrorUndefined 0x03 // √ √ √ 84/101/104 +#define KEY__a_A 0x04 // √ √ √ 84/101/104 +#define KEY__b_B 0x05 // √ √ √ 84/101/104 +#define KEY__c_C 0x06 // √ √ √ 84/101/104 +#define KEY__d_D 0x07 // √ √ √ 84/101/104 +#define KEY__e_E 0x08 // √ √ √ 84/101/104 +#define KEY__f_F 0x09 // √ √ √ 84/101/104 +#define KEY__g_G 0x0A // √ √ √ 84/101/104 +#define KEY__h_H 0x0B // √ √ √ 84/101/104 +#define KEY__i_I 0x0C // √ √ √ 84/101/104 +#define KEY__j_J 0x0D // √ √ √ 84/101/104 +#define KEY__k_K 0x0E // √ √ √ 84/101/104 +#define KEY__l_L 0x0F // √ √ √ 84/101/104 +#define KEY__m_M 0x10 // √ √ √ 84/101/104 +#define KEY__n_N 0x11 // √ √ √ 84/101/104 +#define KEY__o_O 0x12 // √ √ √ 84/101/104 +#define KEY__p_P 0x13 // √ √ √ 84/101/104 +#define KEY__q_Q 0x14 // √ √ √ 84/101/104 +#define KEY__r_R 0x15 // √ √ √ 84/101/104 +#define KEY__s_S 0x16 // √ √ √ 84/101/104 +#define KEY__t_T 0x17 // √ √ √ 84/101/104 +#define KEY__u_U 0x18 // √ √ √ 84/101/104 +#define KEY__v_V 0x19 // √ √ √ 84/101/104 +#define KEY__w_W 0x1A // √ √ √ 84/101/104 +#define KEY__x_X 0x1B // √ √ √ 84/101/104 +#define KEY__y_Y 0x1C // √ √ √ 84/101/104 +#define KEY__z_Z 0x1D // √ √ √ 84/101/104 +#define KEY__1_Exclamation 0x1E // √ √ √ 84/101/104 +#define KEY__2_At 0x1F // √ √ √ 84/101/104 +#define KEY__3_Pound 0x20 // √ √ √ 84/101/104 +#define KEY__4_Dollar 0x21 // √ √ √ 84/101/104 +#define KEY__5_Percent 0x22 // √ √ √ 84/101/104 +#define KEY__6_Caret 0x23 // √ √ √ 84/101/104 +#define KEY__7_Ampersand 0x24 // √ √ √ 84/101/104 +#define KEY__8_Asterisk 0x25 // √ √ √ 84/101/104 +#define KEY__9_LeftParenthesis 0x26 // √ √ √ 84/101/104 +#define KEY__0_RightParenthesis 0x27 // √ √ √ 84/101/104 +#define KEY__ReturnEnter 0x28 // √ √ √ 84/101/104 +#define KEY__Escape 0x29 // √ √ √ 84/101/104 +#define KEY__DeleteBackspace 0x2A // √ √ √ 84/101/104 +#define KEY__Tab 0x2B // √ √ √ 84/101/104 +#define KEY__Spacebar 0x2C // √ √ √ 84/101/104 +#define KEY__Dash_Underscore 0x2D // √ √ √ 84/101/104 +#define KEY__Equal_Plus 0x2E // √ √ √ 84/101/104 +#define KEY__LeftBracket_LeftBrace 0x2F // √ √ √ 84/101/104 +#define KEY__RightBracket_RightBrace 0x30 // √ √ √ 84/101/104 +#define KEY__Backslash_Pipe 0x31 // √ √ √ 84/101/104 +#define KEY__NonUS_Pound_Tilde 0x32 // √ √ √ 84/101/104 +#define KEY__Semicolon_Colon 0x33 // √ √ √ 84/101/104 +#define KEY__SingleQuote_DoubleQuote 0x34 // √ √ √ 84/101/104 +#define KEY__GraveAccent_Tilde 0x35 // √ √ √ 84/101/104 +#define KEY__Comma_LessThan 0x36 // √ √ √ 84/101/104 +#define KEY__Period_GreaterThan 0x37 // √ √ √ 84/101/104 +#define KEY__Slash_Question 0x38 // √ √ √ 84/101/104 +#define KEY__CapsLock 0x39 // √ √ √ 84/101/104 +#define KEY__F1 0x3A // √ √ √ 84/101/104 +#define KEY__F2 0x3B // √ √ √ 84/101/104 +#define KEY__F3 0x3C // √ √ √ 84/101/104 +#define KEY__F4 0x3D // √ √ √ 84/101/104 +#define KEY__F5 0x3E // √ √ √ 84/101/104 +#define KEY__F6 0x3F // √ √ √ 84/101/104 +#define KEY__F7 0x40 // √ √ √ 84/101/104 +#define KEY__F8 0x41 // √ √ √ 84/101/104 +#define KEY__F9 0x42 // √ √ √ 84/101/104 +#define KEY__F10 0x43 // √ √ √ 84/101/104 +#define KEY__F11 0x44 // √ √ √ 101/104 +#define KEY__F12 0x45 // √ √ √ 101/104 +#define KEY__PrintScreen 0x46 // √ √ √ 101/104 +#define KEY__ScrollLock 0x47 // √ √ √ 84/101/104 +#define KEY__Pause 0x48 // √ √ √ 101/104 +#define KEY__Insert 0x49 // √ √ √ 101/104 +#define KEY__Home 0x4A // √ √ √ 101/104 +#define KEY__PageUp 0x4B // √ √ √ 101/104 +#define KEY__DeleteForward 0x4C // √ √ √ 101/104 +#define KEY__End 0x4D // √ √ √ 101/104 +#define KEY__PageDown 0x4E // √ √ √ 101/104 +#define KEY__RightArrow 0x4F // √ √ √ 101/104 +#define KEY__LeftArrow 0x50 // √ √ √ 101/104 +#define KEY__DownArrow 0x51 // √ √ √ 101/104 +#define KEY__UpArrow 0x52 // √ √ √ 101/104 -#define KEYPAD_NumLock_Clear 0x53 // √ √ √ 101/104 -#define KEYPAD_Slash 0x54 // √ √ √ 101/104 -#define KEYPAD_Asterisk 0x55 // √ √ √ 84/101/104 -#define KEYPAD_Minus 0x56 // √ √ √ 84/101/104 -#define KEYPAD_Plus 0x57 // √ √ √ 84/101/104 -#define KEYPAD_ENTER 0x58 // √ √ √ 101/104 -#define KEYPAD_1_End 0x59 // √ √ √ 84/101/104 -#define KEYPAD_2_DownArrow 0x5A // √ √ √ 84/101/104 -#define KEYPAD_3_PageDown 0x5B // √ √ √ 84/101/104 -#define KEYPAD_4_LeftArrow 0x5C // √ √ √ 84/101/104 -#define KEYPAD_5 0x5D // √ √ √ 84/101/104 -#define KEYPAD_6_RightArrow 0x5E // √ √ √ 84/101/104 -#define KEYPAD_7_Home 0x5F // √ √ √ 84/101/104 -#define KEYPAD_8_UpArrow 0x60 // √ √ √ 84/101/104 -#define KEYPAD_9_PageUp 0x61 // √ √ √ 84/101/104 -#define KEYPAD_0_Insert 0x62 // √ √ √ 84/101/104 -#define KEYPAD_Period_Delete 0x63 // √ √ √ 84/101/104 +#define KEYPAD__NumLock_Clear 0x53 // √ √ √ 101/104 +#define KEYPAD__Slash 0x54 // √ √ √ 101/104 +#define KEYPAD__Asterisk 0x55 // √ √ √ 84/101/104 +#define KEYPAD__Minus 0x56 // √ √ √ 84/101/104 +#define KEYPAD__Plus 0x57 // √ √ √ 84/101/104 +#define KEYPAD__Enter 0x58 // √ √ √ 101/104 +#define KEYPAD__1_End 0x59 // √ √ √ 84/101/104 +#define KEYPAD__2_DownArrow 0x5A // √ √ √ 84/101/104 +#define KEYPAD__3_PageDown 0x5B // √ √ √ 84/101/104 +#define KEYPAD__4_LeftArrow 0x5C // √ √ √ 84/101/104 +#define KEYPAD__5 0x5D // √ √ √ 84/101/104 +#define KEYPAD__6_RightArrow 0x5E // √ √ √ 84/101/104 +#define KEYPAD__7_Home 0x5F // √ √ √ 84/101/104 +#define KEYPAD__8_UpArrow 0x60 // √ √ √ 84/101/104 +#define KEYPAD__9_PageUp 0x61 // √ √ √ 84/101/104 +#define KEYPAD__0_Insert 0x62 // √ √ √ 84/101/104 +#define KEYPAD__Period_Delete 0x63 // √ √ √ 84/101/104 -#define KEY_NonUS_Backslash_Pipe 0x64 // √ √ √ 84/101/104 -#define KEY_Application 0x65 // √ - √ 104 -#define KEY_Power 0x66 // - √ √ - +#define KEY__NonUS_Backslash_Pipe 0x64 // √ √ √ 84/101/104 +#define KEY__Application 0x65 // √ - √ 104 +#define KEY__Power 0x66 // - √ √ - -#define KEYPAD_Equal 0x67 // - √ - - +#define KEYPAD__Equal 0x67 // - √ - - -#define KEY_F13 0x68 // - √ - - -#define KEY_F14 0x69 // - √ - - -#define KEY_F15 0x6A // - √ - - -#define KEY_F16 0x6B // - - - - -#define KEY_F17 0x6C // - - - - -#define KEY_F18 0x6D // - - - - -#define KEY_F19 0x6E // - - - - -#define KEY_F20 0x6F // - - - - -#define KEY_F21 0x70 // - - - - -#define KEY_F22 0x71 // - - - - -#define KEY_F23 0x72 // - - - - -#define KEY_F24 0x73 // - - - - -#define KEY_Execute 0x74 // - - √ - -#define KEY_Help 0x75 // - - √ - -#define KEY_Menu 0x76 // - - √ - -#define KEY_Select 0x77 // - - √ - -#define KEY_Stop 0x78 // - - √ - -#define KEY_Again 0x79 // - - √ - -#define KEY_Undo 0x7A // - - √ - -#define KEY_Cut 0x7B // - - √ - -#define KEY_Copy 0x7C // - - √ - -#define KEY_Paste 0x7D // - - √ - -#define KEY_Find 0x7E // - - √ - -#define KEY_Mute 0x7F // - - √ - -#define KEY_VolumeUp 0x80 // - - √ - -#define KEY_VolumeDown 0x81 // - - √ - -#define KEY_LockingCapsLock 0x82 // - - √ - -#define KEY_LockingNumLock 0x83 // - - √ - -#define KEY_LockingScrollLock 0x84 // - - √ - +#define KEY__F13 0x68 // - √ - - +#define KEY__F14 0x69 // - √ - - +#define KEY__F15 0x6A // - √ - - +#define KEY__F16 0x6B // - - - - +#define KEY__F17 0x6C // - - - - +#define KEY__F18 0x6D // - - - - +#define KEY__F19 0x6E // - - - - +#define KEY__F20 0x6F // - - - - +#define KEY__F21 0x70 // - - - - +#define KEY__F22 0x71 // - - - - +#define KEY__F23 0x72 // - - - - +#define KEY__F24 0x73 // - - - - +#define KEY__Execute 0x74 // - - √ - +#define KEY__Help 0x75 // - - √ - +#define KEY__Menu 0x76 // - - √ - +#define KEY__Select 0x77 // - - √ - +#define KEY__Stop 0x78 // - - √ - +#define KEY__Again 0x79 // - - √ - +#define KEY__Undo 0x7A // - - √ - +#define KEY__Cut 0x7B // - - √ - +#define KEY__Copy 0x7C // - - √ - +#define KEY__Paste 0x7D // - - √ - +#define KEY__Find 0x7E // - - √ - +#define KEY__Mute 0x7F // - - √ - +#define KEY__VolumeUp 0x80 // - - √ - +#define KEY__VolumeDown 0x81 // - - √ - +#define KEY__LockingCapsLock 0x82 // - - √ - +#define KEY__LockingNumLock 0x83 // - - √ - +#define KEY__LockingScrollLock 0x84 // - - √ - -#define KEYPAD_Comma 0x85 // - - - - -#define KEYPAD_EqualSign 0x86 // - - - - +#define KEYPAD__Comma 0x85 // - - - - +#define KEYPAD__EqualSign 0x86 // - - - - -#define KEY_International1 0x87 // - - - - -#define KEY_International2 0x88 // - - - - -#define KEY_International3 0x89 // - - - - -#define KEY_International4 0x8A // - - - - -#define KEY_International5 0x8B // - - - - -#define KEY_International6 0x8C // - - - - -#define KEY_International7 0x8D // - - - - -#define KEY_International8 0x8E // - - - - -#define KEY_International9 0x8F // - - - - -#define KEY_LANG1 0x90 // - - - - -#define KEY_LANG2 0x91 // - - - - -#define KEY_LANG3 0x92 // - - - - -#define KEY_LANG4 0x93 // - - - - -#define KEY_LANG5 0x94 // - - - - -#define KEY_LANG6 0x95 // - - - - -#define KEY_LANG7 0x96 // - - - - -#define KEY_LANG8 0x97 // - - - - -#define KEY_LANG9 0x98 // - - - - -#define KEY_AlternateErase 0x99 // - - - - -#define KEY_SysReq_Attention 0x9A // - - - - -#define KEY_Cancel 0x9B // - - - - -#define KEY_Clear 0x9C // - - - - -#define KEY_Prior 0x9D // - - - - -#define KEY_Return 0x9E // - - - - -#define KEY_Separator 0x9F // - - - - -#define KEY_Out 0xA0 // - - - - -#define KEY_Oper 0xA1 // - - - - -#define KEY_Clear_Again 0xA2 // - - - - -#define KEY_CrSel_Props 0xA3 // - - - - -#define KEY_ExSel 0xA4 // - - - - +#define KEY__International1 0x87 // - - - - +#define KEY__International2 0x88 // - - - - +#define KEY__International3 0x89 // - - - - +#define KEY__International4 0x8A // - - - - +#define KEY__International5 0x8B // - - - - +#define KEY__International6 0x8C // - - - - +#define KEY__International7 0x8D // - - - - +#define KEY__International8 0x8E // - - - - +#define KEY__International9 0x8F // - - - - +#define KEY__LANG1 0x90 // - - - - +#define KEY__LANG2 0x91 // - - - - +#define KEY__LANG3 0x92 // - - - - +#define KEY__LANG4 0x93 // - - - - +#define KEY__LANG5 0x94 // - - - - +#define KEY__LANG6 0x95 // - - - - +#define KEY__LANG7 0x96 // - - - - +#define KEY__LANG8 0x97 // - - - - +#define KEY__LANG9 0x98 // - - - - +#define KEY__AlternateErase 0x99 // - - - - +#define KEY__SysReq_Attention 0x9A // - - - - +#define KEY__Cancel 0x9B // - - - - +#define KEY__Clear 0x9C // - - - - +#define KEY__Prior 0x9D // - - - - +#define KEY__Return 0x9E // - - - - +#define KEY__Separator 0x9F // - - - - +#define KEY__Out 0xA0 // - - - - +#define KEY__Oper 0xA1 // - - - - +#define KEY__Clear_Again 0xA2 // - - - - +#define KEY__CrSel_Props 0xA3 // - - - - +#define KEY__ExSel 0xA4 // - - - - -// (Reserved) 0xA5..0xAF // - - - - +// (Reserved) 0xA5..0xAF // - - - - -#define KEYPAD_00 0xB0 // - - - - -#define KEYPAD_000 0xB1 // - - - - +#define KEYPAD__00 0xB0 // - - - - +#define KEYPAD__000 0xB1 // - - - - -#define KEY_ThousandsSeparator 0xB2 // - - - - -#define KEY_DecimalSeparator 0xB3 // - - - - -#define KEY_CurrencyUnit 0xB4 // - - - - -#define KEY_CurrencySubunit 0xB5 // - - - - +#define KEY__ThousandsSeparator 0xB2 // - - - - +#define KEY__DecimalSeparator 0xB3 // - - - - +#define KEY__CurrencyUnit 0xB4 // - - - - +#define KEY__CurrencySubunit 0xB5 // - - - - -#define KEYPAD_LeftParenthesis 0xB6 // - - - - -#define KEYPAD_RightParenthesis 0xB7 // - - - - -#define KEYPAD_LeftBrace 0xB8 // - - - - -#define KEYPAD_RightBrace 0xB9 // - - - - +#define KEYPAD__LeftParenthesis 0xB6 // - - - - +#define KEYPAD__RightParenthesis 0xB7 // - - - - +#define KEYPAD__LeftBrace 0xB8 // - - - - +#define KEYPAD__RightBrace 0xB9 // - - - - -#define KEYPAD_Tab 0xBA // - - - - -#define KEYPAD_Backspace 0xBB // - - - - -#define KEYPAD_A 0xBC // - - - - -#define KEYPAD_B 0xBD // - - - - -#define KEYPAD_C 0xBE // - - - - -#define KEYPAD_D 0xBF // - - - - -#define KEYPAD_E 0xC0 // - - - - -#define KEYPAD_F 0xC1 // - - - - -#define KEYPAD_XOR 0xC2 // - - - - -#define KEYPAD_Caret 0xC3 // - - - - -#define KEYPAD_Percent 0xC4 // - - - - -#define KEYPAD_LessThan 0xC5 // - - - - -#define KEYPAD_GreaterThan 0xC6 // - - - - -#define KEYPAD_Ampersand 0xC7 // - - - - -#define KEYPAD_AmpersandAmpersand 0xC8 // - - - - -#define KEYPAD_Pipe 0xC9 // - - - - -#define KEYPAD_PipePipe 0xCA // - - - - -#define KEYPAD_Colon 0xCB // - - - - -#define KEYPAD_Pound 0xCC // - - - - -#define KEYPAD_Space 0xCD // - - - - -#define KEYPAD_At 0xCE // - - - - -#define KEYPAD_Exclamation 0xCF // - - - - -#define KEYPAD_MemoryStore 0xD0 // - - - - -#define KEYPAD_MemoryRecall 0xD1 // - - - - -#define KEYPAD_MemoryClear 0xD2 // - - - - -#define KEYPAD_MemoryAdd 0xD3 // - - - - -#define KEYPAD_MemorySubtract 0xD4 // - - - - -#define KEYPAD_MemoryMultiply 0xD5 // - - - - -#define KEYPAD_MemoryDivide 0xD6 // - - - - -#define KEYPAD_PlusMinus 0xD7 // - - - - -#define KEYPAD_Clear 0xD8 // - - - - -#define KEYPAD_ClearEntry 0xD9 // - - - - -#define KEYPAD_Binary 0xDA // - - - - -#define KEYPAD_Octal 0xDB // - - - - -#define KEYPAD_Decimal 0xDC // - - - - -#define KEYPAD_Hexadecimal 0xDD // - - - - +#define KEYPAD__Tab 0xBA // - - - - +#define KEYPAD__Backspace 0xBB // - - - - +#define KEYPAD__A 0xBC // - - - - +#define KEYPAD__B 0xBD // - - - - +#define KEYPAD__C 0xBE // - - - - +#define KEYPAD__D 0xBF // - - - - +#define KEYPAD__E 0xC0 // - - - - +#define KEYPAD__F 0xC1 // - - - - +#define KEYPAD__XOR 0xC2 // - - - - +#define KEYPAD__Caret 0xC3 // - - - - +#define KEYPAD__Percent 0xC4 // - - - - +#define KEYPAD__LessThan 0xC5 // - - - - +#define KEYPAD__GreaterThan 0xC6 // - - - - +#define KEYPAD__Ampersand 0xC7 // - - - - +#define KEYPAD__AmpersandAmpersand 0xC8 // - - - - +#define KEYPAD__Pipe 0xC9 // - - - - +#define KEYPAD__PipePipe 0xCA // - - - - +#define KEYPAD__Colon 0xCB // - - - - +#define KEYPAD__Pound 0xCC // - - - - +#define KEYPAD__Space 0xCD // - - - - +#define KEYPAD__At 0xCE // - - - - +#define KEYPAD__Exclamation 0xCF // - - - - +#define KEYPAD__MemoryStore 0xD0 // - - - - +#define KEYPAD__MemoryRecall 0xD1 // - - - - +#define KEYPAD__MemoryClear 0xD2 // - - - - +#define KEYPAD__MemoryAdd 0xD3 // - - - - +#define KEYPAD__MemorySubtract 0xD4 // - - - - +#define KEYPAD__MemoryMultiply 0xD5 // - - - - +#define KEYPAD__MemoryDivide 0xD6 // - - - - +#define KEYPAD__PlusMinus 0xD7 // - - - - +#define KEYPAD__Clear 0xD8 // - - - - +#define KEYPAD__ClearEntry 0xD9 // - - - - +#define KEYPAD__Binary 0xDA // - - - - +#define KEYPAD__Octal 0xDB // - - - - +#define KEYPAD__Decimal 0xDC // - - - - +#define KEYPAD__Hexadecimal 0xDD // - - - - -// (Reserved) 0xDE..0xDF // - - - - +// (Reserved) 0xDE..0xDF // - - - - -#define KEY_LeftControl 0xE0 // √ √ √ 84/101/104 -#define KEY_LeftShift 0xE1 // √ √ √ 84/101/104 -#define KEY_LeftAlt 0xE2 // √ √ √ 84/101/104 -#define KEY_LeftGUI 0xE3 // √ √ √ 104 -#define KEY_RightControl 0xE4 // √ √ √ 101/104 -#define KEY_RightShift 0xE5 // √ √ √ 84/101/104 -#define KEY_RightAlt 0xE6 // √ √ √ 101/104 -#define KEY_RightGUI 0xE7 // √ √ √ 104 +#define KEY__LeftControl 0xE0 // √ √ √ 84/101/104 +#define KEY__LeftShift 0xE1 // √ √ √ 84/101/104 +#define KEY__LeftAlt 0xE2 // √ √ √ 84/101/104 +#define KEY__LeftGUI 0xE3 // √ √ √ 104 +#define KEY__RightControl 0xE4 // √ √ √ 101/104 +#define KEY__RightShift 0xE5 // √ √ √ 84/101/104 +#define KEY__RightAlt 0xE6 // √ √ √ 101/104 +#define KEY__RightGUI 0xE7 // √ √ √ 104 -// (Reserved) 0xE8..0xFFFF // - - - - +// (Reserved) 0xE8..0xFFFF // - - - - // ---------------------------------------------------------------------------- diff --git a/firmware/lib/usb/usage-page/keyboard/short-names.h b/firmware/lib/usb/usage-page/keyboard/short-names.h deleted file mode 100644 index e962b83..0000000 --- a/firmware/lib/usb/usage-page/keyboard/short-names.h +++ /dev/null @@ -1,315 +0,0 @@ -/* ---------------------------------------------------------------------------- - * Copyright (c) 2012 Ben Blazak - * Released under The MIT License (see "license.md") - * Project located at - * ------------------------------------------------------------------------- */ - -/** - * - file description: | - * USB Keyboard Key Codes : short names - * - * These are for convenience (and to help with formatting, keeping stuff - * from getting too long). See <../keyboard.h> for definitions and - * everything. - * ---------------------------------------------------------------------------- - */ - - -#ifndef ERGODOX_FIRMWARE__FIRMWARE__LIB__USB__USAGE_PAGE__KEYBOARD__SHORT_NAMES__H -#define ERGODOX_FIRMWARE__FIRMWARE__LIB__USB__USAGE_PAGE__KEYBOARD__SHORT_NAMES__H -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- - - -#include "./long-names.h" - - -// ---------------------------------------------------------------------------- -// protocol -// ---------------------------------------------------------------------------- - -// error -#define _ErrRollover KEY_ErrorRollOver -#define _PostFail KEY_POSTFail -#define _ErrUndef KEY_ErrorUndefined - - -// ---------------------------------------------------------------------------- -// main keyboard -// ---------------------------------------------------------------------------- - -// letters -#define _A KEY_a_A -#define _B KEY_b_B -#define _C KEY_c_C -#define _D KEY_d_D -#define _E KEY_e_E -#define _F KEY_f_F -#define _G KEY_g_G -#define _H KEY_h_H -#define _I KEY_i_I -#define _J KEY_j_J -#define _K KEY_k_K -#define _L KEY_l_L -#define _M KEY_m_M -#define _N KEY_n_N -#define _O KEY_o_O -#define _P KEY_p_P -#define _Q KEY_q_Q -#define _R KEY_r_R -#define _S KEY_s_S -#define _T KEY_t_T -#define _U KEY_u_U -#define _V KEY_v_V -#define _W KEY_w_W -#define _X KEY_x_X -#define _Y KEY_y_Y -#define _Z KEY_z_Z - -// numbers -#define _0 KEY_0_RightParenthesis -#define _1 KEY_1_Exclamation -#define _2 KEY_2_At -#define _3 KEY_3_Pound -#define _4 KEY_4_Dollar -#define _5 KEY_5_Percent -#define _6 KEY_6_Caret -#define _7 KEY_7_Ampersand -#define _8 KEY_8_Asterisk -#define _9 KEY_9_LeftParenthesis - -// function -#define _F1 KEY_F1 -#define _F2 KEY_F2 -#define _F3 KEY_F3 -#define _F4 KEY_F4 -#define _F5 KEY_F5 -#define _F6 KEY_F6 -#define _F7 KEY_F7 -#define _F8 KEY_F8 -#define _F9 KEY_F9 -#define _F10 KEY_F10 -#define _F11 KEY_F11 -#define _F12 KEY_F12 -#define _F13 KEY_F13 -#define _F14 KEY_F14 -#define _F15 KEY_F15 -#define _F16 KEY_F16 -#define _F17 KEY_F17 -#define _F18 KEY_F18 -#define _F19 KEY_F19 -#define _F20 KEY_F20 -#define _F21 KEY_F21 -#define _F22 KEY_F22 -#define _F23 KEY_F23 -#define _F24 KEY_F24 - -// whitespace and symbols -#define _enter KEY_ReturnEnter -#define _space KEY_Spacebar -#define _tab KEY_Tab -// --- -#define _backslash KEY_Backslash_Pipe -#define _bracketL KEY_LeftBracket_LeftBrace -#define _bracketR KEY_RightBracket_RightBrace -#define _comma KEY_Comma_LessThan -#define _dash KEY_Dash_Underscore -#define _equal KEY_Equal_Plus -#define _grave KEY_GraveAccent_Tilde -#define _period KEY_Period_GreaterThan -#define _quote KEY_SingleQuote_DoubleQuote -#define _semicolon KEY_Semicolon_Colon -#define _slash KEY_Slash_Question -// --- -#define _sep_dec KEY_DecimalSeparator -#define _sep_thousands KEY_ThousandsSeparator -#define _currencyUnit KEY_CurrencyUnit -#define _currencySubunit KEY_CurrencySubunit - -// international and language -#define _int1 KEY_International1 -#define _int2 KEY_International2 -#define _int3 KEY_International3 -#define _int4 KEY_International4 -#define _int5 KEY_International5 -#define _int6 KEY_International6 -#define _int7 KEY_International7 -#define _int8 KEY_International8 -#define _int9 KEY_International9 -// --- -#define _lang1 KEY_LANG1 -#define _lang2 KEY_LANG2 -#define _lang3 KEY_LANG3 -#define _lang4 KEY_LANG4 -#define _lang5 KEY_LANG5 -#define _lang6 KEY_LANG6 -#define _lang7 KEY_LANG7 -#define _lang8 KEY_LANG8 -#define _lang9 KEY_LANG9 -// --- -#define _backslash_nonUS KEY_NonUS_Backslash_Pipe -#define _pound_nonUS KEY_NonUS_Pound_Tilde - -// text control -#define _bs KEY_DeleteBackspace -#define _del KEY_DeleteForward -#define _home KEY_Home -#define _end KEY_End -#define _pageU KEY_PageUp -#define _pageD KEY_PageDown -#define _arrowU KEY_UpArrow -#define _arrowD KEY_DownArrow -#define _arrowL KEY_LeftArrow -#define _arrowR KEY_RightArrow -#define _esc KEY_Escape -#define _insert KEY_Insert - -// modifier -#define _altL KEY_LeftAlt -#define _altR KEY_RightAlt -#define _ctrlL KEY_LeftControl -#define _ctrlR KEY_RightControl -#define _guiL KEY_LeftGUI -#define _guiR KEY_RightGUI -#define _shiftL KEY_LeftShift -#define _shiftR KEY_RightShift - -// lock -#define _capsLock KEY_CapsLock -#define _scrollLock KEY_ScrollLock -// (numlock is under keypad) -// --- not generally used -#define _capsLock_locking KEY_LockingCapsLock -#define _numLock_locking KEY_LockingNumLock -#define _scrollLock_locking KEY_LockingScrollLock - -// special function -#define _pause KEY_Pause -#define _print KEY_PrintScreen -// --- -#define _application KEY_Application -#define _execute KEY_Execute -#define _power KEY_Power -// --- -#define _help KEY_Help -#define _menu KEY_Menu -// --- -#define _cut KEY_Cut -#define _copy KEY_Copy -#define _paste KEY_Paste -#define _find KEY_Find -#define _select KEY_Select -#define _stop KEY_Stop -#define _undo KEY_Undo -// --- -#define _mute KEY_Mute -#define _volumeU KEY_VolumeUp -#define _volumeD KEY_VolumeDown -// --- -#define _altErase KEY_AlternateErase -// --- -#define _again KEY_Again -#define _cancel KEY_Cancel -#define _clear_again KEY_Clear_Again -#define _clear KEY_Clear -#define _oper KEY_Oper -#define _out KEY_Out -#define _prior KEY_Prior -#define _return KEY_Return -#define _separator KEY_Separator -// --- -#define _crSel KEY_CrSel_Props -#define _exSel KEY_ExSel -#define _sysReq KEY_SysReq_Attention - - -// ---------------------------------------------------------------------------- -// keypad -// ---------------------------------------------------------------------------- - -// numbers and hex letters -#define _1_kp KEYPAD_1_End -#define _2_kp KEYPAD_2_DownArrow -#define _3_kp KEYPAD_3_PageDown -#define _4_kp KEYPAD_4_LeftArrow -#define _5_kp KEYPAD_5 -#define _6_kp KEYPAD_6_RightArrow -#define _7_kp KEYPAD_7_Home -#define _8_kp KEYPAD_8_UpArrow -#define _9_kp KEYPAD_9_PageUp -#define _0_kp KEYPAD_0_Insert -#define _A_kp KEYPAD_A -#define _B_kp KEYPAD_B -#define _C_kp KEYPAD_C -#define _D_kp KEYPAD_D -#define _E_kp KEYPAD_E -#define _F_kp KEYPAD_F -// --- -#define _00_kp KEYPAD_00 -#define _000_kp KEYPAD_000 - -// whitespace and symbols -#define _tab_kp KEYPAD_Tab -#define _space_kp KEYPAD_Space -#define _enter_kp KEYPAD_ENTER -// --- -#define _dec_del_kp KEYPAD_Period_Delete -#define _comma_kp KEYPAD_Comma -#define _equal_kp KEYPAD_Equal -#define _equalSign_kp KEYPAD_EqualSign -#define _parenL_kp KEYPAD_LeftParenthesis -#define _parenR_kp KEYPAD_RightParenthesis -#define _braceL_kp KEYPAD_LeftBrace -#define _braceR_kp KEYPAD_RightBrace - -// operations -// --- basic -#define _add_kp KEYPAD_Plus -#define _sub_kp KEYPAD_Minus -#define _mul_kp KEYPAD_Asterisk -#define _div_kp KEYPAD_Slash -#define _plusMinus_kp KEYPAD_PlusMinus -// --- logical -#define _lt_kp KEYPAD_LessThan -#define _gt_kp KEYPAD_GreaterThan -#define _xor_kp KEYPAD_XOR -#define _and_kp KEYPAD_Ampersand -#define _andand_kp KEYPAD_AmpersandAmpersand -#define _pipe_kp KEYPAD_Pipe -#define _pipepipe_kp KEYPAD_PipePipe -#define _caret_kp KEYPAD_Caret -#define _exclamation_kp KEYPAD_Exclamation -// --- other -#define _at_kp KEYPAD_At -#define _colon_kp KEYPAD_Colon -#define _percent_kp KEYPAD_Percent -#define _pound_kp KEYPAD_Pound - -// radix -#define _bin_kp KEYPAD_Binary -#define _oct_kp KEYPAD_Octal -#define _dec_kp KEYPAD_Decimal -#define _hex_kp KEYPAD_Hexadecimal - -// text control -#define _bs_kp KEYPAD_Backspace -#define _clear_kp KEYPAD_Clear -#define _clearEntry_kp KEYPAD_ClearEntry - -// lock -#define _numLock_kp KEYPAD_NumLock_Clear - -// memory control -#define _memStore_kp KEYPAD_MemoryStore -#define _memRecall_kp KEYPAD_MemoryRecall -#define _memClear_kp KEYPAD_MemoryClear -#define _memAdd_kp KEYPAD_MemoryAdd -#define _memSub_kp KEYPAD_MemorySubtract -#define _memMul_kp KEYPAD_MemoryMultiply -#define _memDiv_kp KEYPAD_MemoryDivide - - -// ---------------------------------------------------------------------------- -// ---------------------------------------------------------------------------- -#endif // ERGODOX_FIRMWARE__SRC__LIB__USB__USAGE_PAGE__KEYBOARD__SHORT_NAMES__H - diff --git a/firmware/lib/usb/usage-page/led.h b/firmware/lib/usb/usage-page/led.h index 8939529..dfee299 100644 --- a/firmware/lib/usb/usage-page/led.h +++ b/firmware/lib/usb/usage-page/led.h @@ -5,9 +5,11 @@ * ------------------------------------------------------------------------- */ /** - * - file description: | + * - description: | * USB LED Codes (usage page 0x08) * + * Prefix: `LED__` + * * Taken from [the HID Usage Tables pdf][1], Section 11, * which can be found on [the HID Page][2] at * @@ -29,90 +31,90 @@ // ---------------------------------------------------------------------------- -// Name ID Usage Type Section of HID Tables -// --------------------------- ---- ---------- ---------------------- +// Name ID Usage Type Section of HID Tables +// ---------------------------- ---- ---------- --------------------- -// (Undefined) 0x00 // - - +// (Undefined) 0x00 // - - -#define LED_NumLock 0x01 // OOC 11.1 -#define LED_CapsLock 0x02 // OOC 11.1 -#define LED_ScrollLock 0x03 // OOC 11.1 -#define LED_Compose 0x04 // OOC 11.1 -#define LED_Kana 0x05 // OOC 11.1 -#define LED_Power 0x06 // OOC 11.6 -#define LED_Shift 0x07 // OOC 11.1 -#define LED_DoNotDisturb 0x08 // OOC 11.2 -#define LED_Mute 0x09 // OOC 11.3 -#define LED_ToneEnable 0x0A // OOC 11.3 -#define LED_HighCutFilter 0x0B // OOC 11.3 -#define LED_LowCutFilter 0x0C // OOC 11.3 -#define LED_EqualizerEnable 0x0D // OOC 11.3 -#define LED_SoundFieldOn 0x0E // OOC 11.3 -#define LED_SurroundOn 0x0F // OOC 11.3 -#define LED_Repeat 0x10 // OOC 11.3 -#define LED_Stereo 0x11 // OOC 11.3 -#define LED_SamplingRateDetect 0x12 // OOC 11.3 -#define LED_Spinning 0x13 // OOC 11.4 -#define LED_CAV 0x14 // OOC 11.3 -#define LED_CLV 0x15 // OOC 11.3 -#define LED_RecordingFormatDetect 0x16 // OOC 11.4 -#define LED_OffHook 0x17 // OOC 11.2 -#define LED_Ring 0x18 // OOC 11.2 -#define LED_MessageWaiting 0x19 // OOC 11.2 -#define LED_DataMode 0x1A // OOC 11.2 -#define LED_BatteryOperation 0x1B // OOC 11.6 -#define LED_BatteryOK 0x1C // OOC 11.6 -#define LED_BatteryLow 0x1D // OOC 11.6 -#define LED_Speaker 0x1E // OOC 11.2 -#define LED_HeadSet 0x1F // OOC 11.2 -#define LED_Hold 0x20 // OOC 11.2 -#define LED_Microphone 0x21 // OOC 11.2 -#define LED_Coverage 0x22 // OOC 11.2 -#define LED_NightMode 0x23 // OOC 11.2 -#define LED_SendCalls 0x24 // OOC 11.2 -#define LED_CallPickup 0x25 // OOC 11.2 -#define LED_Conference 0x26 // OOC 11.2 -#define LED_Standby 0x27 // OOC 11.6 -#define LED_CameraOn 0x28 // OOC 11.3 -#define LED_CameraOff 0x29 // OOC 11.3 -#define LED_OnLine 0x2A // OOC 11.6 -#define LED_OffLine 0x2B // OOC 11.6 -#define LED_Busy 0x2C // OOC 11.6 -#define LED_Ready 0x2D // OOC 11.6 -#define LED_PaperOut 0x2E // OOC 11.5 -#define LED_PaperJam 0x2F // OOC 11.5 -#define LED_Remote 0x30 // OOC 11.6 -#define LED_Forward 0x31 // OOC 11.4 -#define LED_Reverse 0x32 // OOC 11.4 -#define LED_Stop 0x33 // OOC 11.4 -#define LED_Rewind 0x34 // OOC 11.4 -#define LED_FastForward 0x35 // OOC 11.4 -#define LED_Play 0x36 // OOC 11.4 -#define LED_Pause 0x37 // OOC 11.4 -#define LED_Record 0x38 // OOC 11.4 -#define LED_Error 0x39 // OOC 11.6 -#define LED_UsageSelectedIndicator 0x3A // US 11.6 -#define LED_UsageInUseIndicator 0x3B // US 11.6 -#define LED_UsageMultiModeIndicator 0x3C // UM 11.6 -#define LED_IndicatorOn 0x3D // Sel 11.6 -#define LED_IndicatorFlash 0x3E // Sel 11.6 -#define LED_IndicatorSlowBlink 0x3F // Sel 11.6 -#define LED_IndicatorFastBlink 0x40 // Sel 11.6 -#define LED_IndicatorOff 0x41 // Sel 11.6 -#define LED_FlashOnTime 0x42 // DV 11.6 -#define LED_SlowBlinkOnTime 0x43 // DV 11.6 -#define LED_SlowBlinkOffTime 0x44 // DV 11.6 -#define LED_FastBlinkOnTime 0x45 // DV 11.6 -#define LED_FastBlinkOffTime 0x46 // DV 11.6 -#define LED_UsageIndicatorColor 0x47 // UM 11.6 -#define LED_IndicatorRed 0x48 // Sel 11.6 -#define LED_IndicatorGreen 0x49 // Sel 11.6 -#define LED_IndicatorAmber 0x4A // Sel 11.6 -#define LED_GenericIndicator 0x4B // OOC 11.6 -#define LED_SystemSuspend 0x4C // OOC 11.6 -#define LED_ExternalPowerConnected 0x4D // OOC 11.6 +#define LED__NumLock 0x01 // OOC 11.1 +#define LED__CapsLock 0x02 // OOC 11.1 +#define LED__ScrollLock 0x03 // OOC 11.1 +#define LED__Compose 0x04 // OOC 11.1 +#define LED__Kana 0x05 // OOC 11.1 +#define LED__Power 0x06 // OOC 11.6 +#define LED__Shift 0x07 // OOC 11.1 +#define LED__DoNotDisturb 0x08 // OOC 11.2 +#define LED__Mute 0x09 // OOC 11.3 +#define LED__ToneEnable 0x0A // OOC 11.3 +#define LED__HighCutFilter 0x0B // OOC 11.3 +#define LED__LowCutFilter 0x0C // OOC 11.3 +#define LED__EqualizerEnable 0x0D // OOC 11.3 +#define LED__SoundFieldOn 0x0E // OOC 11.3 +#define LED__SurroundOn 0x0F // OOC 11.3 +#define LED__Repeat 0x10 // OOC 11.3 +#define LED__Stereo 0x11 // OOC 11.3 +#define LED__SamplingRateDetect 0x12 // OOC 11.3 +#define LED__Spinning 0x13 // OOC 11.4 +#define LED__CAV 0x14 // OOC 11.3 +#define LED__CLV 0x15 // OOC 11.3 +#define LED__RecordingFormatDetect 0x16 // OOC 11.4 +#define LED__OffHook 0x17 // OOC 11.2 +#define LED__Ring 0x18 // OOC 11.2 +#define LED__MessageWaiting 0x19 // OOC 11.2 +#define LED__DataMode 0x1A // OOC 11.2 +#define LED__BatteryOperation 0x1B // OOC 11.6 +#define LED__BatteryOK 0x1C // OOC 11.6 +#define LED__BatteryLow 0x1D // OOC 11.6 +#define LED__Speaker 0x1E // OOC 11.2 +#define LED__HeadSet 0x1F // OOC 11.2 +#define LED__Hold 0x20 // OOC 11.2 +#define LED__Microphone 0x21 // OOC 11.2 +#define LED__Coverage 0x22 // OOC 11.2 +#define LED__NightMode 0x23 // OOC 11.2 +#define LED__SendCalls 0x24 // OOC 11.2 +#define LED__CallPickup 0x25 // OOC 11.2 +#define LED__Conference 0x26 // OOC 11.2 +#define LED__Standby 0x27 // OOC 11.6 +#define LED__CameraOn 0x28 // OOC 11.3 +#define LED__CameraOff 0x29 // OOC 11.3 +#define LED__OnLine 0x2A // OOC 11.6 +#define LED__OffLine 0x2B // OOC 11.6 +#define LED__Busy 0x2C // OOC 11.6 +#define LED__Ready 0x2D // OOC 11.6 +#define LED__PaperOut 0x2E // OOC 11.5 +#define LED__PaperJam 0x2F // OOC 11.5 +#define LED__Remote 0x30 // OOC 11.6 +#define LED__Forward 0x31 // OOC 11.4 +#define LED__Reverse 0x32 // OOC 11.4 +#define LED__Stop 0x33 // OOC 11.4 +#define LED__Rewind 0x34 // OOC 11.4 +#define LED__FastForward 0x35 // OOC 11.4 +#define LED__Play 0x36 // OOC 11.4 +#define LED__Pause 0x37 // OOC 11.4 +#define LED__Record 0x38 // OOC 11.4 +#define LED__Error 0x39 // OOC 11.6 +#define LED__UsageSelectedIndicator 0x3A // US 11.6 +#define LED__UsageInUseIndicator 0x3B // US 11.6 +#define LED__UsageMultiModeIndicator 0x3C // UM 11.6 +#define LED__IndicatorOn 0x3D // Sel 11.6 +#define LED__IndicatorFlash 0x3E // Sel 11.6 +#define LED__IndicatorSlowBlink 0x3F // Sel 11.6 +#define LED__IndicatorFastBlink 0x40 // Sel 11.6 +#define LED__IndicatorOff 0x41 // Sel 11.6 +#define LED__FlashOnTime 0x42 // DV 11.6 +#define LED__SlowBlinkOnTime 0x43 // DV 11.6 +#define LED__SlowBlinkOffTime 0x44 // DV 11.6 +#define LED__FastBlinkOnTime 0x45 // DV 11.6 +#define LED__FastBlinkOffTime 0x46 // DV 11.6 +#define LED__UsageIndicatorColor 0x47 // UM 11.6 +#define LED__IndicatorRed 0x48 // Sel 11.6 +#define LED__IndicatorGreen 0x49 // Sel 11.6 +#define LED__IndicatorAmber 0x4A // Sel 11.6 +#define LED__GenericIndicator 0x4B // OOC 11.6 +#define LED__SystemSuspend 0x4C // OOC 11.6 +#define LED__ExternalPowerConnected 0x4D // OOC 11.6 -// (Reserved) 0x4E..0xFFFF // - - +// (Reserved) 0x4E..0xFFFF // - - // ---------------------------------------------------------------------------- diff --git a/firmware/options.mk b/firmware/options.mk index 9824c7d..9beb6e4 100644 --- a/firmware/options.mk +++ b/firmware/options.mk @@ -1,9 +1,10 @@ # ---------------------------------------------------------------------------- # Global options # ---------------------------------------------------------------------------- -# Copyright (c) 2012 Ben Blazak +# Copyright (c) 2013 Ben Blazak # Released under The MIT License (see "doc/license.md") # Project located at # ---------------------------------------------------------------------------- +# TODO diff --git a/firmware/readme.md b/firmware/readme.md index c8ccba7..ee782e7 100644 --- a/firmware/readme.md +++ b/firmware/readme.md @@ -10,55 +10,76 @@ ### Comments `/** ... */` comments are to be written in YAML, so they can be processed by -external tools to generate documentation, and for other purposes. The format -is as follows (with all elements being optional): +external tools to generate documentation, and for other purposes. - - .ignore: +* When read the following will be stripped: + * The first line (typically `/**`) + * The last line (typically ` */`) + * The first two characters of each line (typically ` *`) - - file description: - - - function: - name: - description: - arguments: - - type: - name: - description: - values: - - name: - description: - notes: - - - notes: - - - return value: - type: - description: - values: - - name: - description: - notes: - - - notes: - - - notes: - - +* All elements are optional. +* All list elements are repeatable. +* All of these elements may all be specified from within any scanned file. +* Some of these elements have defaults (commented below); giving them a value + explicitly will override that. +* The element `.ignore` may appear in any list, and should be ignored. -### "Namespace" prefixes -"Namespace" prefixes are prepended to variables and macros (in lower and upper -case, respectively), sometimes hierarchically, separated by `__`. I call them -what I do because this is somewhat similar to using `::` for namespace -separation as in C++. + - &atom '||' -* `KB`: from `firmware/keyboard/...` + - &value-map + type: *atom + name: *atom + description: *atom + values: [ *value-map ] + notes: [ *atom ] -* `MAKE`: passed to the compiler by `make` (i.e. a global option) + + - &description-map + # the file description + description: *atom + + - &function-map + function: + << : *value-map + arguments: *value-map + return value: *value-map + + - ¯o-map + macro: { << : *value-map } + + - &typedef-map + typedef: { << : *value-map } + + + - &file-map + file: + # name: taken from the filesystem + # description: taken from the '[filename].md' if it exists + << : [ *description-map, *value-map ] + functions: [ *function-map ] + macros: [ *macro-map ] + typedefs: [ *typedef-map ] + + - &directory-map + directory: + # name: taken from filesystem + # description: taken from the 'readme.md' if it exists + << : *value-map + files: [ *file-map ] + directories: [ *directory-map ] + + - &project-map + project: + << : *value-map + directories: [ *directory-map ] + + - projects: [ *project-map ] ------------------------------------------------------------------------------- -Copyright © 2012 Ben Blazak +Copyright © 2012, 2013 Ben Blazak Released under The MIT License (see "license.md") Project located at