qmk

QMK Firmware
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

keymap.c (1363B)


      1 #include QMK_KEYBOARD_H
      2 
      3 
      4 #define DEF 0
      5 #define HDN 1
      6 #define OSY 2
      7 
      8 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      9   [DEF] = LAYOUT(
     10     TO(HDN), KC_SLSH, KC_ASTR, KC_MINS, \
     11     KC_7,    KC_8,    KC_9,    KC_PLUS, \
     12     KC_4,    KC_5,    KC_6,             \
     13     KC_1,    KC_2,    KC_3,             \
     14     KC_0,             KC_DOT,  KC_ENT   \
     15   ),
     16   [HDN] = LAYOUT(
     17     TO(OSY), KC_1,    KC_2,    KC_3,    \
     18     KC_Q,    KC_W,    KC_E,    KC_R,    \
     19     KC_A,    KC_S,    KC_D,             \
     20     KC_Z,    KC_X,    KC_C,             \
     21     KC_LSFT,          KC_LALT, KC_SPC   \
     22   ),
     23   [OSY] = LAYOUT(
     24     KC_A,    KC_Q,    KC_1,    TO(DEF), \
     25     KC_S,    KC_W,    KC_2,    KC_LALT, \
     26     KC_D,    KC_E,    KC_3,             \
     27     KC_F,    KC_R,    KC_4,             \
     28     KC_SPC,           KC_T,    KC_TAB   \
     29   )
     30 };
     31 
     32 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
     33   switch(keycode) {
     34     case TO(HDN):
     35       if (record->event.pressed) {
     36         PORTC |= (1 << 6); // PC6 goes high
     37       }
     38 
     39       return true;
     40 
     41     case TO(OSY):
     42       if (record->event.pressed) {
     43         PORTC &= ~(1 << 6); // PC6 goes high
     44         PORTD |= (1<<4);
     45       }
     46 
     47       return true;
     48 
     49     case TO(DEF):
     50       if (record->event.pressed) {
     51         PORTD &= ~(1 << 4); // PC6 goes high
     52       }
     53 
     54       return true;
     55 
     56     default:
     57       return true;
     58   }
     59 }