-
-
Save joric/ee3e218332378fcde17bace25f0a78a7 to your computer and use it in GitHub Desktop.
main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://github.com/joric/nrfmicro/wiki/Circuitpython | |
from jorne import KMKKeyboard | |
from kmk.keys import KC, make_key | |
keyboard = KMKKeyboard() | |
keyboard.rgb_config['num_pixels'] = 6 | |
_______ = KC.TRNS | |
XXXXXXX = KC.NO | |
LOWER = KC.MO(2) | |
RAISE = KC.MO(3) | |
ADJUST = KC.MO(4) | |
RGB_RST = KC.RGB_TOG | |
RGB_TOG = KC.RGB_TOG | |
rgb_modes = ['static','breathing','breathing_rainbow','rainbow','swirl','knight'] | |
rgb_mode = 0 | |
def next_rgb_mode(*args, **kwargs): | |
global rgb_mode | |
keyboard.pixels.animation_mode = rgb_modes[rgb_mode] | |
rgb_mode = (rgb_mode + 1) % len(rgb_modes) | |
RGB_MOD = make_key(on_press=next_rgb_mode) | |
keyboard.keymap = [ | |
[ #QWERTY | |
KC.TAB, KC.Q, KC.W, KC.E, KC.R, KC.T, KC.Y, KC.U, KC.I, KC.O, KC.P, KC.BSPC,\ | |
KC.LCTL, KC.A, KC.S, KC.D, KC.F, KC.G, KC.H, KC.J, KC.K, KC.L, KC.SCLN, KC.QUOT,\ | |
KC.LSFT, KC.Z, KC.X, KC.C, KC.V, KC.B, KC.N, KC.M, KC.COMM, KC.DOT, KC.SLSH, KC.RSFT,\ | |
RAISE, KC.SPC, LOWER, KC.ENT, RAISE, KC.RALT, | |
], | |
[ #LOWER | |
KC.ESC, KC.N1, KC.N2, KC.N3, KC.N4, KC.N5, KC.N6, KC.N7, KC.N8, KC.N9, KC.N0, KC.BSPC,\ | |
KC.LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.LEFT, KC.DOWN, KC.UP,KC.RIGHT, XXXXXXX, XXXXXXX,\ | |
KC.LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,\ | |
RAISE, KC.SPC, LOWER, KC.ENT, RAISE, KC.RALT, | |
], | |
[ #RAISE | |
KC.ESC, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.BSPC,\ | |
KC.LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.MINS, KC.EQL, KC.LCBR, KC.RCBR, KC.PIPE, KC.GRV,\ | |
KC.LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC.UNDS, KC.PLUS, KC.LBRC, KC.RBRC, KC.BSLS, KC.TILD,\ | |
RAISE, KC.SPC, LOWER, KC.ENT, RAISE, KC.RALT, | |
], | |
[ #ADJUST | |
RGB_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,\ | |
RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,\ | |
RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,\ | |
RAISE, KC.SPC, LOWER, KC.ENT, RAISE, KC.RALT, | |
] | |
] | |
import adafruit_ssd1306 | |
import board | |
import busio as io | |
import time | |
from digitalio import DigitalInOut, Direction, Pull | |
if __name__ == '__main__': | |
led = DigitalInOut(board.P1_10) # blue led | |
led.direction = Direction.OUTPUT | |
for i in range(4): | |
led.value = False if i%2 else True | |
time.sleep(0.2) | |
i2c = io.I2C(board.SCL, board.SDA) | |
oled = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c) | |
oled.fill(0) | |
oled.text("Hello from KMK!", 0, 0, 1) | |
oled.show() | |
keyboard.go() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment