Git Keymap for ANAVI Macro Pad 8

Out of the box ANAVI Macro Pad 8 comes with the popular open source Quantum Mechanical Keyboard (QMK) firmware. In a previous blog post we covered it in more details and we had a look at the existing keymaps.

Recently, we added a brand new keymap for ANAVI Macro Pad 8 for Git users. Git is a free and open source distributed version control system started by the famous Linus Torvalds, the creator of Linux kernel. Nowadays, there are many offerings of Git repositories as a service by GitHub, GitLab, Bitbucket, etc.

The Keys

The Git keymap for ANAVI Macro Pad 8 contains the following shortcuts for Git. On the first row from left to right:

  • git status
  • git log
  • git pull
  • git push

On the second row from left to right:

  • git diff
  • git add
  • git commit
  • FN key to switch to the 2nd layout and control lights
ANAVI Macro Pad 8
ANAVI Macro Pad 8

How It Works?

From technical point of view for developers this Git keymap demonstrates a couple of interesting features of QMK firmware:

  • Typing words with a single key press
  • Reducing the QMK firmware size

In order to send commands like git log by pressing a single key, the Git keymap follows the QMK guidelines for custom keycodes.This keymap uses enum to define data type in the C programming language for all new custom keycodes. After that through function process_record_user and using SEND_STRING the text is send if a specific key on the macro pad is pressed. Details are available at QMK documentation and as an example directly in GitHub.

Using SEND_STRING in the Git keymap increases the total firmware size. This is dangerous because Microchip ATmega32U4, the microcontroller on ANAVI Macro Pad 8, may not have enough free space for it. If the firmware exceeds the size limit any attempts to flash it will fail with a similar error message:

The firmware is too large! 28866/28672 (194 bytes over)

If you run in such a use case, the easiest way to reduce the size of QMK firmware in a keymap for ANAVI Macro Pad 8 is to cut some of the default RGB lighting animations and effects. For example, as in the Git keymap, you can create config.h file in the keymap directory that overwrites the main config.h with a reduced number of supported RGB lighting animations and effects:

#pragma once

#undef RGBLIGHT_ANIMATIONS
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_SNAKE

How to Flash It?

We have already covered in details how to install QMK firmware and how to flash a keymap from the command line in a previous blog post and in the user’s manual. Here is it in a nutshell for the Git keymap. Connect ANAVI Macro Pad 8 to a computer with USB to microUSB cable follow the steps below:

  • Execute the following command to compile QMK and the Git keymap for ANAVI Macro Pad 8:
qmk compile -kb anavi/macropad8 -km git
  • Execute the following command in a terminal to flash the git keymap:
qmk flash -kb anavi/macropad8 -km git
  • Press the RESET button on ANAVI Macro Pad 8 when asked:
Detecting USB port, reset your controller now.....
  • Wait until the firmware flashes successfully:
avrdude done.  Thank you.

ANAVI Macro Pad 8 is available at our distributors Crowd Supply and Mouser. We are constantly trying to improve this open source project and we are interested in finding more distributors around the world. If you have any questions please do not hesitate to contact us.

You may also like