parent
1267504957
commit
57bfdd8b50
@ -1,45 +0,0 @@
|
||||
#ifndef LIGHT_CONFIG_H
|
||||
#define LIGHT_CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#undef PRODUCT
|
||||
#define PRODUCT Planck Light
|
||||
#undef PRODUCT_ID
|
||||
#define PRODUCT_ID 0x6065
|
||||
#define DEVICE_VER 0x0001
|
||||
|
||||
#undef MATRIX_ROW_PINS
|
||||
#undef MATRIX_COL_PINS
|
||||
|
||||
#define MATRIX_ROW_PINS { B0, E7, F0, F1 }
|
||||
#define MATRIX_COL_PINS { E6, E3, E4, D3, D4, D5, C0, A7, A6, E1, E0, D7 }
|
||||
|
||||
#define C6_AUDIO
|
||||
#define B5_AUDIO
|
||||
|
||||
#undef BACKLIGHT_PIN
|
||||
|
||||
#define BACKLIGHT_PIN A5
|
||||
|
||||
#define NO_USB_STARTUP_CHECK
|
||||
|
||||
#define PLANCK_MIT_LAYOUT
|
||||
|
||||
// This is a 7-bit address, that gets left-shifted and bit 0
|
||||
// set to 0 for write, 1 for read (as per I2C protocol)
|
||||
// The address will vary depending on your wiring:
|
||||
// 0b1110100 AD <-> GND
|
||||
// 0b1110111 AD <-> VCC
|
||||
// 0b1110101 AD <-> SCL
|
||||
// 0b1110110 AD <-> SDA
|
||||
#define DRIVER_ADDR_1 0b1110100
|
||||
#define DRIVER_ADDR_2 0b1110110
|
||||
|
||||
#define DRIVER_COUNT 2
|
||||
#define DRIVER_1_LED_TOTAL 25
|
||||
#define DRIVER_2_LED_TOTAL 24
|
||||
#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL
|
||||
|
||||
|
||||
#endif
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"keyboard_name": "Planck Light",
|
||||
"keyboard_folder": "planck/light"
|
||||
}
|
@ -1,170 +0,0 @@
|
||||
/* Copyright 2017 Jack Humbert
|
||||
*
|
||||
* 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 "light.h"
|
||||
|
||||
const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
||||
/* Refer to IS31 manual for these locations
|
||||
* driver
|
||||
* | R location
|
||||
* | | G location
|
||||
* | | | B location
|
||||
* | | | | */
|
||||
{0, C1_3, C2_3, C3_3},
|
||||
{0, C1_4, C2_4, C3_4},
|
||||
{0, C1_5, C2_5, C3_5},
|
||||
{0, C1_11, C2_11, C3_11},
|
||||
{0, C1_12, C2_12, C3_12},
|
||||
{0, C1_13, C2_13, C3_13},
|
||||
{1, C1_3, C2_3, C3_3},
|
||||
{1, C1_4, C2_4, C3_4},
|
||||
{1, C1_5, C2_5, C3_5},
|
||||
{1, C1_11, C2_11, C3_11},
|
||||
{1, C1_12, C2_12, C3_12},
|
||||
{1, C1_13, C2_13, C3_13},
|
||||
|
||||
{0, C1_6, C2_6, C3_6},
|
||||
{0, C1_7, C2_7, C3_7},
|
||||
{0, C1_8, C2_8, C3_8},
|
||||
{0, C1_14, C2_14, C3_14},
|
||||
{0, C1_15, C2_15, C3_15},
|
||||
{0, C1_16, C2_16, C3_16},
|
||||
{1, C1_6, C2_6, C3_6},
|
||||
{1, C1_7, C2_7, C3_7},
|
||||
{1, C1_8, C2_8, C3_8},
|
||||
{1, C1_14, C2_14, C3_14},
|
||||
{1, C1_15, C2_15, C3_15},
|
||||
{1, C1_16, C2_16, C3_16},
|
||||
|
||||
{0, C9_1, C8_1, C7_1},
|
||||
{0, C9_2, C8_2, C7_2},
|
||||
{0, C9_3, C8_3, C7_3},
|
||||
{0, C9_9, C8_9, C7_9},
|
||||
{0, C9_10, C8_10, C7_10},
|
||||
{0, C9_11, C8_11, C7_11},
|
||||
{1, C9_1, C8_1, C7_1},
|
||||
{1, C9_2, C8_2, C7_2},
|
||||
{1, C9_3, C8_3, C7_3},
|
||||
{1, C9_9, C8_9, C7_9},
|
||||
{1, C9_10, C8_10, C7_10},
|
||||
{1, C9_11, C8_11, C7_11},
|
||||
|
||||
{0, C9_4, C8_4, C7_4},
|
||||
{0, C9_5, C8_5, C7_5},
|
||||
{0, C9_6, C8_6, C7_6},
|
||||
{0, C9_12, C8_12, C7_12},
|
||||
{0, C9_13, C8_13, C7_13},
|
||||
{0, C9_14, C8_14, C7_14},
|
||||
{0, C9_15, C8_15, C6_14}, // middle 2u switch
|
||||
{1, C9_4, C8_4, C7_4},
|
||||
{1, C9_5, C8_5, C7_5},
|
||||
{1, C9_6, C8_6, C7_6},
|
||||
{1, C9_12, C8_12, C7_12},
|
||||
{1, C9_13, C8_13, C7_13},
|
||||
{1, C9_14, C8_14, C7_14}
|
||||
};
|
||||
|
||||
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
|
||||
|
||||
/*{row | col << 4}
|
||||
| {x=0..224, y=0..64}
|
||||
| | modifier
|
||||
| | | */
|
||||
{{0|(0<<4)}, {20.36*0, 21.33*0}, 1},
|
||||
{{0|(1<<4)}, {20.36*1, 21.33*0}, 0},
|
||||
{{0|(2<<4)}, {20.36*2, 21.33*0}, 0},
|
||||
{{0|(3<<4)}, {20.36*3, 21.33*0}, 0},
|
||||
{{0|(4<<4)}, {20.36*4, 21.33*0}, 0},
|
||||
{{0|(5<<4)}, {20.36*5, 21.33*0}, 0},
|
||||
{{0|(6<<4)}, {20.36*6, 21.33*0}, 0},
|
||||
{{0|(7<<4)}, {20.36*7, 21.33*0}, 0},
|
||||
{{0|(8<<4)}, {20.36*8, 21.33*0}, 0},
|
||||
{{0|(9<<4)}, {20.36*9, 21.33*0}, 0},
|
||||
{{0|(10<<4)}, {20.36*10,21.33*0}, 0},
|
||||
{{0|(11<<4)}, {20.36*11,21.33*0}, 1},
|
||||
|
||||
{{1|(0<<4)}, {20.36*0, 21.33*1}, 1},
|
||||
{{1|(1<<4)}, {20.36*1, 21.33*1}, 0},
|
||||
{{1|(2<<4)}, {20.36*2, 21.33*1}, 0},
|
||||
{{1|(3<<4)}, {20.36*3, 21.33*1}, 0},
|
||||
{{1|(4<<4)}, {20.36*4, 21.33*1}, 0},
|
||||
{{1|(5<<4)}, {20.36*5, 21.33*1}, 0},
|
||||
{{1|(6<<4)}, {20.36*6, 21.33*1}, 0},
|
||||
{{1|(7<<4)}, {20.36*7, 21.33*1}, 0},
|
||||
{{1|(8<<4)}, {20.36*8, 21.33*1}, 0},
|
||||
{{1|(9<<4)}, {20.36*9, 21.33*1}, 0},
|
||||
{{1|(10<<4)}, {20.36*10,21.33*1}, 0},
|
||||
{{1|(11<<4)}, {20.36*11,21.33*1}, 1},
|
||||
|
||||
{{2|(0<<4)}, {20.36*0, 21.33*2}, 1},
|
||||
{{2|(1<<4)}, {20.36*1, 21.33*2}, 0},
|
||||
{{2|(2<<4)}, {20.36*2, 21.33*2}, 0},
|
||||
{{2|(3<<4)}, {20.36*3, 21.33*2}, 0},
|
||||
{{2|(4<<4)}, {20.36*4, 21.33*2}, 0},
|
||||
{{2|(5<<4)}, {20.36*5, 21.33*2}, 0},
|
||||
{{2|(6<<4)}, {20.36*6, 21.33*2}, 0},
|
||||
{{2|(7<<4)}, {20.36*7, 21.33*2}, 0},
|
||||
{{2|(8<<4)}, {20.36*8, 21.33*2}, 0},
|
||||
{{2|(9<<4)}, {20.36*9, 21.33*2}, 0},
|
||||
{{2|(10<<4)}, {20.36*10,21.33*2}, 0},
|
||||
{{2|(11<<4)}, {20.36*11,21.33*2}, 1},
|
||||
|
||||
{{3|(0<<4)}, {20.36*0, 21.33*3}, 1},
|
||||
{{3|(1<<4)}, {20.36*1, 21.33*3}, 1},
|
||||
{{3|(2<<4)}, {20.36*2, 21.33*3}, 1},
|
||||
{{3|(3<<4)}, {20.36*3, 21.33*3}, 1},
|
||||
{{3|(4<<4)}, {20.36*4, 21.33*3}, 1},
|
||||
{{3|(5<<4)}, {20.36*5, 21.33*3}, 0},
|
||||
{{3|(5<<4)}, {20.36*5.5,21.33*3}, 0},
|
||||
{{3|(6<<4)}, {20.36*6, 21.33*3}, 0},
|
||||
{{3|(7<<4)}, {20.36*7, 21.33*3}, 1},
|
||||
{{3|(8<<4)}, {20.36*8, 21.33*3}, 1},
|
||||
{{3|(9<<4)}, {20.36*9, 21.33*3}, 1},
|
||||
{{3|(10<<4)}, {20.36*10,21.33*3}, 1},
|
||||
{{3|(11<<4)}, {20.36*11,21.33*3}, 1}
|
||||
};
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
|
||||
// Turn status LED on
|
||||
DDRD |= (1<<6);
|
||||
PORTD |= (1<<6);
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record)
|
||||
{
|
||||
return process_record_user(keycode, record);
|
||||
}
|
||||
|
||||
void matrix_scan_kb(void)
|
||||
{
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
||||
void suspend_power_down_kb(void)
|
||||
{
|
||||
rgb_matrix_set_suspend_state(true);
|
||||
suspend_power_down_user();
|
||||
}
|
||||
|
||||
void suspend_wakeup_init_kb(void)
|
||||
{
|
||||
rgb_matrix_set_suspend_state(false);
|
||||
suspend_wakeup_init_user();
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
/* Copyright 2017 Jack Humbert
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef LIGHT_H
|
||||
#define LIGHT_H
|
||||
|
||||
#include "planck.h"
|
||||
#include "rgb_matrix.h"
|
||||
|
||||
#endif
|
@ -1,5 +0,0 @@
|
||||
MIDI_ENABLE = yes
|
||||
AUDIO_ENABLE = yes # Audio output on port C6
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
|
||||
MCU = at90usb1286
|
@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define DEVICE_VER 0x0001
|
@ -1 +0,0 @@
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define DEVICE_VER 0x0002
|
@ -1 +0,0 @@
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define DEVICE_VER 0x0003
|
@ -1 +0,0 @@
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define DEVICE_VER 0x0004
|
@ -1 +0,0 @@
|
||||
AUDIO_ENABLE = yes # Audio output on port C6
|
@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define DEVICE_VER 0x0005
|
@ -1 +0,0 @@
|
||||
AUDIO_ENABLE = yes # Audio output on port C6
|
@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef REV6_CONFIG_H
|
||||
#define REV6_CONFIG_H
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define DEVICE_VER 0x0006
|
||||
|
||||
#undef MATRIX_ROWS
|
||||
#undef MATRIX_COLS
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 8
|
||||
#define MATRIX_COLS 6
|
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments
|
||||
*
|
||||
* Change this to how you wired your keyboard
|
||||
* COLS: AVR pins used for columns, left to right
|
||||
* ROWS: AVR pins used for rows, top to bottom
|
||||
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
|
||||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
|
||||
*
|
||||
*/
|
||||
/* Note: These are not used for arm boards. They're here purely as documentation.
|
||||
* #define MATRIX_ROW_PINS { PB0, PB1, PB2, PA15, PA10 }
|
||||
* #define MATRIX_COL_PINS { PA2, PA3, PA6, PB14, PB15, PA8, PA9, PA7, PB3, PB4, PC14, PC15, PC13, PB5, PB6 }
|
||||
* #define UNUSED_PINS
|
||||
*/
|
||||
|
||||
#define NUMBER_OF_ENCODERS 1
|
||||
#define ENCODERS_PAD_A { B12 }
|
||||
#define ENCODERS_PAD_B { B13 }
|
||||
|
||||
#define MUSIC_MAP
|
||||
#undef AUDIO_VOICES
|
||||
#undef C6_AUDIO
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 6
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
//#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
//#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
/*
|
||||
* Force NKRO
|
||||
*
|
||||
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
|
||||
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
|
||||
* makefile for this to work.)
|
||||
*
|
||||
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
|
||||
* until the next keyboard reset.
|
||||
*
|
||||
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
|
||||
* fully operational during normal computer usage.
|
||||
*
|
||||
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
|
||||
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
|
||||
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
|
||||
* power-up.
|
||||
*
|
||||
*/
|
||||
//#define FORCE_NKRO
|
||||
|
||||
/*
|
||||
* Feature disable options
|
||||
* These options are also useful to firmware size reduction.
|
||||
*/
|
||||
|
||||
/* disable debug print */
|
||||
//#define NO_DEBUG
|
||||
|
||||
/* disable print */
|
||||
//#define NO_PRINT
|
||||
|
||||
/* disable action features */
|
||||
//#define NO_ACTION_LAYER
|
||||
//#define NO_ACTION_TAPPING
|
||||
//#define NO_ACTION_ONESHOT
|
||||
//#define NO_ACTION_MACRO
|
||||
//#define NO_ACTION_FUNCTION
|
||||
|
||||
/*
|
||||
* MIDI options
|
||||
*/
|
||||
|
||||
/* Prevent use of disabled MIDI features in the keymap */
|
||||
//#define MIDI_ENABLE_STRICT 1
|
||||
|
||||
/* enable basic MIDI features:
|
||||
- MIDI notes can be sent when in Music mode is on
|
||||
*/
|
||||
//#define MIDI_BASIC
|
||||
|
||||
/* enable advanced MIDI features:
|
||||
- MIDI notes can be added to the keymap
|
||||
- Octave shift and transpose
|
||||
- Virtual sustain, portamento, and modulation wheel
|
||||
- etc.
|
||||
*/
|
||||
//#define MIDI_ADVANCED
|
||||
|
||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
||||
//#define MIDI_TONE_KEYCODE_OCTAVES 1
|
||||
|
||||
#define WS2812_LED_N 2
|
||||
#define RGBLED_NUM WS2812_LED_N
|
||||
#define WS2812_TIM_N 2
|
||||
#define WS2812_TIM_CH 2
|
||||
#define PORT_WS2812 GPIOA
|
||||
#define PIN_WS2812 1
|
||||
#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection)
|
||||
//#define WS2812_DMA_CHANNEL 7 // DMA channel for TIMx_UP
|
||||
//#define WS2812_EXTERNAL_PULLUP
|
||||
|
||||
#endif
|
@ -1,176 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "hal.h"
|
||||
#include "timer.h"
|
||||
#include "wait.h"
|
||||
#include "printf.h"
|
||||
#include "backlight.h"
|
||||
#include "matrix.h"
|
||||
#include "action.h"
|
||||
#include "keycode.h"
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
* col: { B11, B10, B2, B1, A7, B0 }
|
||||
* row: { A10, A9, A8, B15, C13, C14, C15, A2 }
|
||||
*/
|
||||
/* matrix state(1:on, 0:off) */
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_COLS];
|
||||
static bool debouncing = false;
|
||||
static uint16_t debouncing_time = 0;
|
||||
|
||||
static bool dip_switch[4] = {0, 0, 0, 0};
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_user(void) {}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_user(void) {}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_kb(void) {
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_kb(void) {
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
||||
void matrix_init(void) {
|
||||
printf("matrix init\n");
|
||||
//debug_matrix = true;
|
||||
|
||||
// dip switch setup
|
||||
palSetPadMode(GPIOB, 14, PAL_MODE_INPUT_PULLUP);
|
||||
palSetPadMode(GPIOA, 15, PAL_MODE_INPUT_PULLUP);
|
||||
palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLUP);
|
||||
palSetPadMode(GPIOB, 9, PAL_MODE_INPUT_PULLUP);
|
||||
|
||||
// actual matrix setup
|
||||
palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
||||
palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOA, 9, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOA, 8, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOB, 15, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOC, 13, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLDOWN);
|
||||
palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLDOWN);
|
||||
|
||||
|
||||
memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
|
||||
memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t));
|
||||
|
||||
|
||||
matrix_init_quantum();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void dip_update(uint8_t index, bool active) { }
|
||||
|
||||
bool last_dip_switch[4] = {0};
|
||||
|
||||
uint8_t matrix_scan(void) {
|
||||
// dip switch
|
||||
dip_switch[0] = !palReadPad(GPIOB, 14);
|
||||
dip_switch[1] = !palReadPad(GPIOA, 15);
|
||||
dip_switch[2] = !palReadPad(GPIOA, 10);
|
||||
dip_switch[3] = !palReadPad(GPIOB, 9);
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
if (last_dip_switch[i] ^ dip_switch[i])
|
||||
dip_update(i, dip_switch[i]);
|
||||
}
|
||||
memcpy(last_dip_switch, dip_switch, sizeof(&dip_switch));
|
||||
|
||||
// actual matrix
|
||||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
matrix_row_t data = 0;
|
||||
|
||||
// strobe col { B11, B10, B2, B1, A7, B0 }
|
||||
switch (col) {
|
||||
case 0: palSetPad(GPIOB, 11); break;
|
||||
case 1: palSetPad(GPIOB, 10); break;
|
||||
case 2: palSetPad(GPIOB, 2); break;
|
||||
case 3: palSetPad(GPIOB, 1); break;
|
||||
case 4: palSetPad(GPIOA, 7); break;
|
||||
case 5: palSetPad(GPIOB, 0); break;
|
||||
}
|
||||
|
||||
// need wait to settle pin state
|
||||
wait_us(20);
|
||||
|
||||
// read row data { A10, A9, A8, B15, C13, C14, C15, A2 }
|
||||
data = (
|
||||
(palReadPad(GPIOA, 10) << 0 ) |
|
||||
(palReadPad(GPIOA, 9) << 1 ) |
|
||||
(palReadPad(GPIOA, 8) << 2 ) |
|
||||
(palReadPad(GPIOB, 15) << 3 ) |
|
||||
(palReadPad(GPIOC, 13) << 4 ) |
|
||||
(palReadPad(GPIOC, 14) << 5 ) |
|
||||
(palReadPad(GPIOC, 15) << 6 ) |
|
||||
(palReadPad(GPIOA, 2) << 7 )
|
||||
);
|
||||
|
||||
// unstrobe col { B11, B10, B2, B1, A7, B0 }
|
||||
switch (col) {
|
||||
case 0: palClearPad(GPIOB, 11); break;
|
||||
case 1: palClearPad(GPIOB, 10); break;
|
||||
case 2: palClearPad(GPIOB, 2); break;
|
||||
case 3: palClearPad(GPIOB, 1); break;
|
||||
case 4: palClearPad(GPIOA, 7); break;
|
||||
case 5: palClearPad(GPIOB, 0); break;
|
||||
}
|
||||
|
||||
if (matrix_debouncing[col] != data) {
|
||||
matrix_debouncing[col] = data;
|
||||
debouncing = true;
|
||||
debouncing_time = timer_read();
|
||||
}
|
||||
}
|
||||
|
||||
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
|
||||
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix[row] = 0;
|
||||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col);
|
||||
}
|
||||
}
|
||||
debouncing = false;
|
||||
}
|
||||
|
||||
matrix_scan_quantum();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool matrix_is_on(uint8_t row, uint8_t col) {
|
||||
return (matrix[row] & (1<<col));
|
||||
}
|
||||
|
||||
matrix_row_t matrix_get_row(uint8_t row) {
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void) {
|
||||
printf("\nr/c 01234567\n");
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
printf("%X0: ", row);
|
||||
matrix_row_t data = matrix_get_row(row);
|
||||
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||
if (data & (1<<col))
|
||||
printf("1");
|
||||
else
|
||||
printf("0");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
|
||||
*
|
||||
* 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 "rev6.h"
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
void matrix_scan_kb(void) {
|
||||
matrix_scan_user();
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
/* Copyright 2018 Jack Humbert <jack.humb@gmail.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
#ifndef REV6_H
|
||||
#define REV6_H
|
||||
|
||||
#include "planck.h"
|
||||
|
||||
#endif
|
@ -1,24 +0,0 @@
|
||||
# project specific files
|
||||
SRC = matrix.c
|
||||
LAYOUTS += ortho_4x12
|
||||
|
||||
# Cortex version
|
||||
MCU = STM32F303
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
BACKLIGHT_ENABLE = no
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
|
||||
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
CUSTOM_MATRIX = yes # Custom matrix file
|
||||
AUDIO_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = no
|
||||
# SERIAL_LINK_ENABLE = yes
|
||||
ENCODER_ENABLE = yes
|
Loading…
Reference in new issue