Skip to content

Instantly share code, notes, and snippets.

@photomattmills
Last active September 18, 2020 08:00
Show Gist options
  • Save photomattmills/75905443995bfb933f45e20aecf85def to your computer and use it in GitHub Desktop.
Save photomattmills/75905443995bfb933f45e20aecf85def to your computer and use it in GitHub Desktop.

Compiling BlueMicro firmware for the nice!nano

Install Arduino IDE Install adafruit NRF boards (preferences -> additional boards manager URL, bottom of the first tab), url: http://adafruit.github.io/arduino-board-index/package_adafruit_index.json

Clone repo: https://github.com/jpconstantineau/BlueMicro_BLE Get python converter script: https://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2conv.py

Copy new keyboard from existing board folder; I used crkbd. . Set up the KEYMAP macro in keyboard_config.h, along with all your device names and such. Set KEYBOARD_SIDE accordingly, also. The hardware_config.h should define your row and column pins; the pins are numbered slightly oddly: for 0.n, the pin number is n, for 1.n, the pin number is 32+n. Refer to pinouts: https://docs.nicekeyboards.com/#/nice!nano/pinout_schematic to get the numbers. Also define MATRIX_ROW_PINS, MATRIX_COL_PINS in hardware_config, and set DIODE_DIRECTION to match your matrix.

Keymap.cpp defines your keymap; worth spending some time there to get it right. Keymap.h I don't think I touched from the project I copied from.

Folder structure should look something like this:

Cd to /build/macOS. Copy hardware_config.h, keyboard_config.h, and keycap.h to /firmware. Change the script build-macos like so: 

Then, still from /build/macOS, run: ./build-macos <keyboard folder name>:<layout name, default in my folders above>:config --fqbn adafruit:nrf52:pca10056:softdevice=s140v6. This will run a compiler and build a .hex file. Now we can convert that to a uf2 file for drag-and-drop flashing: python uf2conv.py -f 0xADA52840 -c -o nrf52840_xxaa.uf2 ../../output/atreus_62/atreus_62-default-config.hex (this assumes you have the downloaded MS script in the current folder.

Last: double tap the reset button or short the reset pin to ground twice quickly with the device plugged in to your computer. It should pop up as a drive. Drag the generated uf2 file to the drive, and it should automatically reset. Congratulation, you’ve done it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment