From 0fdc62b04a5864c3db31688a709b413579e56ce8 Mon Sep 17 00:00:00 2001 From: Muhammad Rizqi Agung Prabowo Date: Sat, 24 Aug 2019 05:27:56 +0700 Subject: [PATCH] first commit, skeleton code, not sure if working --- .../handwired/worthlessowl/owlet60/config.h | 33 ++ .../handwired/worthlessowl/owlet60/info.json | 0 .../owlet60/keymaps/default/keymap.c | 13 + .../handwired/worthlessowl/owlet60/matrix.c | 330 ++++++++++++++++++ .../handwired/worthlessowl/owlet60/owlet60.c | 3 + .../handwired/worthlessowl/owlet60/owlet60.h | 40 +++ .../handwired/worthlessowl/owlet60/readme.md | 15 + .../handwired/worthlessowl/owlet60/rules.mk | 61 ++++ 8 files changed, 495 insertions(+) create mode 100644 keyboards/handwired/worthlessowl/owlet60/config.h create mode 100644 keyboards/handwired/worthlessowl/owlet60/info.json create mode 100644 keyboards/handwired/worthlessowl/owlet60/keymaps/default/keymap.c create mode 100644 keyboards/handwired/worthlessowl/owlet60/matrix.c create mode 100644 keyboards/handwired/worthlessowl/owlet60/owlet60.c create mode 100644 keyboards/handwired/worthlessowl/owlet60/owlet60.h create mode 100644 keyboards/handwired/worthlessowl/owlet60/readme.md create mode 100644 keyboards/handwired/worthlessowl/owlet60/rules.mk diff --git a/keyboards/handwired/worthlessowl/owlet60/config.h b/keyboards/handwired/worthlessowl/owlet60/config.h new file mode 100644 index 00000000000..bea69948120 --- /dev/null +++ b/keyboards/handwired/worthlessowl/owlet60/config.h @@ -0,0 +1,33 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xDA19 +#define MANUFACTURER WorthlessOwl +#define PRODUCT Owlet60 +#define DESCRIPTION TGR Alice inspired 65 or 60 percent keyboard + +#define MATRIX_ROWS 9 +#define MATRIX_COLS 8 + +#define MATRIX_ROW_PINS {B5, F4, F5, F6, F7, B1, B3, B2, B6} +#define MATRIX_COL_SELECT_PINS {D7, B4, E6} +#define MATRIX_COL_DATA_PIN {C6} + +#define BACKLIGHT_PIN D3 + +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_LEVELS 5 + +#define DEBOUNCE 5 + +/* disable debug print */ +#define NO_DEBUG + +/* disable print */ +#define NO_PRINT + +#endif diff --git a/keyboards/handwired/worthlessowl/owlet60/info.json b/keyboards/handwired/worthlessowl/owlet60/info.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/keyboards/handwired/worthlessowl/owlet60/keymaps/default/keymap.c b/keyboards/handwired/worthlessowl/owlet60/keymaps/default/keymap.c new file mode 100644 index 00000000000..3d955e77ae6 --- /dev/null +++ b/keyboards/handwired/worthlessowl/owlet60/keymaps/default/keymap.c @@ -0,0 +1,13 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + // Base Layer + LAYOUT_owlet60_full_bsp( \ + k50, KC_ESC, 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_PGUP, \ + k51, 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_PGDOWN, \ + k52, 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_HOME, \ + KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_N, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, \ + KC_LCTL, KC_LALT, KC_SPC, KC_LGUI,KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT), + +} \ No newline at end of file diff --git a/keyboards/handwired/worthlessowl/owlet60/matrix.c b/keyboards/handwired/worthlessowl/owlet60/matrix.c new file mode 100644 index 00000000000..ecf441a4664 --- /dev/null +++ b/keyboards/handwired/worthlessowl/owlet60/matrix.c @@ -0,0 +1,330 @@ +/* +Copyright 2012 Jun Wako +Copyright 2017 Cole Markham +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 . +*/ + +/* + * scan matrix + */ +#include +#include +#if defined(__AVR__) +#include +#endif +#include "owlet60.h" +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "config.h" +#include "timer.h" + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +#if (DEBOUNCE > 0) + static uint16_t debouncing_time; + static bool debouncing = false; +#endif + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#elif (MATRIX_COLS <= 16) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop16(matrix[i]) +# define ROW_SHIFTER ((uint16_t)1) +#elif (MATRIX_COLS <= 32) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop32(matrix[i]) +# define ROW_SHIFTER ((uint32_t)1) +#endif + +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const uint8_t col_select_pins[3] = MATRIX_COL_SELECT_PINS; +static const uint8_t dat_pin = MATRIX_COL_DATA_PIN; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; //raw values +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; //debounced values + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +//Deprecated. +bool matrix_is_modified(void) +{ + if (debounce_active()) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<