diff options
Diffstat (limited to 'keyboards/nullbitsco')
25 files changed, 862 insertions, 90 deletions
diff --git a/keyboards/nullbitsco/common/remote_kb.c b/keyboards/nullbitsco/common/remote_kb.c index 89cbf9a92a..8e3f7f6766 100644 --- a/keyboards/nullbitsco/common/remote_kb.c +++ b/keyboards/nullbitsco/common/remote_kb.c @@ -62,15 +62,12 @@ static void send_msg(uint16_t keycode, bool pressed) { msg[IDX_KCMSB] = (keycode >> 8) & 0xFF; msg[IDX_PRESSED] = pressed; msg[IDX_CHECKSUM] = chksum8(msg, UART_MSG_LEN-1); - - for (int i=0; i<UART_MSG_LEN; i++) { - uart_putchar(msg[i]); - } + uart_transmit(msg, UART_MSG_LEN); } -static void print_message_buffer(void) { +static inline void print_message_buffer(void) { for (int i=0; i<UART_MSG_LEN; i++) { - dprintf("msg[%u]: %u\n", i, msg[i]); + dprintf("msg[%u]: 0x%02X\n", i, msg[i]); } } @@ -79,7 +76,7 @@ static void process_uart(void) { if (msg[IDX_PREAMBLE] != UART_PREAMBLE || msg[IDX_CHECKSUM] != chksum) { dprintf("UART checksum mismatch!\n"); print_message_buffer(); - dprintf("calc checksum: %u\n", chksum); + dprintf("calc checksum: 0x%02X\n", chksum); } else { uint16_t keycode = (uint16_t)msg[IDX_KCLSB] | ((uint16_t)msg[IDX_KCMSB] << 8); bool pressed = (bool)msg[IDX_PRESSED]; @@ -103,14 +100,15 @@ static void process_uart(void) { static void get_msg(void) { while (uart_available()) { - msg[msg_idx] = uart_getchar(); - dprintf("idx: %u, recv: %u\n", msg_idx, msg[msg_idx]); + msg[msg_idx] = uart_read(); + dprintf("idx: %u, recv: 0x%002X\n", msg_idx, msg[msg_idx]); if (msg_idx == 0 && (msg[msg_idx] != UART_PREAMBLE)) { dprintf("Byte sync error!\n"); msg_idx = 0; } else if (msg_idx == (UART_MSG_LEN-1)) { process_uart(); msg_idx = 0; + break; } else { msg_idx++; } diff --git a/keyboards/nullbitsco/common/remote_kb.h b/keyboards/nullbitsco/common/remote_kb.h index 6270e8f9f1..da124bf5f4 100644 --- a/keyboards/nullbitsco/common/remote_kb.h +++ b/keyboards/nullbitsco/common/remote_kb.h @@ -17,7 +17,7 @@ #include "quantum.h" -#define SERIAL_UART_BAUD 153600 //low error rate for 32u4 @ 16MHz +#define SERIAL_UART_BAUD 76800 //low error rate for 32u4 @ 16MHz #define UART_PREAMBLE 0x69 #define UART_MSG_LEN 5 diff --git a/keyboards/nullbitsco/nibble/keymaps/default/keymap.c b/keyboards/nullbitsco/nibble/keymaps/default/keymap.c index f9fc56e702..9337c82863 100644 --- a/keyboards/nullbitsco/nibble/keymaps/default/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/default/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_F16, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FN), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [_FN] = LAYOUT_ansi( - RESET, 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_END, + QK_BOOT, 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_END, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/nullbitsco/nibble/keymaps/iso/keymap.c b/keyboards/nullbitsco/nibble/keymaps/iso/keymap.c index 0f0ed590a4..866585b909 100644 --- a/keyboards/nullbitsco/nibble/keymaps/iso/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/iso/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_F16, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FN), KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [_FN] = LAYOUT_iso( - RESET, 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_HOME, KC_INS, + QK_BOOT, 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_HOME, KC_INS, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/nullbitsco/nibble/keymaps/oled/keymap.c b/keyboards/nullbitsco/nibble/keymaps/oled/keymap.c index 14f79f5fbf..300af70737 100644 --- a/keyboards/nullbitsco/nibble/keymaps/oled/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/oled/keymap.c @@ -83,8 +83,9 @@ static void render_logo(void) { oled_write_raw_P(nibble_logo, sizeof(nibble_logo)); } -void oled_task_user(void) { +bool oled_task_user(void) { render_logo(); + return false; } #endif diff --git a/keyboards/nullbitsco/nibble/keymaps/oled_bongocat/keymap.c b/keyboards/nullbitsco/nibble/keymaps/oled_bongocat/keymap.c index 5c4e31ab6b..a4e484f9cf 100644 --- a/keyboards/nullbitsco/nibble/keymaps/oled_bongocat/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/oled_bongocat/keymap.c @@ -155,7 +155,7 @@ static void render_anim(void) { } } -void oled_task_user(void) { +bool oled_task_user(void) { render_anim(); oled_set_cursor(0, 14); @@ -168,6 +168,8 @@ void oled_task_user(void) { wpm_counter[1] = '0'; wpm_counter[0] = '>'; oled_write_ln(wpm_counter, false); + + return false; } #endif diff --git a/keyboards/nullbitsco/nibble/keymaps/oled_status/keymap.c b/keyboards/nullbitsco/nibble/keymaps/oled_status/keymap.c index 161eeedc3a..fa72a78905 100644 --- a/keyboards/nullbitsco/nibble/keymaps/oled_status/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/oled_status/keymap.c @@ -51,11 +51,12 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; } -void oled_task_user(void) { +bool oled_task_user(void) { if (timer_elapsed(oled_timer) >= 3000) { set_oled_mode(OLED_MODE_IDLE); } render_frame(); + return false; } #endif diff --git a/keyboards/nullbitsco/nibble/keymaps/snailmap/keymap.c b/keyboards/nullbitsco/nibble/keymaps/snailmap/keymap.c index d628a976fb..e549f22a83 100644 --- a/keyboards/nullbitsco/nibble/keymaps/snailmap/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/snailmap/keymap.c @@ -106,73 +106,73 @@ static void write_pixel(int x, int y, bool onoff) { static void render_background(void) { if (oled_horizontal) { static const char PROGMEM oled_keymap_horizontal[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x84, 0x80, 0x80, 0x80, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, - 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, - 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, - 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, - 0x80, 0x04, 0x04, 0x04, 0x04, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x84, 0x80, 0x80, 0x80, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, + 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, + 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, + 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00, + 0x80, 0x04, 0x04, 0x04, 0x04, 0x84, 0x84, 0x84, 0x84, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, + 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; oled_write_raw_P(oled_keymap_horizontal, sizeof(oled_keymap_horizontal)); } else { static const char PROGMEM oled_keymap_vertical[] = { - 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, - 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, - 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, + 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; oled_write_raw_P(oled_keymap_vertical, sizeof(oled_keymap_vertical)); @@ -257,7 +257,7 @@ static void render_keymap(uint8_t key_row, uint8_t key_col, bool onoff) { int top = keymap_coords[key_row][key_col][1] + keymap_template[1]; int right = left + length - 1; int bottom = top + 4; - + // Special case 1 - Draw enter key on ISO layout, return if ((ansi_layout == false) && (key_row == 2) && (key_col == 14)) { for (int i = 0; i < 10; i++) { @@ -427,7 +427,7 @@ static void render_wpm_graph(int current_wpm) { } // Call OLED functions -void oled_task_user(void) { +bool oled_task_user(void) { // Draw OLED keyboard, prevent redraw if (first_loop) { render_background(); @@ -456,6 +456,7 @@ void oled_task_user(void) { render_wpm_graph(current_wpm); timer = timer_read(); } + return false; } #endif @@ -463,7 +464,7 @@ void oled_task_user(void) { bool process_record_user(uint16_t keycode, keyrecord_t *record) { // Forwards keystrokes from an external input device over UART/TRRS process_record_remote_kb(keycode, record); - + #ifdef OLED_ENABLE // Toggle pixels surrounding key render_keymap(record->event.key.row, record->event.key.col, record->event.pressed); @@ -472,7 +473,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } -// Rotary encoder - RGB and OLED settings +// Rotary encoder - RGB and OLED settings void change_RGB(bool clockwise) { // While on any layer except default: // Rotary = RGB Mode bool shift = get_mods() & MOD_MASK_SHIFT; // Rotary + Shift = OLED Brightness @@ -539,4 +540,4 @@ void matrix_init_user(void) { // Scan and parse keystrokes from remote keyboard, if connected void matrix_scan_user(void) { matrix_scan_remote_kb(); -}
\ No newline at end of file +} diff --git a/keyboards/nullbitsco/nibble/keymaps/via/keymap.c b/keyboards/nullbitsco/nibble/keymaps/via/keymap.c index b1c9242b9a..86fe152cd4 100644 --- a/keyboards/nullbitsco/nibble/keymaps/via/keymap.c +++ b/keyboards/nullbitsco/nibble/keymaps/via/keymap.c @@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_VIA1] = LAYOUT_all( - RESET, 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_END, + QK_BOOT, 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_END, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/nullbitsco/nibble/rules.mk b/keyboards/nullbitsco/nibble/rules.mk index ab20cfa246..f33bfbb9b8 100644 --- a/keyboards/nullbitsco/nibble/rules.mk +++ b/keyboards/nullbitsco/nibble/rules.mk @@ -12,8 +12,7 @@ MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -NKRO_ENABLE = yes # USB Nkey Rollover +NKRO_ENABLE = yes # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output diff --git a/keyboards/nullbitsco/scramble/keymaps/oled/keymap.c b/keyboards/nullbitsco/scramble/keymaps/oled/keymap.c index 109da78ad6..b1c9282253 100644 --- a/keyboards/nullbitsco/scramble/keymaps/oled/keymap.c +++ b/keyboards/nullbitsco/scramble/keymaps/oled/keymap.c @@ -67,8 +67,9 @@ static void render_logo(void) { oled_write_raw_P(nullbits_logo, sizeof(nullbits_logo)); } -void oled_task_user(void) { +bool oled_task_user(void) { render_logo(); + return false; } #endif diff --git a/keyboards/nullbitsco/scramble/rules.mk b/keyboards/nullbitsco/scramble/rules.mk index dc1da34964..e6d789691b 100644 --- a/keyboards/nullbitsco/scramble/rules.mk +++ b/keyboards/nullbitsco/scramble/rules.mk @@ -12,10 +12,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -NKRO_ENABLE = no # USB Nkey Rollover +NKRO_ENABLE = no # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output diff --git a/keyboards/nullbitsco/tidbit/config.h b/keyboards/nullbitsco/tidbit/config.h new file mode 100644 index 0000000000..103dabdb96 --- /dev/null +++ b/keyboards/nullbitsco/tidbit/config.h @@ -0,0 +1,62 @@ +/* Copyright 2021 Jay Greco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include "config_common.h" + +/* Used to set remote for remote KB if VUSB detect doesn't work. */ +// #define KEYBOARD_REMOTE + +// Workaround for freezing after MacOS sleep +#define USB_SUSPEND_WAKEUP_DELAY 200 + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x6E61 +#define PRODUCT_ID 0x6064 +#define DEVICE_VER 0x0001 +#define MANUFACTURER nullbits +#define PRODUCT TIDBIT + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 6 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B1, E6, D7, C6, D4 } +#define MATRIX_COL_PINS { NO_PIN, NO_PIN, F4, F5, F6, F7 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION ROW2COL + +/* Optional SMT LED pins */ +#define RGB_DI_PIN B6 +#define RGBLED_NUM 8 +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE + +/* Optional encoder pins */ +// Encoders are defined in order. 1: B2 & B3, 2: B4 & B5, 3: D0 & D1, 4: D2 & D3 +#define ENCODERS_PAD_A { B2, B4, D0, D3 } +#define ENCODERS_PAD_B { B3, B5, D1, D2 } diff --git a/keyboards/nullbitsco/tidbit/info.json b/keyboards/nullbitsco/tidbit/info.json new file mode 100644 index 0000000000..5d260cc453 --- /dev/null +++ b/keyboards/nullbitsco/tidbit/info.json @@ -0,0 +1,14 @@ +{ + "keyboard_name": "TIDBIT 19", + "url": "https://nullbits.co/tidbit/", + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"/", "x":3.25, "y":0}, {"label":"*", "x":4.25, "y":0}, {"label":"-", "x":5.25, "y":0}, + {"label":"Enc 1", "x":0, "y":1}, {"label":"Enc 1", "x":1, "y":1}, {"label":"7", "x":2.25, "y":1}, {"label":"8", "x":3.25, "y":1}, {"label":"9", "x":4.25, "y":1}, {"label":"+", "x":5.25, "y":1}, + {"label":"Enc 2", "x":0, "y":2}, {"label":"Enc 2", "x":1, "y":2}, {"label":"4", "x":2.25, "y":2}, {"label":"5", "x":3.25, "y":2}, {"label":"6", "x":4.25, "y":2}, {"label":"+", "x":5.25, "y":2}, + {"label":"Enc 3", "x":0, "y":3}, {"label":"Enc 3", "x":1, "y":3}, {"label":"1", "x":2.25, "y":3}, {"label":"2", "x":3.25, "y":3}, {"label":"3", "x":4.25, "y":3}, {"label":"Enter", "x":5.25, "y":3}, + {"label":"Enc 4", "x":0, "y":4}, {"label":"Enc 4", "x":1, "y":4}, {"label":"0", "x":2.25, "y":4}, {"label":"0", "x":3.25, "y":4}, {"label":".", "x":4.25, "y":4}, {"label":"Enter", "x":5.25, "y":4}] + } + } +} diff --git a/keyboards/nullbitsco/tidbit/keymaps/default/keymap.c b/keyboards/nullbitsco/tidbit/keymaps/default/keymap.c new file mode 100644 index 0000000000..995aff8d69 --- /dev/null +++ b/keyboards/nullbitsco/tidbit/keymaps/default/keymap.c @@ -0,0 +1,40 @@ +/* Copyright 2021 Jay Greco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H + +enum layers { + _BASE = 0, + _FUNC +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + KC_PSLS, KC_PAST, KC_PMNS, + KC_VOLD, KC_VOLU, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_MPRV, KC_MNXT, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_LEFT, KC_RGHT, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_TRNS, KC_TRNS, KC_P0, KC_P0, KC_PDOT, KC_PENT + ), + + [_FUNC] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), +}; diff --git a/keyboards/nullbitsco/tidbit/keymaps/oled/keymap.c b/keyboards/nullbitsco/tidbit/keymaps/oled/keymap.c new file mode 100644 index 0000000000..3fbfb638ec --- /dev/null +++ b/keyboards/nullbitsco/tidbit/keymaps/oled/keymap.c @@ -0,0 +1,58 @@ +/* Copyright 2021 Jay Greco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H + +enum layers { + _BASE = 0, + _VIA1, + _VIA2, + _VIA3 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + KC_PSLS, KC_PAST, KC_PMNS, + KC_VOLD, KC_VOLU, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_TRNS, KC_TRNS, KC_P0, KC_P0, KC_PDOT, KC_PENT + ), + + [_VIA1] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), + + [_VIA2] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), + + [_VIA3] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), +}; diff --git a/keyboards/nullbitsco/tidbit/keymaps/oled/rules.mk b/keyboards/nullbitsco/tidbit/keymaps/oled/rules.mk new file mode 100644 index 0000000000..ef531564fc --- /dev/null +++ b/keyboards/nullbitsco/tidbit/keymaps/oled/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 diff --git a/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c b/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c new file mode 100644 index 0000000000..cfe97e30a3 --- /dev/null +++ b/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c @@ -0,0 +1,283 @@ +/* Copyright 2021 dogspace <https://github.com/dogspace> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H + +enum layer_names { + _LAY0, + _LAY1, + _LAY2, + _LAY3 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_LAY0] = LAYOUT( + KC_PSLS, KC_PAST, KC_PMNS, + KC_VOLD, KC_VOLU, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_TRNS, KC_TRNS, KC_P0, KC_P0, KC_PDOT, KC_PENT + ), + + [_LAY1] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), + + [_LAY2] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), + + [_LAY3] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), +}; + +#ifdef OLED_ENABLE +/*=========================================== OLED CONFIGURATION ===========================================*/ +#define OLED_ROTATE true // OLED rotation (flip 180* from default orientation) +#define GRAPH_DIRECTION true // Graph movement (true = right to left, false = left to right) +#define GRAPH_TOP_WPM 100.0 // Minimum WPM required to reach the top of the graph +#define GRAPH_REFRESH 1000 // In milliseconds, determines the graph-line frequency +#define ICON_MED_WPM 10 // WPM required to display the medium snail +#define ICON_FAST_WPM 25 // WPM required to display the fast snail + +// Layer names: Should be exactly 5 characters in length if vertical display, or 6 characters if horizontal +#define MA_LAYER_NAME "LAY 0" // Layer _MA name +#define L1_LAYER_NAME "LAY 1" // Layer _L1 name +#define L2_LAYER_NAME "LAY 2" // Layer _L2 name +#define L3_LAYER_NAME "LAY 3" // Layer _L3 name + +#define CAPLCK_STR "CAPLK" // Caps Lock string +#define NUMLCK_STR "NUMLK" // Num Lock string +#define SCRLK_STR "SCRLK" // Scroll Lock string +#define EMPTY_STR " " // Empty string + +/*================================================================================================================*/ + +typedef struct oled_params { + bool first_loop : 1; + uint8_t wpm_icon : 7; + uint16_t timer; + uint8_t wpm_limit; + uint8_t max_wpm; + uint8_t graph_lines[32]; +} oled_params; + +oled_params oled_data; + +void oled_init_data(void) { + // Initialize oled params + oled_data.first_loop = true; + oled_data.wpm_icon = 5; + oled_data.timer = 0; + oled_data.wpm_limit = 20; + oled_data.max_wpm = 0; + + for (int i=0; i<32; i++) { + oled_data.graph_lines[i] = 0; + } +} + +// Set OLED rotation +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + oled_init_data(); + return OLED_ROTATE ? OLED_ROTATION_270 : OLED_ROTATION_90; +} + +// Draw static background image to OLED (keyboard with no bottom row) +static void render_background(void) { + static const char PROGMEM nullbits_n_oled[] = { + 0x00, 0xe0, 0xf0, 0xf0, 0xf8, 0xf8, 0xf0, 0xf0, 0xe0, 0x80, 0x20, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, + 0x1f, 0x1f, 0x1f, 0x1f, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xf0, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x07, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x07, 0x03, 0x00, + }; + oled_write_raw_P(nullbits_n_oled, sizeof(nullbits_n_oled)); +} + +// Toggles pixel on/off, converts horizontal coordinates to vertical equivalent if necessary +static void write_pixel(uint8_t x, uint8_t y, bool onoff) { + oled_write_pixel(y, 127 - x, onoff); +} + +// Write active layer name +static void render_layer_state(void) { + oled_set_cursor(0, 15); + switch (get_highest_layer(layer_state)) { + case _LAY0: + oled_write_P(PSTR(MA_LAYER_NAME), false); + break; + case _LAY1: + oled_write_P(PSTR(L1_LAYER_NAME), false); + break; + case _LAY2: + oled_write_P(PSTR(L2_LAYER_NAME), false); + break; + case _LAY3: + oled_write_P(PSTR(L3_LAYER_NAME), false); + break; + default: + oled_write("ERROR", false); + break; + } +} + +// Update WPM counters +static void render_wpm_counters(uint8_t current_wpm) { + uint8_t cursorposition_cur = 13; + uint8_t cursorposition_max = 14; + + oled_set_cursor(0, cursorposition_cur); + oled_write(get_u8_str(current_wpm, '0'), false); + + if (current_wpm > oled_data.max_wpm) { + oled_data.max_wpm = current_wpm; + oled_data.wpm_limit = oled_data.max_wpm + 20; + oled_set_cursor(0, cursorposition_max); + oled_write(get_u8_str(current_wpm, '0'), false); + } +} + +static void render_led_status(void) { + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_set_cursor(0, 8); + oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR(CAPLCK_STR) : PSTR(EMPTY_STR), false); + oled_set_cursor(0, 9); + oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR(NUMLCK_STR) : PSTR(EMPTY_STR), false); + oled_set_cursor(0, 10); + oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR(SCRLK_STR) : PSTR(EMPTY_STR), false); +} + +// Update WPM snail icon +static void render_wpm_icon(uint8_t current_wpm) { + // wpm_icon is used to prevent unnecessary redraw + if ((current_wpm < ICON_MED_WPM) && (oled_data.wpm_icon != 0)) { + oled_data.wpm_icon = 0; + } else if ((current_wpm >= ICON_MED_WPM) && (current_wpm < ICON_FAST_WPM) && (oled_data.wpm_icon != 1)) { + oled_data.wpm_icon = 1; + } else if ((current_wpm >= ICON_FAST_WPM) && (oled_data.wpm_icon != 2)) { + oled_data.wpm_icon = 2; + } else { + return; + } + static const char PROGMEM snails[][2][24] = { + {{0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0xA0, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x50, 0x88, 0x04, 0x00, 0x00}, + {0x40, 0x60, 0x50, 0x4E, 0x51, 0x64, 0x4A, 0x51, 0x54, 0x49, 0x41, 0x62, 0x54, 0x49, 0x46, 0x41, 0x40, 0x30, 0x09, 0x04, 0x02, 0x01, 0x00, 0x00}}, + {{0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x00, 0x04, 0x98, 0x60, 0x80, 0x00, 0x00, 0x00, 0x00}, + {0x60, 0x50, 0x54, 0x4A, 0x51, 0x64, 0x4A, 0x51, 0x55, 0x49, 0x41, 0x62, 0x54, 0x49, 0x46, 0x41, 0x21, 0x10, 0x0A, 0x08, 0x05, 0x02, 0x00, 0x00}}, + {{0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x10, 0x10, 0x10, 0x20, 0x40, 0x40, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00}, + {0x60, 0x58, 0x54, 0x62, 0x49, 0x54, 0x52, 0x51, 0x55, 0x49, 0x62, 0x52, 0x4D, 0x45, 0x46, 0x22, 0x21, 0x11, 0x10, 0x0A, 0x08, 0x05, 0x02, 0x00}} + }; + oled_set_cursor(0, 11); + oled_write_raw_P(snails[oled_data.wpm_icon][0], sizeof(snails[oled_data.wpm_icon][0])); + oled_set_cursor(0, 12); + oled_write_raw_P(snails[oled_data.wpm_icon][1], sizeof(snails[oled_data.wpm_icon][1])); +} + +// Update WPM graph +static void render_wpm_graph(uint8_t current_wpm) { + uint8_t line_height = ((current_wpm / GRAPH_TOP_WPM) * 7); + if (line_height > 7) { + line_height = 7; + } + // Count graph line pixels, return if nothing to draw + uint8_t pixel_count = line_height; + for (int i = 0; i < 31; i++) { + pixel_count += oled_data.graph_lines[i]; + } + if (pixel_count == 0) { + return; + } + // Shift array elements left or right depending on GRAPH_DIRECTION pend new graph line + if (GRAPH_DIRECTION) { + for (int i = 0; i < 31; i++) { + oled_data.graph_lines[i] = oled_data.graph_lines[i + 1]; + } + oled_data.graph_lines[31] = line_height; + } else { + for (int i = 31; i > 0; i--) { + oled_data.graph_lines[i] = oled_data.graph_lines[i - 1]; + } + oled_data.graph_lines[0] = line_height; + } + // Draw all graph lines (left to right, bottom to top) + uint16_t draw_count, arrpos; + for (int x = 1; x <= 63; x += 2) { + arrpos = x / 2; + draw_count = oled_data.graph_lines[arrpos]; + for (int y = 31; y >= 25; y--) { + if (draw_count > 0) { + write_pixel(x, y, true); + draw_count--; + } else { + write_pixel(x, y, false); + } + } + } +} + +// Call OLED functions +bool oled_task_user(void) { + // Draw OLED keyboard, prevent redraw + if (oled_data.first_loop) { + render_background(); + oled_data.first_loop = false; + } + // Get current WPM, subtract 25% for accuracy and prevent large jumps caused by simultaneous keypresses + uint8_t current_wpm = get_current_wpm(); + // Write active layer name to display + render_layer_state(); + // Update WPM counters + render_wpm_counters(current_wpm); + // Update WPM snail icon + render_wpm_icon(current_wpm); + // Update LED status + render_led_status(); + // Update WPM graph every graph_refresh milliseconds + if (timer_elapsed(oled_data.timer) > GRAPH_REFRESH) { + render_wpm_graph(current_wpm); + oled_data.timer = timer_read(); + } + return false; +} +#endif + +bool wpm_keycode_user(uint16_t keycode) { + // Count all keycodes on the macropad + return true; +} + diff --git a/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/rules.mk b/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/rules.mk new file mode 100644 index 0000000000..1b72fd006a --- /dev/null +++ b/keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/rules.mk @@ -0,0 +1,6 @@ +OLED_ENABLE = yes +WPM_ENABLE = yes +VIA_ENABLE = yes +SPACE_CADET_ENABLE = no +GRAVE_ESC_ENABLE = no +MAGIC_ENABLE = no diff --git a/keyboards/nullbitsco/tidbit/keymaps/via/keymap.c b/keyboards/nullbitsco/tidbit/keymaps/via/keymap.c new file mode 100644 index 0000000000..ad3e18075c --- /dev/null +++ b/keyboards/nullbitsco/tidbit/keymaps/via/keymap.c @@ -0,0 +1,59 @@ +/* Copyright 2021 Jay Greco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H + +enum layers { + _BASE = 0, + _VIA1, + _VIA2, + _VIA3 +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + KC_PSLS, KC_PAST, KC_PMNS, + KC_VOLD, KC_VOLU, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_TRNS, KC_TRNS, KC_P0, KC_P0, KC_PDOT, KC_PENT + ), + + [_VIA1] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), + + [_VIA2] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), + + [_VIA3] = LAYOUT( + ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___ + ), +}; + diff --git a/keyboards/nullbitsco/tidbit/keymaps/via/rules.mk b/keyboards/nullbitsco/tidbit/keymaps/via/rules.mk new file mode 100644 index 0000000000..036bd6d1c3 --- /dev/null +++ b/keyboards/nullbitsco/tidbit/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes
\ No newline at end of file diff --git a/keyboards/nullbitsco/tidbit/readme.md b/keyboards/nullbitsco/tidbit/readme.md new file mode 100644 index 0000000000..f2d0d9934b --- /dev/null +++ b/keyboards/nullbitsco/tidbit/readme.md @@ -0,0 +1,26 @@ +# TIDBIT + +![TIDBIT](https://nullbits.co/static/img/tidbit1.jpg) + +A very moddable 19-key numpad kit built by nullbits. [More info at nullbits.co](https://nullbits.co/tidbit/) + +* Keyboard Maintainer: [Jay Greco](https://github.com/jaygreco) +* Hardware Supported: TIDBIT Rev1, Pro Micro comaptible MCUs. +* Hardware Availability: [nullbits.co](https://nullbits.co/) + +Note: If you are seeing issues with MacOS and keyboard hangs after sleep, make sure `NO_USB_STARTUP_CHECK = yes` is set in your rules.mk. + +Adds experimental "Remote Keyboard" functionality, which forwards keystrokes from an external macropad, keyboard, or numpad over UART/TRRS, removing the need for an additional USB connection. + +## Bootloader + +Enter the bootloader in 2 ways: + +* **Physical reset button**: Briefly press the button on the back of the PCB +* **Keycode in layout**: Press the key mapped to `RESET` if it is available + +Make example for this keyboard (after setting up your build environment): + + make nullbitsco/tidbit:default + +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). diff --git a/keyboards/nullbitsco/tidbit/rules.mk b/keyboards/nullbitsco/tidbit/rules.mk new file mode 100644 index 0000000000..13893a69e2 --- /dev/null +++ b/keyboards/nullbitsco/tidbit/rules.mk @@ -0,0 +1,26 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +LTO_ENABLE = yes + +# Project specific files +SRC += common/bitc_led.c \ + common/remote_kb.c +QUANTUM_LIB_SRC += i2c_master.c \ + uart.c diff --git a/keyboards/nullbitsco/tidbit/tidbit.c b/keyboards/nullbitsco/tidbit/tidbit.c new file mode 100644 index 0000000000..6e7ef460e5 --- /dev/null +++ b/keyboards/nullbitsco/tidbit/tidbit.c @@ -0,0 +1,157 @@ +/* Copyright 2021 Jay Greco +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H + +typedef struct PACKED { + uint8_t r; + uint8_t c; +} encodermap_t; + +// Map encoders to their respective virtual matrix entry +// Allows for encoder control using VIA +const encodermap_t encoder_map[4][2] = { + {{1, 0}, {1, 1}}, // Encoder 1 matrix location + {{2, 0}, {2, 1}}, // Encoder 2 matrix location + {{3, 0}, {3, 1}}, // Encoder 3 matrix location + {{4, 0}, {4, 1}}, // Encoder 4 matrix location +}; + +bool numlock_set = false; + +#ifdef OLED_ENABLE +oled_rotation_t oled_init_kb(oled_rotation_t rotation) { + return OLED_ROTATION_180; +} + +static void render_logo(void) { + static const char PROGMEM tidbit_oled[] = { + 0x00, 0x0e, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, + 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, + 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x3e, 0x3e, 0x7e, 0xfc, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, + 0x1f, 0x1f, 0x3f, 0x7e, 0xfe, 0xfe, 0xfc, 0xf8, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfe, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x0e, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, + 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, + 0xe0, 0xf0, 0xf0, 0xf8, 0xff, 0xff, 0xbf, 0x1f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x03, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x07, 0x07, 0xbf, 0xff, 0xff, 0xff, 0xfe, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0xff, 0xff, 0x7f, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, + 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xf8, 0xf8, 0xf8, + 0xf8, 0xf8, 0xf8, 0x7c, 0x7c, 0x7c, 0x7e, 0x3e, 0x3f, 0x3f, 0x1f, 0x0f, 0x07, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, + 0xf8, 0x7c, 0x7c, 0x7c, 0x7e, 0x3f, 0x3f, 0x1f, 0x1f, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7f, 0xff, 0xff, 0x7f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3f, 0x7f, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + oled_write_raw_P(tidbit_oled, sizeof(tidbit_oled)); +}; + +bool oled_task_kb(void) { + if (!oled_task_user()) return false; + render_logo(); + return true; +} + +#endif + +static void process_encoder_matrix(encodermap_t pos) { + action_exec((keyevent_t){ + .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = true, .time = (timer_read() | 1) /* time should not be 0 */ + }); +#if TAP_CODE_DELAY > 0 + wait_ms(TAP_CODE_DELAY); +#endif + action_exec((keyevent_t){ + .key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = false, .time = (timer_read() | 1) /* time should not be 0 */ + }); +} + +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) return false; + process_encoder_matrix(encoder_map[index][clockwise ? 0 : 1]); + return false; +} + +// Use Bit-C LED to show NUM LOCK status +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if (res) { + set_bitc_LED(led_state.num_lock ? LED_DIM : LED_OFF); + } + return res; +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + process_record_remote_kb(keycode, record); + if (!process_record_user(keycode, record)) return false; + + // Get the current NLCK status & set if not set. + // Only do this once, in case user has a NLCK key + // and wants to disable it later on. + if (!numlock_set && record->event.pressed) { + led_t led_state = host_keyboard_led_state(); + if (!led_state.num_lock) { + register_code(KC_NLCK); + } + numlock_set = true; + } + + switch (keycode) { + case RESET: + if (record->event.pressed) { + set_bitc_LED(LED_DIM); + rgblight_disable_noeeprom(); + #ifdef OLED_ENABLE + oled_off(); + #endif + bootloader_jump(); // jump to bootloader + } + return false; + + default: + break; + } + + return true; +} + +void matrix_init_kb(void) { + set_bitc_LED(LED_OFF); + matrix_init_remote_kb(); + matrix_init_user(); +} + +void matrix_scan_kb(void) { + matrix_scan_remote_kb(); + matrix_scan_user(); +} diff --git a/keyboards/nullbitsco/tidbit/tidbit.h b/keyboards/nullbitsco/tidbit/tidbit.h new file mode 100644 index 0000000000..e4e80107e3 --- /dev/null +++ b/keyboards/nullbitsco/tidbit/tidbit.h @@ -0,0 +1,37 @@ +/* Copyright 2021 Jay Greco + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#define ___ KC_NO + +#include "quantum.h" +#include "common/remote_kb.h" +#include "common/bitc_led.h" + +#define LAYOUT( \ + K01, K02, K03, \ + E1CCW, E1CW, K10, K11, K12, K13, \ + E2CCW, E2CW, K20, K21, K22, K23, \ + E3CCW, E3CW, K30, K31, K32, K33, \ + E4CCW, E4CW, K40, K41, K42, K43 \ +) \ +{ \ + { ___, ___, ___, K01, K02, K03 }, \ + { E1CCW, E1CW, K10, K11, K12, K13 }, \ + { E2CCW, E2CW, K20, K21, K22, K23 }, \ + { E3CCW, E3CW, K30, K31, K32, K33 }, \ + { E4CCW, E4CW, K40, K41, K42, K43 } \ +} |