diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2015-10-26 16:32:37 -0400 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2015-10-26 16:32:37 -0400 |
| commit | 35a81f5b8b081e1607a7c04489b01f551c3213cc (patch) | |
| tree | 4671909bd5ac7c3ca7afaf60fb6a70106f5090dc /quantum | |
| parent | 46e7fb2d3ccd699c0a1b1fd9d02860b1f2a44141 (diff) | |
| download | qmk_firmware-35a81f5b8b081e1607a7c04489b01f551c3213cc.tar.gz qmk_firmware-35a81f5b8b081e1607a7c04489b01f551c3213cc.zip | |
added ergodox
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/config_common.h | 116 | ||||
| -rw-r--r-- | quantum/keymap_common.c | 19 | ||||
| -rw-r--r-- | quantum/matrix.c | 10 |
3 files changed, 141 insertions, 4 deletions
diff --git a/quantum/config_common.h b/quantum/config_common.h new file mode 100644 index 000000000..da53fce89 --- /dev/null +++ b/quantum/config_common.h | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | #ifndef CONFIG_DEFINITIONS_H | ||
| 2 | #define CONFIG_DEFINITIONS_H | ||
| 3 | |||
| 4 | #define B0 0x20 | ||
| 5 | #define B1 0x21 | ||
| 6 | #define B2 0x22 | ||
| 7 | #define B3 0x23 | ||
| 8 | #define B4 0x24 | ||
| 9 | #define B5 0x25 | ||
| 10 | #define B6 0x26 | ||
| 11 | #define B7 0x27 | ||
| 12 | #define C0 0x30 | ||
| 13 | #define C1 0x31 | ||
| 14 | #define C2 0x32 | ||
| 15 | #define C3 0x33 | ||
| 16 | #define C4 0x34 | ||
| 17 | #define C5 0x35 | ||
| 18 | #define C6 0x36 | ||
| 19 | #define C7 0x37 | ||
| 20 | #define D0 0x40 | ||
| 21 | #define D1 0x41 | ||
| 22 | #define D2 0x42 | ||
| 23 | #define D3 0x43 | ||
| 24 | #define D4 0x44 | ||
| 25 | #define D5 0x45 | ||
| 26 | #define D6 0x46 | ||
| 27 | #define D7 0x47 | ||
| 28 | #define E0 0x50 | ||
| 29 | #define E1 0x51 | ||
| 30 | #define E2 0x52 | ||
| 31 | #define E3 0x53 | ||
| 32 | #define E4 0x54 | ||
| 33 | #define E5 0x55 | ||
| 34 | #define E6 0x56 | ||
| 35 | #define E7 0x57 | ||
| 36 | #define F0 0x60 | ||
| 37 | #define F1 0x61 | ||
| 38 | #define F2 0x62 | ||
| 39 | #define F3 0x63 | ||
| 40 | #define F4 0x64 | ||
| 41 | #define F5 0x65 | ||
| 42 | #define F6 0x66 | ||
| 43 | #define F7 0x67 | ||
| 44 | |||
| 45 | #define COL2ROW 0x0 | ||
| 46 | #define ROW2COL 0x1 | ||
| 47 | |||
| 48 | #ifdef BLUETOOTH_ENABLE | ||
| 49 | #ifdef __AVR_ATmega32U4__ | ||
| 50 | #define SERIAL_UART_BAUD 9600 | ||
| 51 | #define SERIAL_UART_DATA UDR1 | ||
| 52 | #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) | ||
| 53 | #define SERIAL_UART_RXD_VECT USART1_RX_vect | ||
| 54 | #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1)) | ||
| 55 | #define SERIAL_UART_INIT() do { \ | ||
| 56 | UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \ | ||
| 57 | UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \ | ||
| 58 | UCSR1B = (1<<TXEN1); /* TX: enable */ \ | ||
| 59 | UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \ | ||
| 60 | (0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \ | ||
| 61 | sei(); \ | ||
| 62 | } while(0) | ||
| 63 | #else | ||
| 64 | # error "USART configuration is needed." | ||
| 65 | #endif | ||
| 66 | |||
| 67 | |||
| 68 | // I'm fairly sure these aren't needed, but oh well - Jack | ||
| 69 | |||
| 70 | /* | ||
| 71 | * PS/2 Interrupt configuration | ||
| 72 | */ | ||
| 73 | #ifdef PS2_USE_INT | ||
| 74 | /* uses INT1 for clock line(ATMega32U4) */ | ||
| 75 | #define PS2_CLOCK_PORT PORTD | ||
| 76 | #define PS2_CLOCK_PIN PIND | ||
| 77 | #define PS2_CLOCK_DDR DDRD | ||
| 78 | #define PS2_CLOCK_BIT 1 | ||
| 79 | |||
| 80 | #define PS2_DATA_PORT PORTD | ||
| 81 | #define PS2_DATA_PIN PIND | ||
| 82 | #define PS2_DATA_DDR DDRD | ||
| 83 | #define PS2_DATA_BIT 0 | ||
| 84 | |||
| 85 | #define PS2_INT_INIT() do { \ | ||
| 86 | EICRA |= ((1<<ISC11) | \ | ||
| 87 | (0<<ISC10)); \ | ||
| 88 | } while (0) | ||
| 89 | #define PS2_INT_ON() do { \ | ||
| 90 | EIMSK |= (1<<INT1); \ | ||
| 91 | } while (0) | ||
| 92 | #define PS2_INT_OFF() do { \ | ||
| 93 | EIMSK &= ~(1<<INT1); \ | ||
| 94 | } while (0) | ||
| 95 | #define PS2_INT_VECT INT1_vect | ||
| 96 | #endif | ||
| 97 | |||
| 98 | /* | ||
| 99 | * PS/2 Busywait configuration | ||
| 100 | */ | ||
| 101 | #ifdef PS2_USE_BUSYWAIT | ||
| 102 | #define PS2_CLOCK_PORT PORTD | ||
| 103 | #define PS2_CLOCK_PIN PIND | ||
| 104 | #define PS2_CLOCK_DDR DDRD | ||
| 105 | #define PS2_CLOCK_BIT 1 | ||
| 106 | |||
| 107 | #define PS2_DATA_PORT PORTD | ||
| 108 | #define PS2_DATA_PIN PIND | ||
| 109 | #define PS2_DATA_DDR DDRD | ||
| 110 | #define PS2_DATA_BIT 0 | ||
| 111 | #endif | ||
| 112 | |||
| 113 | #endif | ||
| 114 | |||
| 115 | #endif | ||
| 116 | |||
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 66cf2883c..c9e1494fd 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c | |||
| @@ -37,15 +37,18 @@ action_t action_for_key(uint8_t layer, keypos_t key) | |||
| 37 | // Has a modifier | 37 | // Has a modifier |
| 38 | action_t action; | 38 | action_t action; |
| 39 | // Split it up | 39 | // Split it up |
| 40 | action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); | 40 | action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key |
| 41 | return action; | 41 | return action; |
| 42 | } else if (keycode >= 0x2000 && keycode < 0x3000) { | 42 | } else if (keycode >= 0x2000 && keycode < 0x3000) { |
| 43 | // Is a shortcut for function layer, pull last 12bits | 43 | // Is a shortcut for function layer, pull last 12bits |
| 44 | // This means we have 4,096 FN macros at our disposal | ||
| 44 | return keymap_func_to_action(keycode & 0xFFF); | 45 | return keymap_func_to_action(keycode & 0xFFF); |
| 45 | } else if (keycode >= 0x3000 && keycode < 0x4000) { | 46 | } else if (keycode >= 0x3000 && keycode < 0x4000) { |
| 47 | // When the code starts with 3, it's an action macro. | ||
| 46 | action_t action; | 48 | action_t action; |
| 47 | action.code = ACTION_MACRO(keycode & 0xFF); | 49 | action.code = ACTION_MACRO(keycode & 0xFF); |
| 48 | return action; | 50 | return action; |
| 51 | #ifdef BACKLIGHT_ENABLE | ||
| 49 | } else if (keycode >= BL_0 & keycode <= BL_15) { | 52 | } else if (keycode >= BL_0 & keycode <= BL_15) { |
| 50 | action_t action; | 53 | action_t action; |
| 51 | action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F); | 54 | action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F); |
| @@ -66,10 +69,12 @@ action_t action_for_key(uint8_t layer, keypos_t key) | |||
| 66 | action_t action; | 69 | action_t action; |
| 67 | action.code = ACTION_BACKLIGHT_STEP(); | 70 | action.code = ACTION_BACKLIGHT_STEP(); |
| 68 | return action; | 71 | return action; |
| 69 | } else if (keycode == RESET) { | 72 | #endif |
| 73 | } else if (keycode == RESET) { // RESET is 0x5000, which is why this is here | ||
| 70 | bootloader_jump(); | 74 | bootloader_jump(); |
| 71 | return; | 75 | return; |
| 72 | } else if (keycode == DEBUG) { | 76 | } else if (keycode == DEBUG) { // DEBUG is 0x5001 |
| 77 | // TODO: Does this actually work? | ||
| 73 | print("\nDEBUG: enabled.\n"); | 78 | print("\nDEBUG: enabled.\n"); |
| 74 | debug_enable = true; | 79 | debug_enable = true; |
| 75 | return; | 80 | return; |
| @@ -79,15 +84,21 @@ action_t action_for_key(uint8_t layer, keypos_t key) | |||
| 79 | action_t action; | 84 | action_t action; |
| 80 | action.code = ACTION_LAYER_SET(layer, when); | 85 | action.code = ACTION_LAYER_SET(layer, when); |
| 81 | return action; | 86 | return action; |
| 87 | #ifdef MIDI_ENABLE | ||
| 82 | } else if (keycode >= 0x6000 && keycode < 0x7000) { | 88 | } else if (keycode >= 0x6000 && keycode < 0x7000) { |
| 83 | action_t action; | 89 | action_t action; |
| 84 | action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8); | 90 | action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8); |
| 85 | return action; | 91 | return action; |
| 92 | #endif | ||
| 93 | #ifdef UNICODE_ENABLE | ||
| 86 | } else if (keycode >= 0x8000) { | 94 | } else if (keycode >= 0x8000) { |
| 87 | action_t action; | 95 | action_t action; |
| 88 | uint16_t unicode = keycode & ~(0x8000); | 96 | uint16_t unicode = keycode & ~(0x8000); |
| 89 | action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8); | 97 | action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8); |
| 90 | return action; | 98 | return action; |
| 99 | #endif | ||
| 100 | } else { | ||
| 101 | |||
| 91 | } | 102 | } |
| 92 | 103 | ||
| 93 | switch (keycode) { | 104 | switch (keycode) { |
diff --git a/quantum/matrix.c b/quantum/matrix.c index 97642a4a4..95bf4c097 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c | |||
| @@ -47,6 +47,16 @@ static void init_cols(void); | |||
| 47 | static void unselect_rows(void); | 47 | static void unselect_rows(void); |
| 48 | static void select_row(uint8_t row); | 48 | static void select_row(uint8_t row); |
| 49 | 49 | ||
| 50 | __attribute__ ((weak)) | ||
| 51 | void * matrix_init_kb(void) { | ||
| 52 | |||
| 53 | }; | ||
| 54 | |||
| 55 | __attribute__ ((weak)) | ||
| 56 | void * matrix_scan_kb(void) { | ||
| 57 | |||
| 58 | }; | ||
| 59 | |||
| 50 | inline | 60 | inline |
| 51 | uint8_t matrix_rows(void) | 61 | uint8_t matrix_rows(void) |
| 52 | { | 62 | { |
