Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
 working keyboard

fixup

formatting

readme image

clean up oled code and utilise json keymaps
  • Loading branch information
daysgobye authored and waffle87 committed Jul 12, 2023
1 parent a1eb213 commit 0714b4b
Show file tree
Hide file tree
Showing 10 changed files with 523 additions and 0 deletions.
26 changes: 26 additions & 0 deletions keyboards/boardsource/unicorne/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2023 jack (@waffle87)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#define RGB_MATRIX_LED_COUNT 54
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_ALPHAS_MODS
#define RGB_DISABLE_WHEN_USB_SUSPENDED

#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET

#define SPLIT_LAYER_STATE_ENABLE

#define I2C_DRIVER I2CD1
#define I2C1_SDA_PIN GP22
#define I2C1_SCL_PIN GP23

#define AUDIO_PIN GP28
#define AUDIO_PWM_DRIVER PWMD6
#define AUDIO_INIT_DELAY 1000
#define AUDIO_PWM_CHANNEL RP2040_PWM_CHANNEL_A
#define STARTUP_SONG SONG(ODE_TO_JOY)

#define ANALOG_JOYSTICK_Y_AXIS_PIN GP26
#define ANALOG_JOYSTICK_X_AXIS_PIN GP27
#define POINTING_DEVICE_INVERT_Y
#define POINTING_DEVICE_INVERT_X
9 changes: 9 additions & 0 deletions keyboards/boardsource/unicorne/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2022 jack (@waffle87)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#define HAL_USE_I2C TRUE
#define HAL_USE_PWM TRUE
#define HAL_USE_ADC TRUE

#include_next <halconf.h>
161 changes: 161 additions & 0 deletions keyboards/boardsource/unicorne/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
{
"manufacturer": "Boardsource",
"maintainer": "waffle87",
"processor": "RP2040",
"bootloader": "rp2040",
"diode_direction": "COL2ROW",
"features": {
"audio": true,
"bootmagic": true,
"encoder": true,
"extrakey": true,
"mousekey": true,
"nkro": true,
"oled": true,
"pointing_device": true,
"rgb_matrix": true
},
"indicators": {
"caps": "GP24"
},
"split": {
"enabled": true,
"soft_serial_pin": "GP0"
},
"usb": {
"device_version": "1.0.0",
"pid": "0x7563",
"vid": "0x4273"
},
"ws2812": {
"driver": "vendor",
"pin": "GP29"
},
"matrix_pins": {
"cols": ["GP2", "GP3", "GP4", "GP5", "GP6", "GP7"],
"rows": ["GP14", "GP15", "GP16", "GP17"]
},
"encoder": {
"rotary": [
{"pin_a": "GP8", "pin_b": "GP9"}
]
},
"rgb_matrix": {
"animations": {
"alphas_mods": true,
"band_sat": true,
"band_val": true,
"breathing": true,
"gradient_left_right": true,
"gradient_up_down": true
},
"max_brightness": 150,
"split_count": [27, 27],
"driver": "WS2812",
"layout": [
{"x": 85, "y": 16, "flags": 2},
{"x": 50, "y": 13, "flags": 2},
{"x": 16, "y": 20, "flags": 2},
{"x": 16, "y": 38, "flags": 2},
{"x": 50, "y": 48, "flags": 2},
{"x": 85, "y": 52, "flags": 2},
{"matrix": [3, 5], "x": 95, "y": 63, "flags": 1},
{"matrix": [2, 5], "x": 85, "y": 39, "flags": 4},
{"matrix": [1, 5], "x": 85, "y": 21, "flags": 4},
{"matrix": [0, 5], "x": 85, "y": 4, "flags": 4},
{"matrix": [0, 4], "x": 68, "y": 2, "flags": 4},
{"matrix": [1, 4], "x": 68, "y": 19, "flags": 4},
{"matrix": [2, 4], "x": 68, "y": 37, "flags": 4},
{"matrix": [3, 4], "x": 80, "y": 58, "flags": 1},
{"matrix": [3, 3], "x": 60, "y": 55, "flags": 1},
{"matrix": [2, 3], "x": 50, "y": 35, "flags": 4},
{"matrix": [1, 3], "x": 50, "y": 13, "flags": 4},
{"matrix": [0, 3], "x": 50, "y": 0, "flags": 4},
{"matrix": [0, 2], "x": 33, "y": 3, "flags": 4},
{"matrix": [1, 2], "x": 33, "y": 20, "flags": 4},
{"matrix": [2, 2], "x": 33, "y": 37, "flags": 4},
{"matrix": [2, 1], "x": 16, "y": 42, "flags": 4},
{"matrix": [1, 1], "x": 16, "y": 24, "flags": 4},
{"matrix": [0, 1], "x": 16, "y": 7, "flags": 4},
{"matrix": [0, 0], "x": 0, "y": 7, "flags": 1},
{"matrix": [1, 0], "x": 0, "y": 24, "flags": 1},
{"matrix": [2, 0], "x": 0, "y": 41, "flags": 1},
{"x": 139, "y": 16, "flags": 2},
{"x": 174, "y": 13, "flags": 2},
{"x": 208, "y": 20, "flags": 2},
{"x": 208, "y": 38, "flags": 2},
{"x": 174, "y": 48, "flags": 2},
{"x": 139, "y": 52, "flags": 2},
{"matrix": [7, 5], "x": 129, "y": 63, "flags": 1},
{"matrix": [6, 5], "x": 139, "y": 39, "flags": 4},
{"matrix": [5, 5], "x": 139, "y": 21, "flags": 4},
{"matrix": [4, 5], "x": 139, "y": 4, "flags": 4},
{"matrix": [4, 4], "x": 156, "y": 2, "flags": 4},
{"matrix": [5, 4], "x": 156, "y": 19, "flags": 4},
{"matrix": [6, 4], "x": 156, "y": 37, "flags": 4},
{"matrix": [7, 4], "x": 144, "y": 58, "flags": 1},
{"matrix": [7, 3], "x": 164, "y": 55, "flags": 1},
{"matrix": [6, 3], "x": 174, "y": 35, "flags": 4},
{"matrix": [5, 3], "x": 174, "y": 13, "flags": 4},
{"matrix": [4, 3], "x": 174, "y": 0, "flags": 4},
{"matrix": [4, 2], "x": 191, "y": 3, "flags": 4},
{"matrix": [5, 2], "x": 191, "y": 20, "flags": 4},
{"matrix": [6, 2], "x": 191, "y": 37, "flags": 4},
{"matrix": [6, 1], "x": 208, "y": 42, "flags": 4},
{"matrix": [5, 1], "x": 208, "y": 24, "flags": 4},
{"matrix": [4, 1], "x": 208, "y": 7, "flags": 4},
{"matrix": [4, 0], "x": 0, "y": 7, "flags": 1},
{"matrix": [5, 0], "x": 0, "y": 24, "flags": 1},
{"matrix": [6, 0], "x": 0, "y": 41, "flags": 1}
]
},
"community_layouts": ["split_3x6_3"],
"layouts": {
"LAYOUT_split_3x6_3": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0.3},
{"matrix": [0, 1], "x": 1, "y": 0.3},
{"matrix": [0, 2], "x": 2, "y": 0.1},
{"matrix": [0, 3], "x": 3, "y": 0},
{"matrix": [0, 4], "x": 4, "y": 0.1},
{"matrix": [0, 5], "x": 5, "y": 0.2},
{"matrix": [4, 5], "x": 9, "y": 0.2},
{"matrix": [4, 4], "x": 10, "y": 0.1},
{"matrix": [4, 3], "x": 11, "y": 0},
{"matrix": [4, 2], "x": 12, "y": 0.1},
{"matrix": [4, 1], "x": 13, "y": 0.3},
{"matrix": [4, 0], "x": 14, "y": 0.3},
{"matrix": [1, 0], "x": 0, "y": 1.3},
{"matrix": [1, 1], "x": 1, "y": 1.3},
{"matrix": [1, 2], "x": 2, "y": 1.1},
{"matrix": [1, 3], "x": 3, "y": 1},
{"matrix": [1, 4], "x": 4, "y": 1.1},
{"matrix": [1, 5], "x": 5, "y": 1.2},
{"matrix": [5, 5], "x": 9, "y": 1.2},
{"matrix": [5, 4], "x": 10, "y": 1.1},
{"matrix": [5, 3], "x": 11, "y": 1},
{"matrix": [5, 2], "x": 12, "y": 1.1},
{"matrix": [5, 1], "x": 13, "y": 1.3},
{"matrix": [5, 0], "x": 14, "y": 1.3},
{"matrix": [2, 0], "x": 0, "y": 2.3},
{"matrix": [2, 1], "x": 1, "y": 2.3},
{"matrix": [2, 2], "x": 2, "y": 2.1},
{"matrix": [2, 3], "x": 3, "y": 2},
{"matrix": [2, 4], "x": 4, "y": 2.1},
{"matrix": [2, 5], "x": 5, "y": 2.2},
{"matrix": [6, 5], "x": 9, "y": 2.2},
{"matrix": [6, 4], "x": 10, "y": 2.1},
{"matrix": [6, 3], "x": 11, "y": 2},
{"matrix": [6, 2], "x": 12, "y": 2.1},
{"matrix": [6, 1], "x": 13, "y": 2.3},
{"matrix": [6, 0], "x": 14, "y": 2.3},
{"matrix": [3, 3], "x": 4, "y": 3.7},
{"matrix": [3, 4], "x": 5, "y": 3.7},
{"matrix": [3, 5], "x": 6, "y": 3.2, "h": 1.5},
{"matrix": [7, 5], "x": 8, "y": 3.2, "h": 1.5},
{"matrix": [7, 4], "x": 9, "y": 3.7},
{"matrix": [7, 3], "x": 10, "y": 3.7}
]
}
}
}
25 changes: 25 additions & 0 deletions keyboards/boardsource/unicorne/keymaps/default/keymap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"keyboard": "boardsource/unicorne",
"keymap": "default",
"layout": "LAYOUT_split_3x6_3",
"layers": [
[
"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_ESC",
"KC_LGUI", "MO(1)", "KC_SPC", "KC_ENT", "MO(2)", "KC_RALT"
],
[
"_______", "KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_6", "KC_7", "KC_8", "KC_9", "KC_0", "_______",
"_______", "KC_EXLM", "KC_AT", "KC_HASH", "KC_DLR", "KC_PERC", "KC_CIRC", "KC_AMPR", "KC_ASTR", "KC_LPRN", "KC_RPRN", "_______",
"_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______",
"_______", "_______", "_______", "_______", "_______", "_______"
],
[
"QK_BOOT", "_______", "_______", "_______", "_______", "_______", "RGB_VAI", "RGB_HUI", "RGB_SAI", "RGB_MOD", "RGB_TOG", "_______",
"EE_CLR", "_______", "_______", "_______", "_______", "_______", "RGB_VAD", "RGB_HUD", "RGB_SAD", "RGB_RMOD", "CK_TOGG", "_______",
"_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______",
"_______", "_______", "_______", "_______", "_______", "_______"
]
]
}
30 changes: 30 additions & 0 deletions keyboards/boardsource/unicorne/keymaps/via/keymap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"keyboard": "boardsource/unicorne",
"keymap": "via",
"layout": "LAYOUT_split_3x6_3",
"config": {
"features": {
"via": true
}
},
"layers": [
[
"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_ESC",
"KC_LGUI", "MO(1)", "KC_SPC", "KC_ENT", "MO(2)", "KC_RALT"
],
[
"_______", "KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_6", "KC_7", "KC_8", "KC_9", "KC_0", "_______",
"_______", "KC_EXLM", "KC_AT", "KC_HASH", "KC_DLR", "KC_PERC", "KC_CIRC", "KC_AMPR", "KC_ASTR", "KC_LPRN", "KC_RPRN", "_______",
"_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______",
"_______", "_______", "_______", "_______", "_______", "_______"
],
[
"QK_BOOT", "_______", "_______", "_______", "_______", "_______", "RGB_VAI", "RGB_HUI", "RGB_SAI", "RGB_MOD", "RGB_TOG", "_______",
"EE_CLR", "_______", "_______", "_______", "_______", "_______", "RGB_VAD", "RGB_HUD", "RGB_SAD", "RGB_RMOD", "CK_TOGG", "_______",
"_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______", "_______",
"_______", "_______", "_______", "_______", "_______", "_______"
]
]
}
13 changes: 13 additions & 0 deletions keyboards/boardsource/unicorne/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2022 jack (@waffle87)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include_next <mcuconf.h>

#undef RP_I2C_USE_I2C1
#define RP_I2C_USE_I2C1 TRUE

#undef RP_PWM_USE_PWM6
#define RP_PWM_USE_PWM6 TRUE

#undef RP_ADC_USE_ADC1
#define RP_ADC_USE_ADC1 TRUE
25 changes: 25 additions & 0 deletions keyboards/boardsource/unicorne/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Unicorne

![image](https://i.imgur.com/akJJFUmh.jpeg)

* Keyboard Maintainer: [waffle87](https://github.com/waffle87)
* Hardware Supported: Unicorne PCBs w/ integrated RP2040 microcontroller
* Hardware Availability: [boardsource.xyz](https://boardsource.xyz)

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

make boardsource/unicorne:default

Flashing example for this keyboard:

make boardsource/unicorne:default:flash

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).

## Bootloader

Enter the bootloader in 3 ways:

* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (the top left key) and plug in the keyboard
* **Physical reset button**: Briefly press the button on the back of the PCB
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
3 changes: 3 additions & 0 deletions keyboards/boardsource/unicorne/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SERIAL_DRIVER = vendor
AUDIO_DRIVER = pwm_hardware
POINTING_DEVICE_DRIVER = analog_joystick
37 changes: 37 additions & 0 deletions keyboards/boardsource/unicorne/unicorne.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2023 jack (@waffle87)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "unicorne.h"

#ifdef OLED_ENABLE
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
if (!is_keyboard_master()) {
return OLED_ROTATION_180;
}
return rotation;
}

bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
if (is_keyboard_master()) {
switch (get_highest_layer(layer_state)) {
case 0:
oled_write_raw(layer_zero, sizeof(layer_zero));
break;
case 1:
oled_write_raw(layer_zero, sizeof(layer_zero));
break;
case 2:
oled_write_raw(layer_zero, sizeof(layer_zero));
break;
case 3:
oled_write_raw(layer_zero, sizeof(layer_zero));
break;
}
} else {
oled_write_raw(logo, sizeof(logo));
}
return false;
}
#endif
Loading

0 comments on commit 0714b4b

Please sign in to comment.