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

readme.md (5074B)

      1 # GameNum
      3 A handwired standard numpad oriented toward gaming on the go.
      5 Keyboard Maintainer: [The QMK Community](https://github.com/qmk)  
      6 Hardware Supported: GameNum, Pro Micro  
      8 Make example for this keyboard (after setting up your build environment):
     10     make handwired/gamenum:default
     12 See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
     14 ## Board overview
     16 The GameNum was designed to facilitate the use of mechanical keys for gaming even when your packing space is limited.
     17 It uses a standard numpad layout replacing the NumLock key with a layer toggle that allows you to cycle through the different layers.
     18 The standard layout features a default layer that acts as a standard numpad, a layer that was meant for simple WASD based games and a layer that was designed to be used for MOBA/RTS related games.
     19 The RTS layer is meant to be used rotating the device 90 degrees counterclockwise.
     21 The README.MD for this board is reasonably extensive and in-depth because the build is quite small and covers a lot of things that I feel that it would be a good starting point for getting into QMK.
     23 ## Build considerations
     25 Since the GameNum is handwired and uses 2 of its pins to toggle indicator lights there are some things to keep in mind.
     26 Firmware was build for use with a Pro Micro based on a ATMEGA32u4 at 16mHz. 
     27 The indicator LED's are normally assigned to `pin C6` and `pin D4`, C6 goes high when the first layer is used, D4 goes high when layer 2 is used. Both LED's are off when the default layer is enabled.
     28 '+' of the LED goes to the respective pins and can be joined together on the '-' into a resistor that runs to the ground pin of the pro micro. With a standard LED a resistor value of 100 ohm is fine, keep in mind that you cannot use high powered LEDS on these pins without ruining your pro micro.
     30 ## schematic of the switches and diodes
     32 ![schematic overview](http://i.imgur.com/fleitoA.jpg)
     34 Keep in mind that the minus of the diodes should point towards the pro micros inputs.
     36 ## LED hookup
     38 ![led overview](http://i.imgur.com/U6m865n.jpg)
     40 ## Adding more layers
     42 Adding additional layers is pretty straight forward. Look in `keymaps/default/keymap.c` and find `#define OSY 2` add a new definition for the layer you are going to add. This can be named pretty much anything. Example: `#define NAMEHERE 3`.
     43 Keep in mind here that the number after the name should correspond with the number that the layer has in the stack of layers. 
     45 Next thing to do is to add the actual layer for the keymap.
     47 ```
     48   [DEF] = LAYOUT(
     49     KC_FN0,  KC_SLSH, KC_ASTR, KC_MINS, \
     50     KC_7,    KC_8,    KC_9,    KC_PLUS, \
     51     KC_4,    KC_5,    KC_6,             \
     52     KC_1,    KC_2,    KC_3,             \
     53     KC_0,             KC_DOT,  KC_ENT   \
     54   )
     55 ```
     57 This is the default layer for the gamenum. It's generally easiest to just copy this and change things as you see fit. Keep in mind that at least 1 button on the pad has to be used to switch to the next layer in the stack or you will be stuck in that layer FOREVER! D:
     58 In the case of DEF this is key `KC_FN0`. Also keep in mind that the last layer that you add does not have a comma after its closing bracket but any other layer does!
     60 Which brings us nicely to the next part, the layer switching logic. Under the keymaps look for `PROGMEM fn_actions[]` this function handles the switching between layers, as you might have noticed every layer in the keymap has its own KC_FNx key. This is the key responsible for switching you from layer to layer.
     61 The number that is at the end of the keycode corresponds with the code in the function. 
     62 `[0] = ACTION_LAYER_SET(HDN, ON_PRESS),` When `KC_FN0` is pressed the keyboard switches layer `HDN` on when the key is pressed down. Add an extra line for your layer here as well.
     64 Now for the LEDs, if you plan on adding extra LED's to the keyboard to indicate other layers you have to first define the pin that the LED will be using in `gamenum.c`.
     65 Look for this piece of code: 
     67 ```
     68     DDRD |= (1<<4);
     69     PORTD &= ~(1<<4);
     70 ```
     72 Copy it and change the letter after DDR and PORT to the letter of your pin. Change the 4 to the number of your pin. `DDRx |= (1<<y);` defines that pin as an output. `PORTx &= ~(1<<y);` sets the pin to LOW turning off the LED.
     74 Now go back to `keymap.c` and look for the `process_record_user` function. The function is basically a switch case that checks if you pushed one of the defined layer-switch buttons. When it sees that you pushed one of them it sets the pins of the LED's either low or high.
     76 ```
     77   case KC_FN1:
     78     if (record->event.pressed) {
     79       PORTC &= ~(1 << 6); // PC6 goes low 
     80       PORTD |= (1<<4); //PD4 goes high
     81     }
     82     break;
     83 ```
     85 This is the code for the KC_FN1 button. Notice how we check against what key is pressed in the case and then set pin C6 low and pin D4 high. Adjust this as you see fit.