Skip to content

Commit

Permalink
[Keyboard] vinhcatba/uncertainty (qmk#21142)
Browse files Browse the repository at this point in the history
* vinh: test fw for uncertainty (deprecated)

* v0.1: update base firmware with 2 layers, use bongo cat animation for oled

* v0.1: change directory

* v0.1: cleanup

* v0.2: update layers

* v0.3: add VIA support

* v0.3: add VIA support (continue)

* vinh: test fw for uncertainty (deprecated)

* v0.1: update base firmware with 2 layers, use bongo cat animation for oled

* v0.1: change directory

* v0.1: cleanup

* v0.2: update layers

* v0.3: add VIA support

* v0.3: add VIA support (continue)

* v0.3: change keyboard name, remove eeprom config save in VIA keymap

* cleanup for PR

* update readme

* vinh: test fw for uncertainty (deprecated)

* v0.1: update base firmware with 2 layers, use bongo cat animation for oled

* v0.1: change directory

* v0.1: cleanup

* v0.2: update layers

* v0.3: add VIA support

* v0.3: add VIA support (continue)

* vinh: test fw for uncertainty (deprecated)

* v0.1: update base firmware with 2 layers, use bongo cat animation for oled

* v0.1: change directory

* v0.1: cleanup

* v0.3: change keyboard name, remove eeprom config save in VIA keymap

* cleanup for PR

* update readme

* add license to header files, update ws2812 driver and DI_PIN to info.json

* resovle PR suggestion for config.h, halconf.h, mcuconf.h

* update info.json regarding PR comment

* update bongo.h regarding PR comment

* add oled mode toggle

* update readme.md, rules.mk regarding PR comment

* add submodule update

* move oled handle to keyboard level

* Update keyboards/vinhcatba/uncertainty/uncertainty.c

forgot user-level proces_record

* now using bongo as source file

* Apply suggestions from code review

remove default value codes

* move WPM_ENABLE and ENCODER_MAP_ENABLE to keymap level

* Apply suggestions from code review

* Apply suggestions from code review

* Update keyboards/vinhcatba/uncertainty/config.h
  • Loading branch information
vinhcatba authored and csolje committed Oct 21, 2023
1 parent 9245e05 commit f5959b3
Show file tree
Hide file tree
Showing 14 changed files with 984 additions and 0 deletions.
506 changes: 506 additions & 0 deletions keyboards/vinhcatba/uncertainty/bongo.c

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions keyboards/vinhcatba/uncertainty/bongo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright 2022 Parker Levin (@pedker)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

void draw_bongo(bool minimal);
30 changes: 30 additions & 0 deletions keyboards/vinhcatba/uncertainty/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2023 Vinh Le (@vinhcatba)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

/* WS2812 driver config specifically for STM32F401 */
// DI pin = PB1, which is AF02, TIM3_CH4 (table 9 in datasheet)
#define RGBLIGHT_LED_MAP { 2, 3, 4, 5, 6, 0, 1, 7, 8, 9, 10, 11, 12, 13} // index 5 = CAPS; index 6 = NUM

#define WS2812_PWM_DRIVER PWMD3 // TIM3
#define WS2812_PWM_CHANNEL 4 // CH4
#define WS2812_PWM_PAL_MODE 2 // AF2

#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA1 Stream 2 for TIM3_UP (table 28 in reference manual)
#define WS2812_DMA_CHANNEL 5 // DMA Channel 5 for TIM3_UP (table 28 in reference manual)


#define I2C1_CLOCK_SPEED 400000
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9

/* eeprom i2c driver config */
#define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000
#define EXTERNAL_EEPROM_BYTE_COUNT 4096
#define EXTERNAL_EEPROM_PAGE_SIZE 32
#define EXTERNAL_EEPROM_WRITE_TIME 10
//#define EEPROM_I2C_24LC32

/* OLED config */
#define OLED_UPDATE_INTERVAL 100
#define OLED_BRIGHTNESS 200
11 changes: 11 additions & 0 deletions keyboards/vinhcatba/uncertainty/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2023 Vinh Le (@vinhcatba)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#undef HAL_USE_PWM
#define HAL_USE_PWM TRUE

#undef HAL_USE_I2C
#define HAL_USE_I2C TRUE

#include_next <halconf.h>
170 changes: 170 additions & 0 deletions keyboards/vinhcatba/uncertainty/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
"manufacturer": "Vinh Le",
"keyboard_name": "Uncertainty",
"maintainer": "vinhcatba",
"development_board": "blackpill_f401",
"diode_direction": "COL2ROW",
"encoder": {
"rotary": [
{"pin_a": "A13", "pin_b": "A14"}
]
},
"features": {
"bootmagic": true,
"command": false,
"console": false,
"wpm": true,
"encoder": true,
"extrakey": true,
"mousekey": true,
"nkro": true,
"rgblight": true,
"oled": true
},
"matrix_pins": {
"cols": ["A15", "B3", "B4", "B5", "B8", "B9", "B0", "A7", "A6", "A5", "A4", "A3", "A2", "A1", "A0", "C15", "C14", "C13"],
"rows": ["B12", "B13", "B14", "B15", "A8", "A10"]
},
"rgblight": {
"animations": {
"alternating": true,
"breathing": true,
"christmas": true,
"knight": true,
"rainbow_mood": true,
"rainbow_swirl": true,
"rgb_test": true,
"snake": true,
"static_gradient": true,
"twinkle": true
},
"brightness_steps": 10,
"layers": {
"enabled": true,
"override_rgb": true
},
"led_count": 14,
"max_brightness": 255,
"sleep": true
},
"url": "",
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0x564C"
},
"ws2812": {
"driver": "pwm",
"pin": "B1"
},
"layouts": {
"LAYOUT": {
"layout": [
{"label": "0,0", "matrix": [0, 0], "x": 1.25, "y": 0},
{"label": "0,1", "matrix": [0, 1], "x": 2.25, "y": 0},
{"label": "0,2", "matrix": [0, 2], "x": 3.25, "y": 0},
{"label": "0,3", "matrix": [0, 3], "x": 4.25, "y": 0},
{"label": "0,4", "matrix": [0, 4], "x": 5.25, "y": 0},
{"label": "0,5", "matrix": [0, 5], "x": 6.25, "y": 0},
{"label": "0,6", "matrix": [0, 6], "x": 7.25, "y": 0},
{"label": "0,7", "matrix": [0, 7], "x": 8.25, "y": 0},
{"label": "0,8", "matrix": [0, 8], "x": 9.25, "y": 0},
{"label": "0,9", "matrix": [0, 9], "x": 10.25, "y": 0},
{"label": "0,10", "matrix": [0, 10], "x": 11.25, "y": 0},
{"label": "0,11", "matrix": [0, 11], "x": 12.25, "y": 0},
{"label": "0,12", "matrix": [0, 12], "x": 13.25, "y": 0},
{"label": "0,13", "matrix": [0, 13], "x": 14.25, "y": 0},
{"label": "0,14", "matrix": [0, 14], "x": 15.25, "y": 0},
{"label": "0,15", "matrix": [0, 15], "x": 16.25, "y": 0},
{"label": "0,16", "matrix": [0, 16], "x": 17.25, "y": 0},
{"label": "0,17", "matrix": [0, 17], "x": 18.25, "y": 0},
{"label": "1,17", "matrix": [1, 17], "x": 19.25, "y": 0},
{"label": "1,0", "matrix": [1, 0], "x": 1.25, "y": 1},
{"label": "1,1", "matrix": [1, 1], "x": 2.25, "y": 1},
{"label": "1,2", "matrix": [1, 2], "x": 3.25, "y": 1},
{"label": "1,3", "matrix": [1, 3], "x": 4.25, "y": 1},
{"label": "1,4", "matrix": [1, 4], "x": 5.25, "y": 1},
{"label": "1,5", "matrix": [1, 5], "x": 6.25, "y": 1},
{"label": "1,6", "matrix": [1, 6], "x": 7.25, "y": 1},
{"label": "1,7", "matrix": [1, 7], "x": 8.25, "y": 1},
{"label": "1,8", "matrix": [1, 8], "x": 9.25, "y": 1},
{"label": "1,9", "matrix": [1, 9], "x": 10.25, "y": 1},
{"label": "1,10", "matrix": [1, 10], "x": 11.25, "y": 1},
{"label": "1,11", "matrix": [1, 11], "x": 12.25, "y": 1},
{"label": "1,12", "matrix": [1, 12], "x": 13.25, "y": 1},
{"label": "1,13", "matrix": [1, 13], "x": 14.25, "y": 1, "w": 2},
{"label": "1,14", "matrix": [1, 14], "x": 16.25, "y": 1},
{"label": "1,15", "matrix": [1, 15], "x": 17.25, "y": 1},
{"label": "1,16", "matrix": [1, 16], "x": 18.25, "y": 1},
{"label": "3,17", "matrix": [3, 17], "x": 19.25, "y": 1},
{"label": "2,0", "matrix": [2, 0], "x": 0, "y": 1.75},
{"label": "2,1", "matrix": [2, 1], "x": 1.25, "y": 2, "w": 1.5},
{"label": "2,2", "matrix": [2, 2], "x": 2.75, "y": 2},
{"label": "2,3", "matrix": [2, 3], "x": 3.75, "y": 2},
{"label": "2,4", "matrix": [2, 4], "x": 4.75, "y": 2},
{"label": "2,5", "matrix": [2, 5], "x": 5.75, "y": 2},
{"label": "2,6", "matrix": [2, 6], "x": 6.75, "y": 2},
{"label": "2,7", "matrix": [2, 7], "x": 7.75, "y": 2},
{"label": "2,8", "matrix": [2, 8], "x": 8.75, "y": 2},
{"label": "2,9", "matrix": [2, 9], "x": 9.75, "y": 2},
{"label": "2,10", "matrix": [2, 10], "x": 10.75, "y": 2},
{"label": "2,11", "matrix": [2, 11], "x": 11.75, "y": 2},
{"label": "2,12", "matrix": [2, 12], "x": 12.75, "y": 2},
{"label": "2,13", "matrix": [2, 13], "x": 13.75, "y": 2},
{"label": "2,14", "matrix": [2, 14], "x": 14.75, "y": 2, "w": 1.5},
{"label": "2,15", "matrix": [2, 15], "x": 16.25, "y": 2},
{"label": "2,16", "matrix": [2, 16], "x": 17.25, "y": 2},
{"label": "2,17", "matrix": [2, 17], "x": 18.25, "y": 2},
{"label": "4,17", "matrix": [4, 17], "x": 19.25, "y": 2, "h": 2},
{"label": "3,0", "matrix": [3, 0], "x": 0, "y": 3},
{"label": "3,1", "matrix": [3, 1], "x": 1.25, "y": 3, "w": 1.75},
{"label": "3,2", "matrix": [3, 2], "x": 3, "y": 3},
{"label": "3,3", "matrix": [3, 3], "x": 4, "y": 3},
{"label": "3,4", "matrix": [3, 4], "x": 5, "y": 3},
{"label": "3,5", "matrix": [3, 5], "x": 6, "y": 3},
{"label": "3,6", "matrix": [3, 6], "x": 7, "y": 3},
{"label": "3,7", "matrix": [3, 7], "x": 8, "y": 3},
{"label": "3,8", "matrix": [3, 8], "x": 9, "y": 3},
{"label": "3,9", "matrix": [3, 9], "x": 10, "y": 3},
{"label": "3,10", "matrix": [3, 10], "x": 11, "y": 3},
{"label": "3,11", "matrix": [3, 11], "x": 12, "y": 3},
{"label": "3,12", "matrix": [3, 12], "x": 13, "y": 3},
{"label": "3,13", "matrix": [3, 13], "x": 14, "y": 3, "w": 2.25},
{"label": "3,14", "matrix": [3, 14], "x": 16.25, "y": 3},
{"label": "3,15", "matrix": [3, 15], "x": 17.25, "y": 3},
{"label": "3,16", "matrix": [3, 16], "x": 18.25, "y": 3},
{"label": "4,0", "matrix": [4, 0], "x": 0, "y": 4},
{"label": "4,1", "matrix": [4, 1], "x": 1.25, "y": 4, "w": 2.25},
{"label": "4,2", "matrix": [4, 2], "x": 3.5, "y": 4},
{"label": "4,3", "matrix": [4, 3], "x": 4.5, "y": 4},
{"label": "4,4", "matrix": [4, 4], "x": 5.5, "y": 4},
{"label": "4,5", "matrix": [4, 5], "x": 6.5, "y": 4},
{"label": "4,6", "matrix": [4, 6], "x": 7.5, "y": 4},
{"label": "4,7", "matrix": [4, 7], "x": 8.5, "y": 4},
{"label": "4,8", "matrix": [4, 8], "x": 9.5, "y": 4},
{"label": "4,9", "matrix": [4, 9], "x": 10.5, "y": 4},
{"label": "4,10", "matrix": [4, 10], "x": 11.5, "y": 4},
{"label": "4,11", "matrix": [4, 11], "x": 12.5, "y": 4},
{"label": "4,12", "matrix": [4, 12], "x": 13.5, "y": 4, "w": 1.75},
{"label": "4,13", "matrix": [4, 13], "x": 15.25, "y": 4},
{"label": "4,14", "matrix": [4, 14], "x": 16.25, "y": 4},
{"label": "4,15", "matrix": [4, 15], "x": 17.25, "y": 4},
{"label": "4,16", "matrix": [4, 16], "x": 18.25, "y": 4},
{"label": "5,17", "matrix": [5, 17], "x": 19.25, "y": 4, "h": 2},
{"label": "5,0", "matrix": [5, 0], "x": 0, "y": 5},
{"label": "5,1", "matrix": [5, 1], "x": 1.25, "y": 5, "w": 1.25},
{"label": "5,2", "matrix": [5, 2], "x": 2.5, "y": 5, "w": 1.25},
{"label": "5,3", "matrix": [5, 3], "x": 3.75, "y": 5, "w": 1.25},
{"label": "5,6", "matrix": [5, 6], "x": 5, "y": 5, "w": 6.25},
{"label": "5,7", "matrix": [5, 7], "x": 11.25, "y": 5},
{"label": "5,10", "matrix": [5, 10], "x": 12.25, "y": 5},
{"label": "5,11", "matrix": [5, 11], "x": 13.25, "y": 5},
{"label": "5,12", "matrix": [5, 12], "x": 14.25, "y": 5},
{"label": "5,13", "matrix": [5, 13], "x": 15.25, "y": 5},
{"label": "5,14", "matrix": [5, 14], "x": 16.25, "y": 5},
{"label": "5,15", "matrix": [5, 15], "x": 17.25, "y": 5},
{"label": "5,16", "matrix": [5, 16], "x": 18.25, "y": 5}
]
}
}
}
89 changes: 89 additions & 0 deletions keyboards/vinhcatba/uncertainty/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright 2023 Vinh Le (@vinhcatba)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/* 0
* ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┐
* │ Esc │ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │PrtScn│ Del │ Home │ End │ PgUp │ PgDn │
* ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┴──────┼──────┼──────┼──────┼──────┤
* │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Bksp │ # Lk │ / │ * │ - │
* ┌──────┼──────┴───┬──┴───┬──┴───┬──┴───┬──┴───┬──┴───┬──┴───┬──┴───┬──┴───┬──┴───┬──┴───┬──┴───┬──┴───┬─────────┼──────┼──────┼──────┼──────┤
* │ Mute │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ 7 │ 8 │ 9 │ │
* ├──────┼──────────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─────────┼──────┼──────┼──────┤ + |
* │ Null │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │ 4 │ 5 │ 6 │ |
* ├──────┼────────────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴─┬────┴───────┬──────┼──────┤──────┼──────┼──────┤
* │ Null │ Shft │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shft │ Up │ 1 │ 2 │ 3 │ │
* ├──────┼───────┬──────┴┬─────┴─┬────┴──────┴──────┴──────┴──────┴──────┴─────┬┴─────┬┴─────┬┴─────┬──────┼──────┼──────┼──────┼──────┤ Entr |
* │ Null │ Ctrl │ Gui │ Alt │ Space │ Alt │ Fn │ Ctrl │ Left │ Down │ Right│ 0 │ . │ │
* └──────┴───────┴───────┴───────┴─────────────────────────────────────────────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘
*/
[0] = LAYOUT(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_DEL, KC_HOME, KC_END, KC_PGUP, KC_PGDN,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS,
KC_MUTE, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_CALC, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6,
C(KC_V), KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT,
C(KC_C), KC_LCTL, KC_LGUI, KC_LALT, KC_SPC , KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT
),
[1] = LAYOUT(
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS , KC_SCRL, _______, _______, EE_CLR ,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
OLED_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, _______, _______, _______, _______,
_______, _______, _______, _______, _______ , _______, _______, _______,RGB_RMOD, RGB_VAD, RGB_MOD, _______, _______
)
};

#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(KC_BRID, KC_BRIU) }
};
#endif // endif ENCODER_MAP_ENABLE

#ifdef RGBLIGHT_ENABLE
# define HSV_PASTEL_BLUE 150, 155, 51

const rgblight_segment_t PROGMEM my_capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, 1, HSV_PASTEL_BLUE} // Light 1 LED, starting with LED 0
);

const rgblight_segment_t PROGMEM my_numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{1, 1, HSV_PASTEL_BLUE} // Light 1 LED, starting with LED 1
);

const rgblight_segment_t PROGMEM indicators_off_layer[] = RGBLIGHT_LAYER_SEGMENTS(
{0, 2, HSV_OFF} // Turn off 2 LEDs, starting with LED 0
);

// Now define the array of layers. Later layers take precedence
const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(
indicators_off_layer,
my_capslock_layer,
my_numlock_layer
);

bool led_update_user(led_t led_state) {
rgblight_set_layer_state(1, led_state.caps_lock);
rgblight_set_layer_state(2, led_state.num_lock);
return true;
}

void keyboard_post_init_user(void) {
// debug_enable=true;
// debug_matrix=true;

// Enable the LED layers
rgblight_layers = my_rgb_layers;
rgblight_set_layer_state(0, 1);
rgblight_set_effect_range(2, 12);
rgblight_enable();
}
#endif // endif RGBLIGHT_ENABLE


1 change: 1 addition & 0 deletions keyboards/vinhcatba/uncertainty/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes
Loading

0 comments on commit f5959b3

Please sign in to comment.