From 3fce5e6912d78ec9fff4124b6952e3b8a0d4d3ae Mon Sep 17 00:00:00 2001 From: jpuerto96 Date: Thu, 26 Aug 2021 13:45:48 -0400 Subject: New Keyboard - V4n4g0rth0n (#14152) * General: Initial commit for v4n4g0rth0n * Remove unecessary things| * General: Fix info.json * Finalize changes * Update keyboards/v4n4g0rth0n/config.h Co-authored-by: Joel Challis * Update keyboards/v4n4g0rth0n/v1/rules.mk Co-authored-by: Joel Challis * Update keyboards/v4n4g0rth0n/v4n4g0rth0n.h Co-authored-by: Ryan * Update keyboards/v4n4g0rth0n/v4n4g0rth0n.h Co-authored-by: Ryan * Update keyboards/v4n4g0rth0n/v2/keymaps/default/keymap.c Co-authored-by: Ryan * Update keyboards/v4n4g0rth0n/v1/keymaps/default/keymap.c Co-authored-by: Ryan Co-authored-by: Joel Challis Co-authored-by: Ryan --- keyboards/v4n4g0rth0n/v2/config.h | 23 ++++++ keyboards/v4n4g0rth0n/v2/keymaps/default/keymap.c | 86 +++++++++++++++++++++++ keyboards/v4n4g0rth0n/v2/readme.md | 1 + keyboards/v4n4g0rth0n/v2/rules.mk | 25 +++++++ 4 files changed, 135 insertions(+) create mode 100644 keyboards/v4n4g0rth0n/v2/config.h create mode 100644 keyboards/v4n4g0rth0n/v2/keymaps/default/keymap.c create mode 100644 keyboards/v4n4g0rth0n/v2/readme.md create mode 100644 keyboards/v4n4g0rth0n/v2/rules.mk (limited to 'keyboards/v4n4g0rth0n/v2') diff --git a/keyboards/v4n4g0rth0n/v2/config.h b/keyboards/v4n4g0rth0n/v2/config.h new file mode 100644 index 0000000000..6e78e73573 --- /dev/null +++ b/keyboards/v4n4g0rth0n/v2/config.h @@ -0,0 +1,23 @@ +/* +Copyright 2021 jpuerto + +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 . +*/ + +#pragma once + +#define DEVICE_VER 0x0002 + +#define MATRIX_ROW_PINS { C7, C6, B6, B5, B7} +#define MATRIX_COL_PINS { D3, D2, D1, D0, D5, F7, F6, E6, F5, F4, F1, B0} diff --git a/keyboards/v4n4g0rth0n/v2/keymaps/default/keymap.c b/keyboards/v4n4g0rth0n/v2/keymaps/default/keymap.c new file mode 100644 index 0000000000..11616b2e7b --- /dev/null +++ b/keyboards/v4n4g0rth0n/v2/keymaps/default/keymap.c @@ -0,0 +1,86 @@ +/* Copyright 2021 jpuerto + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "analog.h" +int16_t max_pot_val = 1023; +int16_t max_ticks = 20; +int16_t pot_oldVal = 0; +int16_t pot_val = 0; +bool moving = false; +#define POT_TOLERANCE 50 +#define POT_PIN F0 +#include "print.h" + + +void matrix_init_user(void) { + analogReference(ADC_REF_POWER); +} + +void matrix_scan_user(void){ + pot_val = (analogReadPin(POT_PIN)); + + // If there is a big enough change, then we need to do something + if (abs(pot_val - pot_oldVal) > POT_TOLERANCE) { + moving = true; + pot_oldVal = pot_val; + } + else{ + if (moving){ + // Do some fancy conversion to get 'absolute' position to num tap_codes to send + // Reset moving to 0 so that we don't get multiple attempts to do this + int num_ticks = ((float)pot_val/max_pot_val)*max_ticks; + for (int i = 0; i