+#ifdef KEY_LOCK_ENABLE
+ #include "process_key_lock.h"
+#endif
+
+#ifdef TERMINAL_ENABLE
+ #include "process_terminal.h"
+#else
+ #include "process_terminal_nop.h"
+#endif
+
+#ifdef HD44780_ENABLE
+ #include "hd44780.h"
+#endif
+
+//Function substitutions to ease GPIO manipulation
+#ifdef __AVR__
+ #define PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset)
+
+ #define pin_t uint8_t
+ #define setPinInput(pin) PIN_ADDRESS(pin, 1) &= ~ _BV(pin & 0xF)
+ #define setPinInputHigh(pin) ({\
+ PIN_ADDRESS(pin, 1) &= ~ _BV(pin & 0xF);\
+ PIN_ADDRESS(pin, 2) |= _BV(pin & 0xF);\
+ })
+ #define setPinInputLow(pin) _Static_assert(0, "AVR Processors cannot impliment an input as pull low")
+ #define setPinOutput(pin) PIN_ADDRESS(pin, 1) |= _BV(pin & 0xF)
+
+ #define writePinHigh(pin) PIN_ADDRESS(pin, 2) |= _BV(pin & 0xF)
+ #define writePinLow(pin) PIN_ADDRESS(pin, 2) &= ~_BV(pin & 0xF)
+ static inline void writePin(pin_t pin, uint8_t level){
+ if (level){
+ PIN_ADDRESS(pin, 2) |= _BV(pin & 0xF);
+ } else {
+ PIN_ADDRESS(pin, 2) &= ~_BV(pin & 0xF);
+ }
+ }
+
+ #define readPin(pin) (PIN_ADDRESS(pin, 0) & _BV(pin & 0xF))
+#elif defined(PROTOCOL_CHIBIOS)
+ #define pin_t ioline_t
+ #define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT)
+ #define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP)
+ #define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN)
+ #define setPinOutput(pin) palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL)
+
+ #define writePinHigh(pin) palSetLine(pin)
+ #define writePinLow(pin) palClearLine(pin)
+ static inline void writePin(pin_t pin, uint8_t level){
+ if (level){
+ palSetLine(pin);
+ } else {
+ palClearLine(pin);
+ }
+ }
+
+ #define readPin(pin) palReadLine(pin)
+#endif
+
+#define STRINGIZE(z) #z
+#define ADD_SLASH_X(y) STRINGIZE(\x ## y)
+#define SYMBOL_STR(x) ADD_SLASH_X(x)
+
+#define SS_TAP(keycode) "\1" SYMBOL_STR(keycode)
+#define SS_DOWN(keycode) "\2" SYMBOL_STR(keycode)
+#define SS_UP(keycode) "\3" SYMBOL_STR(keycode)
+
+#define SS_LCTRL(string) SS_DOWN(X_LCTRL) string SS_UP(X_LCTRL)
+#define SS_LGUI(string) SS_DOWN(X_LGUI) string SS_UP(X_LGUI)
+#define SS_LCMD(string) SS_LGUI(string)
+#define SS_LWIN(string) SS_LGUI(string)
+#define SS_LALT(string) SS_DOWN(X_LALT) string SS_UP(X_LALT)
+#define SS_LSFT(string) SS_DOWN(X_LSHIFT) string SS_UP(X_LSHIFT)
+#define SS_RALT(string) SS_DOWN(X_RALT) string SS_UP(X_RALT)
+
+#define SEND_STRING(str) send_string_P(PSTR(str))
+extern const bool ascii_to_shift_lut[0x80];
+extern const uint8_t ascii_to_keycode_lut[0x80];