X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=quantum%2Fquantum.h;h=f78915fdfbc0376b77d7e5473badf28b65322da8;hb=40bf3a2ce9ec781cc2ff7218f909ffdbece44e97;hp=6833332117b8563ea13fe35f50259245aeec5f18;hpb=7fe03d085c2ecaa324779093eceb1a12313ca25d;p=qmk_firmware.git diff --git a/quantum/quantum.h b/quantum/quantum.h index 683333211..f78915fdf 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -31,7 +31,7 @@ #include "backlight.h" #endif #if !defined(RGBLIGHT_ENABLE) && !defined(RGB_MATRIX_ENABLE) - #include "rgb.h" + #include "rgb.h" #endif #ifdef RGBLIGHT_ENABLE #include "rgblight.h" @@ -108,7 +108,9 @@ extern uint32_t default_layer_state; #include "process_unicodemap.h" #endif -#include "process_tap_dance.h" +#ifdef TAP_DANCE_ENABLE + #include "process_tap_dance.h" +#endif #ifdef PRINTING_ENABLE #include "process_printer.h" @@ -138,26 +140,28 @@ extern uint32_t default_layer_state; //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) _SFR_IO8((pin >> 4) + 1) &= ~ _BV(pin & 0xF) + #define setPinInput(pin) PIN_ADDRESS(pin, 1) &= ~ _BV(pin & 0xF) #define setPinInputHigh(pin) ({\ - _SFR_IO8((pin >> 4) + 1) &= ~ _BV(pin & 0xF);\ - _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);\ + 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) _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF) + #define setPinOutput(pin) PIN_ADDRESS(pin, 1) |= _BV(pin & 0xF) - #define writePinHigh(pin) _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF) - #define writePinLow(pin) _SFR_IO8((pin >> 4) + 2) &= ~_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){ - _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); + PIN_ADDRESS(pin, 2) |= _BV(pin & 0xF); } else { - _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); + PIN_ADDRESS(pin, 2) &= ~_BV(pin & 0xF); } } - #define readPin(pin) (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)) + #define readPin(pin) ((bool)(PIN_ADDRESS(pin, 0) & _BV(pin & 0xF))) #elif defined(PROTOCOL_CHIBIOS) #define pin_t ioline_t #define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT) @@ -193,6 +197,7 @@ extern uint32_t default_layer_state; #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 SS_ALGR(string) SS_RALT(string) #define SEND_STRING(str) send_string_P(PSTR(str)) extern const bool ascii_to_shift_lut[0x80]; @@ -222,13 +227,23 @@ bool process_action_kb(keyrecord_t *record); bool process_record_kb(uint16_t keycode, keyrecord_t *record); bool process_record_user(uint16_t keycode, keyrecord_t *record); +#ifndef BOOTMAGIC_LITE_COLUMN + #define BOOTMAGIC_LITE_COLUMN 0 +#endif +#ifndef BOOTMAGIC_LITE_ROW + #define BOOTMAGIC_LITE_ROW 0 +#endif + +void bootmagic_lite(void); + void reset_keyboard(void); void startup_user(void); void shutdown_user(void); -void register_code16 (uint16_t code); -void unregister_code16 (uint16_t code); +void register_code16(uint16_t code); +void unregister_code16(uint16_t code); +void tap_code16(uint16_t code); #ifdef BACKLIGHT_ENABLE void backlight_init_ports(void);