qmk_firmware/keyboards/handwired/gamenum
James Young a03aa301de
Remove Full Bootmagic (#13846)
* disambiguate Bootmagic rules in keymaps

The files edited by this commit were added at a point in time where `BOOTMAGIC_ENABLE = yes` enabled full Bootmagic.

This commit edits the files to specify that full Bootmagic is intended.

* remove BOOTMAGIC_ENABLE=full setting

* unify commented BOOTMAGIC_ENABLE rules in keyboards

Explicitly sets `BOOTMAGIC_ENABLE = no` in keyboards where the rule was commented out.

Command:

```
find keyboards/ -type f -name 'rules.mk' -and -not -path '*/keymaps/*' -exec sed -i -e 's;#[ \t]*\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-zA-Z]\+\).*;\1 = no       # Virtual DIP switch configuration;g' {} +
```

* remove commented Bootmagic rules from keymap/user level

Command:

```
find keyboards/ layouts/ users/ -type f -name 'rules.mk' -exec sed -i -e '/#.*\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-z]\+\).*/d' {} +
```

* update keyboard BOOTMAGIC_ENABLE rule formatting

Sets the formatting of BOOTMAGIC_ENABLE rules to `BOOTMAGIC_ENABLE = [value]`, without the inline comments (which will be replaced later).

Command:

```
find keyboards/ -type f -name 'rules.mk' -and -not -path '*/keymaps/*' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-z]\+\).*;\1 = \2;g' '{}' +
```

* update keyboards' BOOTMAGIC_ENABLE settings

Updates keyboard `rules.mk` files to use `BOOTMAGIC_ENABLE = lite` where `BOOTMAGIC_ENABLE = full` was being used.

Command:

```
find keyboards/ -type f -name 'rules.mk' -and -not -path '*/keymaps/*' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE = \)full;\1lite;g' '{}' +
```

* update keymap/user BOOTMAGIC_ENABLE settings

Updates keymap/user `rules.mk` files to use `BOOTMAGIC_ENABLE = lite` where `BOOTMAGIC_ENABLE = full` was being used.

Commands:

```
find keyboards/ -type f -name 'rules.mk' -and -path '*/keymaps/*' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE[ \t=]\+\)full;\1lite;g' '{}' +
find layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE[ \t=]\+\)full;\1lite;g' '{}' +
```

* remove and replace inline comments in keyboards and keymap/user files

Removes and replaces the inline comments, which have been updated to read `Enable Bootmagic Lite`.

Commands:

```
find keyboards/ -type f -name 'rules.mk' -and -path '*/keymaps/*' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-z]\+\).*;\1 = \2;g' '{}' +
find layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE\)[ \t=]\+\([a-z]\+\).*;\1 = \2;g' '{}' +
find keyboards/ layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE = lite\);\1     # Enable Bootmagic Lite;g' '{}' +
find keyboards/ layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE = yes\);\1      # Enable Bootmagic Lite;g' '{}' +
find keyboards/ layouts/community/ users/ -type f -name 'rules.mk' -exec sed -i -e 's;\(BOOTMAGIC_ENABLE = no\);\1       # Enable Bootmagic Lite;g' '{}' +
```

* rename improperly named makefiles

Some files intended to be used as makefiles had improper names causing them to not be used as intended when building.

This commit corrects the filenames of the affected files.

* update renamed file with new rule formatting

* update QMK's template files

Updates QMK's `rules.mk` templates to use the new inline comment.

* update QMK Docs

- remove documentation of full Bootmagic
- update links to Bootmagic Lite doc
- add doc for Magic Keycodes

* rules.mk patch for coarse/ixora and coarse/vinta
2021-08-06 23:59:56 -07:00
..
keymaps/default
config.h
gamenum.c
gamenum.h
info.json
readme.md
rules.mk Remove Full Bootmagic (#13846) 2021-08-06 23:59:56 -07:00

GameNum

A handwired standard numpad oriented toward gaming on the go.

Keyboard Maintainer: The QMK Community
Hardware Supported: GameNum, Pro Micro

Make example for this keyboard (after setting up your build environment):

make handwired/gamenum:default

See the build environment setup and the make instructions for more information. Brand new to QMK? Start with our Complete Newbs Guide.

Board overview

The GameNum was designed to facilitate the use of mechanical keys for gaming even when your packing space is limited. It uses a standard numpad layout replacing the NumLock key with a layer toggle that allows you to cycle through the different layers. 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. The RTS layer is meant to be used rotating the device 90 degrees counterclockwise.

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.

Build considerations

Since the GameNum is handwired and uses 2 of its pins to toggle indicator lights there are some things to keep in mind. Firmware was build for use with a Pro Micro based on a ATMEGA32u4 at 16mHz. 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. '+' 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.

schematic of the switches and diodes

schematic overview

Keep in mind that the minus of the diodes should point towards the pro micros inputs.

LED hookup

led overview

Adding more layers

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. Keep in mind here that the number after the name should correspond with the number that the layer has in the stack of layers.

Next thing to do is to add the actual layer for the keymap.

  [DEF] = LAYOUT(
    KC_FN0,  KC_SLSH, KC_ASTR, KC_MINS, \
    KC_7,    KC_8,    KC_9,    KC_PLUS, \
    KC_4,    KC_5,    KC_6,             \
    KC_1,    KC_2,    KC_3,             \
    KC_0,             KC_DOT,  KC_ENT   \
  )

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: 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!

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. The number that is at the end of the keycode corresponds with the code in the function. [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.

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. Look for this piece of code:

    DDRD |= (1<<4);
    PORTD &= ~(1<<4);

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.

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.

  case KC_FN1:
    if (record->event.pressed) {
      PORTC &= ~(1 << 6); // PC6 goes low 
      PORTD |= (1<<4); //PD4 goes high
    }
    break;

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.