diff options
| author | William Wilson <wrwilson@smu.edu> | 2017-10-27 22:33:32 -0500 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-10-31 00:30:24 -0400 |
| commit | 38da7795f4129ccf472ada352391e365acb3ae4b (patch) | |
| tree | 25786279d88460bc3f67c9640fda40431837ada7 | |
| parent | 8c10b60c5f6f53c6a58ad49908fee738f1e50769 (diff) | |
| download | qmk_firmware-38da7795f4129ccf472ada352391e365acb3ae4b.tar.gz qmk_firmware-38da7795f4129ccf472ada352391e365acb3ae4b.zip | |
Added Chimera Ortho keymap
| -rw-r--r-- | keyboards/chimera_ortho/chimera_ortho.c | 31 | ||||
| -rw-r--r-- | keyboards/chimera_ortho/chimera_ortho.h | 66 | ||||
| -rw-r--r-- | keyboards/chimera_ortho/config.h | 87 | ||||
| -rw-r--r-- | keyboards/chimera_ortho/keymaps/default/keymap.c | 193 | ||||
| -rw-r--r-- | keyboards/chimera_ortho/matrix.c | 164 | ||||
| -rw-r--r-- | keyboards/chimera_ortho/rules.mk | 78 |
6 files changed, 619 insertions, 0 deletions
diff --git a/keyboards/chimera_ortho/chimera_ortho.c b/keyboards/chimera_ortho/chimera_ortho.c new file mode 100644 index 000000000..2a602cf2f --- /dev/null +++ b/keyboards/chimera_ortho/chimera_ortho.c | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #include "chimera_ortho.h" | ||
| 2 | |||
| 3 | void uart_init(void) { | ||
| 4 | SERIAL_UART_INIT(); | ||
| 5 | } | ||
| 6 | |||
| 7 | void led_init(void) { | ||
| 8 | DDRD |= (1<<1); | ||
| 9 | PORTD |= (1<<1); | ||
| 10 | DDRF |= (1<<4) | (1<<5); | ||
| 11 | PORTF |= (1<<4) | (1<<5); | ||
| 12 | } | ||
| 13 | |||
| 14 | |||
| 15 | void matrix_init_kb(void) { | ||
| 16 | // put your keyboard start-up code here | ||
| 17 | // runs once when the firmware starts up | ||
| 18 | matrix_init_user(); | ||
| 19 | uart_init(); | ||
| 20 | led_init(); | ||
| 21 | } | ||
| 22 | |||
| 23 | void matrix_scan_kb(void) { | ||
| 24 | // put your looping keyboard code here | ||
| 25 | // runs every cycle (a lot) | ||
| 26 | matrix_scan_user(); | ||
| 27 | } | ||
| 28 | |||
| 29 | void led_set_kb(uint8_t usb_led) { | ||
| 30 | |||
| 31 | } | ||
diff --git a/keyboards/chimera_ortho/chimera_ortho.h b/keyboards/chimera_ortho/chimera_ortho.h new file mode 100644 index 000000000..c21b37ff8 --- /dev/null +++ b/keyboards/chimera_ortho/chimera_ortho.h | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | #ifndef CHIMERA_ORTHO_H | ||
| 2 | #define CHIMERA_ORTHO_H | ||
| 3 | |||
| 4 | #include "quantum.h" | ||
| 5 | #include "matrix.h" | ||
| 6 | #include "backlight.h" | ||
| 7 | #include <stddef.h> | ||
| 8 | |||
| 9 | #define red_led_off PORTF |= (1<<5) | ||
| 10 | #define red_led_on PORTF &= ~(1<<5) | ||
| 11 | #define blu_led_off PORTF |= (1<<4) | ||
| 12 | #define blu_led_on PORTF &= ~(1<<4) | ||
| 13 | #define grn_led_off PORTD |= (1<<1) | ||
| 14 | #define grn_led_on PORTD &= ~(1<<1) | ||
| 15 | |||
| 16 | #define set_led_off red_led_off; grn_led_off; blu_led_off | ||
| 17 | #define set_led_red red_led_on; grn_led_off; blu_led_off | ||
| 18 | #define set_led_blue red_led_off; grn_led_off; blu_led_on | ||
| 19 | #define set_led_green red_led_off; grn_led_on; blu_led_off | ||
| 20 | #define set_led_yellow red_led_on; grn_led_on; blu_led_off | ||
| 21 | #define set_led_magenta red_led_on; grn_led_off; blu_led_on | ||
| 22 | #define set_led_cyan red_led_off; grn_led_on; blu_led_on | ||
| 23 | #define set_led_white red_led_on; grn_led_on; blu_led_on | ||
| 24 | |||
| 25 | /* | ||
| 26 | #define LED_B 5 | ||
| 27 | #define LED_R 6 | ||
| 28 | #define LED_G 7 | ||
| 29 | |||
| 30 | #define all_leds_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G) | ||
| 31 | |||
| 32 | #define red_led_on PORTF |= (1<<LED_R) | ||
| 33 | #define red_led_off PORTF &= ~(1<<LED_R) | ||
| 34 | #define grn_led_on PORTF |= (1<<LED_G) | ||
| 35 | #define grn_led_off PORTF &= ~(1<<LED_G) | ||
| 36 | #define blu_led_on PORTF |= (1<<LED_B) | ||
| 37 | #define blu_led_off PORTF &= ~(1<<LED_B) | ||
| 38 | |||
| 39 | #define set_led_off PORTF &= ~(1<<LED_B) & ~(1<<LED_R) & ~(1<<LED_G) | ||
| 40 | #define set_led_red PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_G) | (1<<LED_R) | ||
| 41 | #define set_led_blue PORTF = PORTF & ~(1<<LED_G) & ~(1<<LED_R) | (1<<LED_B) | ||
| 42 | #define set_led_green PORTF = PORTF & ~(1<<LED_B) & ~(1<<LED_R) | (1<<LED_G) | ||
| 43 | #define set_led_yellow PORTF = PORTF & ~(1<<LED_B) | (1<<LED_R) | (1<<LED_G) | ||
| 44 | #define set_led_magenta PORTF = PORTF & ~(1<<LED_G) | (1<<LED_R) | (1<<LED_B) | ||
| 45 | #define set_led_cyan PORTF = PORTF & ~(1<<LED_R) | (1<<LED_B) | (1<<LED_G) | ||
| 46 | #define set_led_white PORTF |= (1<<LED_B) | (1<<LED_R) | (1<<LED_G) | ||
| 47 | */ | ||
| 48 | |||
| 49 | // This a shortcut to help you visually see your layout. | ||
| 50 | // The first section contains all of the arguements | ||
| 51 | // The second converts the arguments into a two-dimensional array | ||
| 52 | #define KEYMAP( \ | ||
| 53 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12, k13, \ | ||
| 54 | k14, k15, k16, k17, k18, k19, k20, k21, k22, k23, k24, k25, k26, k27, \ | ||
| 55 | k28, k29, k31, k32, k33, k34, k35, k36, k37, k38, k41, k42, k43, k44,\ | ||
| 56 | k45, k46, k47, k48 \ | ||
| 57 | ) \ | ||
| 58 | { \ | ||
| 59 | { KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_##k08, KC_##k09, KC_##k10, KC_##k11, KC_##k12 }, \ | ||
| 60 | { KC_##k15, KC_##k16, KC_##k17, KC_##k18, KC_##k19, KC_##k22, KC_##k23, KC_##k24, KC_##k25, KC_##k26 }, \ | ||
| 61 | { KC_##k29, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k37, KC_##k38, KC_##k41, KC_##k42, KC_##k43 }, \ | ||
| 62 | { KC_NO, KC_##k06, KC_##k20, KC_##k35, KC_##k46, KC_##k47, KC_##k36, KC_##k21, KC_##k07, KC_NO }, \ | ||
| 63 | { KC_NO, KC_##k28, KC_##k14, KC_##k00, KC_##k45, KC_##k48, KC_##k13, KC_##k27, KC_##k44, KC_NO }, \ | ||
| 64 | } | ||
| 65 | |||
| 66 | #endif | ||
diff --git a/keyboards/chimera_ortho/config.h b/keyboards/chimera_ortho/config.h new file mode 100644 index 000000000..44c6212b1 --- /dev/null +++ b/keyboards/chimera_ortho/config.h | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | /* USB Device descriptor parameter */ | ||
| 24 | |||
| 25 | #define VENDOR_ID 0xFEED | ||
| 26 | #define PRODUCT_ID 0x6060 | ||
| 27 | #define DEVICE_VER 0x0001 | ||
| 28 | #define MANUFACTURER unknown | ||
| 29 | #define PRODUCT Chimera Ortho | ||
| 30 | #define DESCRIPTION q.m.k. keyboard firmware for Chimera Ortho | ||
| 31 | |||
| 32 | /* key matrix size */ | ||
| 33 | #define MATRIX_ROWS 5 | ||
| 34 | #define MATRIX_COLS 10 | ||
| 35 | |||
| 36 | /* define if matrix has ghost */ | ||
| 37 | //#define MATRIX_HAS_GHOST | ||
| 38 | |||
| 39 | /* number of backlight levels */ | ||
| 40 | //#define BACKLIGHT_LEVELS 3 | ||
| 41 | |||
| 42 | #define ONESHOT_TIMEOUT 500 | ||
| 43 | |||
| 44 | |||
| 45 | /* key combination for command */ | ||
| 46 | #define IS_COMMAND() ( \ | ||
| 47 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 48 | ) | ||
| 49 | |||
| 50 | /* | ||
| 51 | * Feature disable options | ||
| 52 | * These options are also useful to firmware size reduction. | ||
| 53 | */ | ||
| 54 | |||
| 55 | #define PREVENT_STUCK_MODIFIERS | ||
| 56 | |||
| 57 | /* disable debug print */ | ||
| 58 | //#define NO_DEBUG | ||
| 59 | |||
| 60 | /* disable print */ | ||
| 61 | //#define NO_PRINT | ||
| 62 | |||
| 63 | /* disable action features */ | ||
| 64 | //#define NO_ACTION_LAYER | ||
| 65 | //#define NO_ACTION_TAPPING | ||
| 66 | //#define NO_ACTION_ONESHOT | ||
| 67 | //#define NO_ACTION_MACRO | ||
| 68 | //#define NO_ACTION_FUNCTION | ||
| 69 | |||
| 70 | //UART settings for communication with the RF microcontroller | ||
| 71 | #define SERIAL_UART_BAUD 1000000 | ||
| 72 | #define SERIAL_UART_DATA UDR1 | ||
| 73 | #define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1) | ||
| 74 | #define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) | ||
| 75 | #define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) | ||
| 76 | #define SERIAL_UART_INIT() do { \ | ||
| 77 | /* baud rate */ \ | ||
| 78 | UBRR1L = SERIAL_UART_UBRR; \ | ||
| 79 | /* baud rate */ \ | ||
| 80 | UBRR1H = SERIAL_UART_UBRR >> 8; \ | ||
| 81 | /* enable TX and RX */ \ | ||
| 82 | UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ | ||
| 83 | /* 8-bit data */ \ | ||
| 84 | UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ | ||
| 85 | } while(0) | ||
| 86 | |||
| 87 | #endif | ||
diff --git a/keyboards/chimera_ortho/keymaps/default/keymap.c b/keyboards/chimera_ortho/keymaps/default/keymap.c new file mode 100644 index 000000000..ef477e652 --- /dev/null +++ b/keyboards/chimera_ortho/keymaps/default/keymap.c | |||
| @@ -0,0 +1,193 @@ | |||
| 1 | // this is the style you want to emulate. | ||
| 2 | // This is the canonical layout file for the Quantum project. If you want to add another keyboard, | ||
| 3 | |||
| 4 | #include "chimera_ortho.h" | ||
| 5 | |||
| 6 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 7 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 8 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 9 | // entirely and just use numbers. | ||
| 10 | enum chimera_ortho_layers | ||
| 11 | { | ||
| 12 | _QWERTY, | ||
| 13 | _CAPS, | ||
| 14 | _NUMPAD, | ||
| 15 | _SYMBOLS, | ||
| 16 | _MACROS, | ||
| 17 | _NAV | ||
| 18 | }; | ||
| 19 | |||
| 20 | #define KC_NMPD TG(_NUMPAD) | ||
| 21 | #define KC_SYMB TG(_SYMBOLS) | ||
| 22 | #define KC_SPFN LT(_NAV,KC_EQL) | ||
| 23 | #define KC_SCTL MT(MOD_LCTL, KC_LBRC) | ||
| 24 | #define KC_SCTR MT(MOD_LCTL, KC_RBRC) | ||
| 25 | #define KC_SPLT MT(MOD_LALT, KC_MINS) | ||
| 26 | #define KC_SPRT MT(MOD_LALT, KC_1) | ||
| 27 | #define KC_GBRC MT(MOD_RGUI, KC_8) | ||
| 28 | #define KC_GQOT MT(MOD_LGUI, KC_QUOT) | ||
| 29 | #define KC_MESC LT(_MACROS, KC_ESC) | ||
| 30 | #define KC_INCL M(0) | ||
| 31 | #define KC_PULL M(1) | ||
| 32 | #define KC_PUSH M(2) | ||
| 33 | #define KC_SCAP M(3) | ||
| 34 | #define KC_SCOF M(4) | ||
| 35 | #define KC_CAD LALT(LCTL(KC_DEL)) | ||
| 36 | |||
| 37 | #define LONGPRESS_DELAY 150 | ||
| 38 | //#define LAYER_TOGGLE_DELAY 300 | ||
| 39 | |||
| 40 | // Fillers to make layering more clear | ||
| 41 | #define _______ KC_TRNS | ||
| 42 | #define XXXXXXX KC_NO | ||
| 43 | #define KC_ KC_TRNS | ||
| 44 | |||
| 45 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 46 | |||
| 47 | [_QWERTY] = KEYMAP( | ||
| 48 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
| 49 | MESC, Q , W , E , R , T ,SCTL, SCTR, Y , U , I , O , P ,QUOT, | ||
| 50 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 51 | TAB , A , S , D , F , G ,SPLT, SPRT, H , J , K , L ,SCLN,ENT , | ||
| 52 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 53 | LSPO, Z , X , C , V , B ,SPFN, GBRC, N , M ,COMM,DOT ,SLSH,RSPC, | ||
| 54 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 55 | NMPD,BSPC, SPC ,SYMB | ||
| 56 | // \------------------+----+----+---/ \---+----+----+-------------------/ | ||
| 57 | ), | ||
| 58 | |||
| 59 | [_CAPS] = KEYMAP( | ||
| 60 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
| 61 | , , , , , , , , , , , , , , | ||
| 62 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 63 | , , , , , ,UNDS, , , , , ,COLN, , | ||
| 64 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 65 | SCOF, , , , , , , , , , , , ,SCOF, | ||
| 66 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 67 | , , , | ||
| 68 | // \------------------+----+----+---/ \---+----+----+-------------------/ | ||
| 69 | ), | ||
| 70 | |||
| 71 | [_NUMPAD] = KEYMAP( | ||
| 72 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
| 73 | , ,COLN , , , , , , , 7 , 8 , 9 ,ASTR,MINS, | ||
| 74 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 75 | , ,DOT , , , , , , , 4 , 5 , 6 ,PLUS, , | ||
| 76 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 77 | , , , , , , , , , 1 , 2 , 3 ,SLSH, , | ||
| 78 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 79 | , , , 0 | ||
| 80 | // \------------------+----+----+---/ \---+----+----+-------------------/ | ||
| 81 | ), | ||
| 82 | |||
| 83 | [_SYMBOLS] = KEYMAP( | ||
| 84 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
| 85 | ,EXLM, AT ,HASH,DLR ,PERC, , ,CIRC,AMPR,ASTR,LPRN,RPRN,BSLS, | ||
| 86 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 87 | , F1 , F2 , F3 , F4 , F5 , , ,TILD,COLN,UNDS,LCBR,RCBR, , | ||
| 88 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 89 | , F6 , F7 , F8 , F9 ,F10 , , ,GRV ,SCLN,MINS,LBRC,RBRC, , | ||
| 90 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 91 | PIPE, , , | ||
| 92 | // \------------------+----+----+---/ \---+----+----+-------------------/ | ||
| 93 | ), | ||
| 94 | |||
| 95 | [_NAV] = KEYMAP( | ||
| 96 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
| 97 | , , , , , , , , , , UP , ,PSCR, , | ||
| 98 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 99 | , , , , , , , , ,LEFT,DOWN,RGHT, , , | ||
| 100 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 101 | , , , , , , , , ,PGUP,PGDN, , , , | ||
| 102 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 103 | ,DEL , , | ||
| 104 | // \------------------+----+----+---/ \---+----+----+-------------------/ | ||
| 105 | ), | ||
| 106 | |||
| 107 | [_MACROS] = KEYMAP( | ||
| 108 | //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. | ||
| 109 | , , , , , , , , , ,INCL, , , , | ||
| 110 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 111 | , , ,CAD , , , , , , , , , , , | ||
| 112 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 113 | SCAP, , , , , , , , , ,PULL,PUSH, ,SCAP, | ||
| 114 | //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| | ||
| 115 | , , , | ||
| 116 | // \------------------+----+----+---/ \---+----+----+-------------------/ | ||
| 117 | ) | ||
| 118 | |||
| 119 | }; | ||
| 120 | |||
| 121 | |||
| 122 | const uint16_t PROGMEM fn_actions[] = { | ||
| 123 | |||
| 124 | }; | ||
| 125 | |||
| 126 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 127 | { | ||
| 128 | switch(id) { | ||
| 129 | /* include some kind of library or header */ | ||
| 130 | case 0: | ||
| 131 | if (record->event.pressed) { | ||
| 132 | SEND_STRING("#include <>"); | ||
| 133 | return MACRO( T(LEFT), END); | ||
| 134 | } | ||
| 135 | break; | ||
| 136 | case 1: | ||
| 137 | if (record->event.pressed) { | ||
| 138 | SEND_STRING("git pull"); | ||
| 139 | return MACRO( T(ENT), END ); | ||
| 140 | } | ||
| 141 | break; | ||
| 142 | case 2: | ||
| 143 | if (record->event.pressed){ | ||
| 144 | SEND_STRING("git push"); | ||
| 145 | return MACRO( T(ENT), END ); | ||
| 146 | } | ||
| 147 | break; | ||
| 148 | case 3: | ||
| 149 | if (record->event.pressed){ | ||
| 150 | layer_on(_CAPS); | ||
| 151 | register_code(KC_CAPSLOCK); | ||
| 152 | unregister_code(KC_CAPSLOCK); | ||
| 153 | } | ||
| 154 | break; | ||
| 155 | case 4: | ||
| 156 | if (record->event.pressed){ | ||
| 157 | layer_off(_CAPS); | ||
| 158 | register_code(KC_CAPSLOCK); | ||
| 159 | unregister_code(KC_CAPSLOCK); | ||
| 160 | } | ||
| 161 | break; | ||
| 162 | } | ||
| 163 | return MACRO_NONE; | ||
| 164 | }; | ||
| 165 | |||
| 166 | |||
| 167 | void matrix_scan_user(void) { | ||
| 168 | uint8_t layer = biton32(layer_state); | ||
| 169 | |||
| 170 | switch (layer) { | ||
| 171 | case _QWERTY: | ||
| 172 | set_led_green; | ||
| 173 | break; | ||
| 174 | case _CAPS: | ||
| 175 | set_led_white; | ||
| 176 | break; | ||
| 177 | case _NUMPAD: | ||
| 178 | set_led_blue; | ||
| 179 | break; | ||
| 180 | case _SYMBOLS: | ||
| 181 | set_led_red; | ||
| 182 | break; | ||
| 183 | case _NAV: | ||
| 184 | set_led_magenta; | ||
| 185 | break; | ||
| 186 | case _MACROS: | ||
| 187 | set_led_cyan; | ||
| 188 | break; | ||
| 189 | default: | ||
| 190 | set_led_green; | ||
| 191 | break; | ||
| 192 | } | ||
| 193 | }; | ||
diff --git a/keyboards/chimera_ortho/matrix.c b/keyboards/chimera_ortho/matrix.c new file mode 100644 index 000000000..0d046339e --- /dev/null +++ b/keyboards/chimera_ortho/matrix.c | |||
| @@ -0,0 +1,164 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako | ||
| 3 | Copyright 2014 Jack Humbert | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation, either version 2 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | #include <stdint.h> | ||
| 19 | #include <stdbool.h> | ||
| 20 | #if defined(__AVR__) | ||
| 21 | #include <avr/io.h> | ||
| 22 | #endif | ||
| 23 | #include "wait.h" | ||
| 24 | #include "print.h" | ||
| 25 | #include "debug.h" | ||
| 26 | #include "util.h" | ||
| 27 | #include "matrix.h" | ||
| 28 | #include "timer.h" | ||
| 29 | |||
| 30 | #if (MATRIX_COLS <= 8) | ||
| 31 | # define print_matrix_header() print("\nr/c 01234567\n") | ||
| 32 | # define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) | ||
| 33 | # define matrix_bitpop(i) bitpop(matrix[i]) | ||
| 34 | # define ROW_SHIFTER ((uint8_t)1) | ||
| 35 | #elif (MATRIX_COLS <= 16) | ||
| 36 | # define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") | ||
| 37 | # define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) | ||
| 38 | # define matrix_bitpop(i) bitpop16(matrix[i]) | ||
| 39 | # define ROW_SHIFTER ((uint16_t)1) | ||
| 40 | #elif (MATRIX_COLS <= 32) | ||
| 41 | # define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") | ||
| 42 | # define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) | ||
| 43 | # define matrix_bitpop(i) bitpop32(matrix[i]) | ||
| 44 | # define ROW_SHIFTER ((uint32_t)1) | ||
| 45 | #endif | ||
| 46 | |||
| 47 | /* matrix state(1:on, 0:off) */ | ||
| 48 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 49 | |||
| 50 | __attribute__ ((weak)) | ||
| 51 | void matrix_init_quantum(void) { | ||
| 52 | matrix_init_kb(); | ||
| 53 | } | ||
| 54 | |||
| 55 | __attribute__ ((weak)) | ||
| 56 | void matrix_scan_quantum(void) { | ||
| 57 | matrix_scan_kb(); | ||
| 58 | } | ||
| 59 | |||
| 60 | __attribute__ ((weak)) | ||
| 61 | void matrix_init_kb(void) { | ||
| 62 | matrix_init_user(); | ||
| 63 | } | ||
| 64 | |||
| 65 | __attribute__ ((weak)) | ||
| 66 | void matrix_scan_kb(void) { | ||
| 67 | matrix_scan_user(); | ||
| 68 | } | ||
| 69 | |||
| 70 | __attribute__ ((weak)) | ||
| 71 | void matrix_init_user(void) { | ||
| 72 | } | ||
| 73 | |||
| 74 | __attribute__ ((weak)) | ||
| 75 | void matrix_scan_user(void) { | ||
| 76 | } | ||
| 77 | |||
| 78 | inline | ||
| 79 | uint8_t matrix_rows(void) { | ||
| 80 | return MATRIX_ROWS; | ||
| 81 | } | ||
| 82 | |||
| 83 | inline | ||
| 84 | uint8_t matrix_cols(void) { | ||
| 85 | return MATRIX_COLS; | ||
| 86 | } | ||
| 87 | |||
| 88 | void matrix_init(void) { | ||
| 89 | |||
| 90 | matrix_init_quantum(); | ||
| 91 | } | ||
| 92 | |||
| 93 | uint8_t matrix_scan(void) | ||
| 94 | { | ||
| 95 | SERIAL_UART_INIT(); | ||
| 96 | |||
| 97 | uint32_t timeout = 0; | ||
| 98 | |||
| 99 | //the s character requests the RF slave to send the matrix | ||
| 100 | SERIAL_UART_DATA = 's'; | ||
| 101 | |||
| 102 | //trust the external keystates entirely, erase the last data | ||
| 103 | uint8_t uart_data[11] = {0}; | ||
| 104 | |||
| 105 | //there are 10 bytes corresponding to 10 columns, and an end byte | ||
| 106 | for (uint8_t i = 0; i < 11; i++) { | ||
| 107 | //wait for the serial data, timeout if it's been too long | ||
| 108 | //this only happened in testing with a loose wire, but does no | ||
| 109 | //harm to leave it in here | ||
| 110 | while(!SERIAL_UART_RXD_PRESENT){ | ||
| 111 | timeout++; | ||
| 112 | if (timeout > 10000){ | ||
| 113 | break; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | uart_data[i] = SERIAL_UART_DATA; | ||
| 117 | } | ||
| 118 | |||
| 119 | //check for the end packet, the key state bytes use the LSBs, so 0xE0 | ||
| 120 | //will only show up here if the correct bytes were recieved | ||
| 121 | if (uart_data[10] == 0xE0) | ||
| 122 | { | ||
| 123 | //shifting and transferring the keystates to the QMK matrix variable | ||
| 124 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 125 | matrix[i] = (uint16_t) uart_data[i*2] | (uint16_t) uart_data[i*2+1] << 5; | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | |||
| 130 | matrix_scan_quantum(); | ||
| 131 | return 1; | ||
| 132 | } | ||
| 133 | |||
| 134 | inline | ||
| 135 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
| 136 | { | ||
| 137 | return (matrix[row] & ((matrix_row_t)1<col)); | ||
| 138 | } | ||
| 139 | |||
| 140 | inline | ||
| 141 | matrix_row_t matrix_get_row(uint8_t row) | ||
| 142 | { | ||
| 143 | return matrix[row]; | ||
| 144 | } | ||
| 145 | |||
| 146 | void matrix_print(void) | ||
| 147 | { | ||
| 148 | print_matrix_header(); | ||
| 149 | |||
| 150 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 151 | phex(row); print(": "); | ||
| 152 | print_matrix_row(row); | ||
| 153 | print("\n"); | ||
| 154 | } | ||
| 155 | } | ||
| 156 | |||
| 157 | uint8_t matrix_key_count(void) | ||
| 158 | { | ||
| 159 | uint8_t count = 0; | ||
| 160 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 161 | count += matrix_bitpop(i); | ||
| 162 | } | ||
| 163 | return count; | ||
| 164 | } | ||
diff --git a/keyboards/chimera_ortho/rules.mk b/keyboards/chimera_ortho/rules.mk new file mode 100644 index 000000000..098bf28fa --- /dev/null +++ b/keyboards/chimera_ortho/rules.mk | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | |||
| 2 | OPT_DEFS += -DCHIMERA_ORTHO_PROMICRO | ||
| 3 | OPT_DEFS += -DCATERINA_BOOTLOADER | ||
| 4 | CHIMERA_ORTHO_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ | ||
| 5 | avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) | ||
| 6 | |||
| 7 | # # project specific files | ||
| 8 | SRC = matrix.c | ||
| 9 | |||
| 10 | |||
| 11 | # MCU name | ||
| 12 | #MCU = at90usb1287 | ||
| 13 | MCU = atmega32u4 | ||
| 14 | |||
| 15 | # Processor frequency. | ||
| 16 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 17 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 18 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 19 | # automatically to create a 32-bit value in your source code. | ||
| 20 | # | ||
| 21 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 22 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 23 | # does not *change* the processor frequency - it should merely be updated to | ||
| 24 | # reflect the processor speed set externally so that the code can use accurate | ||
| 25 | # software delays. | ||
| 26 | F_CPU = 16000000 | ||
| 27 | |||
| 28 | |||
| 29 | # | ||
| 30 | # LUFA specific | ||
| 31 | # | ||
| 32 | # Target architecture (see library "Board Types" documentation). | ||
| 33 | ARCH = AVR8 | ||
| 34 | |||
| 35 | # Input clock frequency. | ||
| 36 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 37 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 38 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 39 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 40 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 41 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 42 | # source code. | ||
| 43 | # | ||
| 44 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 45 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 46 | F_USB = $(F_CPU) | ||
| 47 | |||
| 48 | # Interrupt driven control endpoint task(+60) | ||
| 49 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 50 | |||
| 51 | |||
| 52 | # Boot Section Size in *bytes* | ||
| 53 | # Teensy halfKay 512 | ||
| 54 | # Teensy++ halfKay 1024 | ||
| 55 | # Atmel DFU loader 4096 | ||
| 56 | # LUFA bootloader 4096 | ||
| 57 | # USBaspLoader 2048 | ||
| 58 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
| 59 | |||
| 60 | |||
| 61 | # Build Options | ||
| 62 | # comment out to disable the options. | ||
| 63 | # | ||
| 64 | #BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | ||
| 65 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 66 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 67 | CONSOLE_ENABLE = yes # Console for debug(+400) | ||
| 68 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 69 | CUSTOM_MATRIX = yes # Remote matrix from the wireless bridge | ||
| 70 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 71 | # SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | ||
| 72 | NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA | ||
| 73 | # BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | ||
| 74 | # MIDI_ENABLE = YES # MIDI controls | ||
| 75 | UNICODE_ENABLE = YES # Unicode | ||
| 76 | # BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 77 | |||
| 78 | USB = /dev/ttyACM0 | ||
