aboutsummaryrefslogtreecommitdiff
path: root/keyboards/hadron
diff options
context:
space:
mode:
authorishtob <ishtob@gmail.com>2019-04-16 17:49:24 -0400
committerDrashna Jaelre <drashna@live.com>2019-04-16 14:49:24 -0700
commit0a6beab2243cd9183127041917bb4c3ce6a22bd9 (patch)
tree401db7e3c05d2929fa4a73cdd5d14e50ae32fd5c /keyboards/hadron
parent93b7fccad65aa4c12b37bc3d1a507ae909511587 (diff)
downloadqmk_firmware-0a6beab2243cd9183127041917bb4c3ce6a22bd9.tar.gz
qmk_firmware-0a6beab2243cd9183127041917bb4c3ce6a22bd9.zip
[Keyboard] Hadron keymap and config updates (#5632)
* update hadron keymaps, code cleanup * keymap update * refactor custom matrix to use quantum matrix defines * fix wrong pin for matrix
Diffstat (limited to 'keyboards/hadron')
-rw-r--r--keyboards/hadron/ver3/chconf.h4
-rw-r--r--keyboards/hadron/ver3/config.h42
-rw-r--r--keyboards/hadron/ver3/halconf.h2
-rw-r--r--keyboards/hadron/ver3/keymaps/default/keymap.c10
-rw-r--r--keyboards/hadron/ver3/keymaps/ishtob/keymap.c10
-rw-r--r--keyboards/hadron/ver3/keymaps/readme.md7
-rw-r--r--keyboards/hadron/ver3/matrix.c195
-rw-r--r--keyboards/hadron/ver3/mcuconf.h2
-rw-r--r--keyboards/hadron/ver3/rules.mk46
-rw-r--r--keyboards/hadron/ver3/ver3.c38
-rw-r--r--keyboards/hadron/ver3/ver3.h9
11 files changed, 90 insertions, 275 deletions
diff --git a/keyboards/hadron/ver3/chconf.h b/keyboards/hadron/ver3/chconf.h
index 1d9f12ff1..ce44925f3 100644
--- a/keyboards/hadron/ver3/chconf.h
+++ b/keyboards/hadron/ver3/chconf.h
@@ -48,7 +48,7 @@
48 * @details Frequency of the system timer that drives the system ticks. This 48 * @details Frequency of the system timer that drives the system ticks. This
49 * setting also defines the system tick time unit. 49 * setting also defines the system tick time unit.
50 */ 50 */
51#define CH_CFG_ST_FREQUENCY 100000 51#define CH_CFG_ST_FREQUENCY 1000
52 52
53/** 53/**
54 * @brief Time delta constant for the tick-less mode. 54 * @brief Time delta constant for the tick-less mode.
@@ -58,7 +58,7 @@
58 * The value one is not valid, timeouts are rounded up to 58 * The value one is not valid, timeouts are rounded up to
59 * this value. 59 * this value.
60 */ 60 */
61#define CH_CFG_ST_TIMEDELTA 2 61#define CH_CFG_ST_TIMEDELTA 0
62 62
63/** @} */ 63/** @} */
64 64
diff --git a/keyboards/hadron/ver3/config.h b/keyboards/hadron/ver3/config.h
index 180492182..82081ba43 100644
--- a/keyboards/hadron/ver3/config.h
+++ b/keyboards/hadron/ver3/config.h
@@ -27,6 +27,28 @@
27#define MATRIX_ROWS 5 27#define MATRIX_ROWS 5
28#define MATRIX_COLS 15 28#define MATRIX_COLS 15
29 29
30/*
31 * Keyboard Matrix Assignments
32 *
33 * Change this to how you wired your keyboard
34 * COLS: AVR pins used for columns, left to right
35 * ROWS: AVR pins used for rows, top to bottom
36 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
37 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
38 *
39*/
40#undef MATRIX_ROW_PINS
41#undef MATRIX_COL_PINS
42
43#define MATRIX_ROW_PINS { C15, C14, A10, A9, A8 }
44#define MATRIX_COL_PINS { B8, B2, B10, A0, A1, A2, B0, A3, B1, A6, A7, B12, C13, B11, B9 }
45#define UNUSED_PINS
46
47#define NUMBER_OF_ENCODERS 1
48#define ENCODERS_PAD_A { B13 }
49#define ENCODERS_PAD_B { B14 }
50
51
30//Audio 52//Audio
31#undef AUDIO_VOICES 53#undef AUDIO_VOICES
32#undef C6_AUDIO 54#undef C6_AUDIO
@@ -55,16 +77,6 @@
55#define micro_oled_rotate_180 77#define micro_oled_rotate_180
56 78
57#endif 79#endif
58/*
59 * Keyboard Matrix Assignments
60 *
61 * Change this to how you wired your keyboard
62 * COLS: AVR pins used for columns, left to right
63 * ROWS: AVR pins used for rows, top to bottom
64 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
65 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
66 *
67*/
68 80
69/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 81/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
70#define DEBOUNCE 6 82#define DEBOUNCE 6
@@ -185,13 +197,13 @@
185#define ZC_DET_TIME 0 197#define ZC_DET_TIME 0
186#define AUTO_CAL_TIME 3 198#define AUTO_CAL_TIME 3
187 199
188//#define RGBLIGHT_ANIMATIONS 200#define RGBLIGHT_ANIMATIONS
189 201
190//#define RGBLED_NUM 10 202#define RGBLED_NUM 10
191//#define RGB_DI_PIN B5 203#define RGB_DI_PIN B5
192//#define DRIVER_LED_TOTAL RGBLED_NUM 204#define DRIVER_LED_TOTAL RGBLED_NUM
193 205
194//#define RGB_MATRIX_KEYPRESSES 206// #define RGB_MATRIX_KEYPRESSES
195 207
196#define SOLENOID_PIN A14 208#define SOLENOID_PIN A14
197 209
diff --git a/keyboards/hadron/ver3/halconf.h b/keyboards/hadron/ver3/halconf.h
index c3e0cbb72..a14ace02b 100644
--- a/keyboards/hadron/ver3/halconf.h
+++ b/keyboards/hadron/ver3/halconf.h
@@ -111,7 +111,7 @@
111 * @brief Enables the PWM subsystem. 111 * @brief Enables the PWM subsystem.
112 */ 112 */
113#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) 113#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
114#define HAL_USE_PWM FALSE 114#define HAL_USE_PWM TRUE
115#endif 115#endif
116 116
117/** 117/**
diff --git a/keyboards/hadron/ver3/keymaps/default/keymap.c b/keyboards/hadron/ver3/keymaps/default/keymap.c
index ac1db2c2a..9afddba26 100644
--- a/keyboards/hadron/ver3/keymaps/default/keymap.c
+++ b/keyboards/hadron/ver3/keymaps/default/keymap.c
@@ -175,19 +175,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
175 175
176/* Adjust (Lower + Raise) 176/* Adjust (Lower + Raise)
177 * ,------+------+------+------+------+------------------------------------------------. 177 * ,------+------+------+------+------+------------------------------------------------.
178 * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | 178 * | Reset|HPT TG|HPT FB|HPT M+|HPT M-|HPT RS| | | | | |EEP RS|
179 * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. 179 * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
180 * | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del | 180 * | |RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del |
181 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| 181 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
182 * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | | 182 * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | |
183 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| 183 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
184 * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG | 184 * | |Voice-|Voice+|Mus on|Musoff| | | | | | |BL - | BL + |BL ST |BL TG |
185 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| 185 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
186 * | | | | | | | | | | | | | | | | 186 * | | | | | | | | | | | |CK RS |CK - |CK + |CK TG |
187 * `--------------------------------------------------------------------------------------------------------' 187 * `--------------------------------------------------------------------------------------------------------'
188 */ 188 */
189[_ADJUST] = LAYOUT( 189[_ADJUST] = LAYOUT(
190 RESET, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST , _______, _______, _______, _______, _______, _______, \ 190 RESET, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST , _______, _______, _______, _______, _______, EEP_RST, \
191 _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \ 191 _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
192 _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \ 192 _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
193 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \ 193 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \
diff --git a/keyboards/hadron/ver3/keymaps/ishtob/keymap.c b/keyboards/hadron/ver3/keymaps/ishtob/keymap.c
index 140d148b7..51062acc2 100644
--- a/keyboards/hadron/ver3/keymaps/ishtob/keymap.c
+++ b/keyboards/hadron/ver3/keymaps/ishtob/keymap.c
@@ -153,19 +153,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
153 153
154/* Adjust (Lower + Raise) 154/* Adjust (Lower + Raise)
155 * ,------+------+------+------+------+------------------------------------------------. 155 * ,------+------+------+------+------+------------------------------------------------.
156 * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | 156 * | Reset|HPT TG|HPT FB|HPT M+|HPT M-|HPT RS| | | | | |EEP RS|
157 * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. 157 * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
158 * | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del | 158 * | |RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del |
159 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| 159 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
160 * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | | 160 * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | |
161 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| 161 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
162 * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG | 162 * | |Voice-|Voice+|Mus on|Musoff| | | | | | |BL - | BL + |BL ST |BL TG |
163 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| 163 * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
164 * | | | | | | | | | | | | | | | | 164 * | | | | | | | | | | | |CK RS |CK - |CK + |CK TG |
165 * `--------------------------------------------------------------------------------------------------------' 165 * `--------------------------------------------------------------------------------------------------------'
166 */ 166 */
167[_ADJUST] = LAYOUT_wrapper( 167[_ADJUST] = LAYOUT_wrapper(
168 _______, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST, _______, _______, _______, _______, _______, _______, \ 168 _______, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST, _______, _______, _______, _______, _______, EEP_RST, \
169 RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \ 169 RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
170 _______, MAGIC_TOGGLE_NKRO, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \ 170 _______, MAGIC_TOGGLE_NKRO, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
171 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \ 171 _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \
diff --git a/keyboards/hadron/ver3/keymaps/readme.md b/keyboards/hadron/ver3/keymaps/readme.md
index 54fb5f6d9..66bf06b71 100644
--- a/keyboards/hadron/ver3/keymaps/readme.md
+++ b/keyboards/hadron/ver3/keymaps/readme.md
@@ -17,7 +17,8 @@ When adding your keymap to this list, keep it organised alphabetically (select l
17 17
18 * **folder_name** description 18 * **folder_name** description
19 19
20# List of Planck keymaps 20# List of Hadron keymaps
21 21
22* **default** default Planck layout 22* **default** default Hadron layout
23* **cbbrowne** cbbrowne's Planck layout \ No newline at end of file 23* **ishtob** ishtob's Hadron layout
24* **sebaslayout** sebaslayout's Hadron layout \ No newline at end of file
diff --git a/keyboards/hadron/ver3/matrix.c b/keyboards/hadron/ver3/matrix.c
deleted file mode 100644
index 329d1328a..000000000
--- a/keyboards/hadron/ver3/matrix.c
+++ /dev/null
@@ -1,195 +0,0 @@
1#include <string.h>
2#include "hal.h"
3#include "timer.h"
4#include "wait.h"
5#include "printf.h"
6#include "backlight.h"
7#include "matrix.h"
8#include "action.h"
9#include "keycode.h"
10
11/* matrix state(1:on, 0:off) */
12static matrix_row_t matrix[MATRIX_ROWS];
13static matrix_row_t matrix_debouncing[MATRIX_COLS];
14static bool debouncing = false;
15static uint16_t debouncing_time = 0;
16
17static uint8_t encoder_state = 0;
18static int8_t encoder_value = 0;
19static int8_t encoder_LUT[] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 };
20
21__attribute__ ((weak))
22void matrix_init_user(void) {}
23
24__attribute__ ((weak))
25void matrix_scan_user(void) {}
26
27__attribute__ ((weak))
28void matrix_init_kb(void) {
29 matrix_init_user();
30}
31
32__attribute__ ((weak))
33void matrix_scan_kb(void) {
34 matrix_scan_user();
35}
36
37void matrix_init(void) {
38 printf("matrix init\n");
39 //debug_matrix = true;
40
41 // encoder setup
42 palSetPadMode(GPIOB, 13, PAL_MODE_INPUT_PULLUP);
43 palSetPadMode(GPIOB, 14, PAL_MODE_INPUT_PULLUP);
44
45 encoder_state = (palReadPad(GPIOB, 13) << 0) | (palReadPad(GPIOB, 14) << 1);
46
47 // actual matrix setup
48 palSetPadMode(GPIOB, 8, PAL_MODE_OUTPUT_PUSHPULL);
49 palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL);
50 palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL);
51 palSetPadMode(GPIOA, 0, PAL_MODE_OUTPUT_PUSHPULL);
52 palSetPadMode(GPIOA, 1, PAL_MODE_OUTPUT_PUSHPULL);
53 palSetPadMode(GPIOA, 2, PAL_MODE_OUTPUT_PUSHPULL);
54 palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL);
55 palSetPadMode(GPIOA, 3, PAL_MODE_OUTPUT_PUSHPULL);
56 palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL);
57 palSetPadMode(GPIOA, 6, PAL_MODE_OUTPUT_PUSHPULL);
58 palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL);
59 palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL);
60 palSetPadMode(GPIOC, 13, PAL_MODE_OUTPUT_PUSHPULL);
61 palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL);
62 palSetPadMode(GPIOB, 9, PAL_MODE_OUTPUT_PUSHPULL);
63
64 palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLDOWN);
65 palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLDOWN);
66 palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN);
67 palSetPadMode(GPIOA, 9, PAL_MODE_INPUT_PULLDOWN);
68 palSetPadMode(GPIOA, 8, PAL_MODE_INPUT_PULLDOWN);
69
70
71 memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
72 memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t));
73
74
75 matrix_init_quantum();
76}
77
78__attribute__ ((weak))
79void encoder_update(bool clockwise) { }
80
81#ifndef ENCODER_RESOLUTION
82 #define ENCODER_RESOLUTION 4
83#endif
84
85uint8_t matrix_scan(void) {
86 // encoder on B13 and B14
87 encoder_state <<= 2;
88 encoder_state |= (palReadPad(GPIOB, 13) << 0) | (palReadPad(GPIOB, 14) << 1);
89 encoder_value += encoder_LUT[encoder_state & 0xF];
90 if (encoder_value >= ENCODER_RESOLUTION) {
91 encoder_update(0);
92 }
93 if (encoder_value <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
94 encoder_update(1);
95 }
96 encoder_value %= ENCODER_RESOLUTION;
97
98 // actual matrix
99 for (int col = 0; col < MATRIX_COLS; col++) {
100 matrix_row_t data = 0;
101
102 // strobe col { PB8, PB2, PB10, PA0, PA1, PA2, PB0, PA3, PB1, PA6, PA7, PB1, PA6, PA7, PB12, PC3, PB11, }
103 switch (col) {
104 case 0: palSetPad(GPIOB, 8); break;
105 case 1: palSetPad(GPIOB, 2); break;
106 case 2: palSetPad(GPIOB, 10); break;
107 case 3: palSetPad(GPIOA, 0); break;
108 case 4: palSetPad(GPIOA, 1); break;
109 case 5: palSetPad(GPIOA, 2); break;
110 case 6: palSetPad(GPIOB, 0); break;
111 case 7: palSetPad(GPIOA, 3); break;
112 case 8: palSetPad(GPIOB, 1); break;
113 case 9: palSetPad(GPIOA, 6); break;
114 case 10: palSetPad(GPIOA, 7); break;
115 case 11: palSetPad(GPIOB, 12); break;
116 case 12: palSetPad(GPIOC, 13); break;
117 case 13: palSetPad(GPIOB, 11); break;
118 case 14: palSetPad(GPIOB, 9); break;
119 }
120
121 // need wait to settle pin state
122 wait_us(20);
123
124 // read row data { PC15, PC14, PA10, PA9, PA8 }
125 data = (
126 (palReadPad(GPIOC, 15) << 0 ) |
127 (palReadPad(GPIOC, 14) << 1 ) |
128 (palReadPad(GPIOA, 10) << 2 ) |
129 (palReadPad(GPIOA, 9) << 3 ) |
130 (palReadPad(GPIOA, 8) << 4 )
131 );
132
133 // unstrobe col { PB8, PB2, PB10, PA0, PA1, PA2, PB0, PA3, PB1, PA6, PA7, PB1, PA6, PA7, PB12, PC3, PB11, }
134 switch (col) {
135 case 0: palClearPad(GPIOB, 8); break;
136 case 1: palClearPad(GPIOB, 2); break;
137 case 2: palClearPad(GPIOB, 10); break;
138 case 3: palClearPad(GPIOA, 0); break;
139 case 4: palClearPad(GPIOA, 1); break;
140 case 5: palClearPad(GPIOA, 2); break;
141 case 6: palClearPad(GPIOB, 0); break;
142 case 7: palClearPad(GPIOA, 3); break;
143 case 8: palClearPad(GPIOB, 1); break;
144 case 9: palClearPad(GPIOA, 6); break;
145 case 10: palClearPad(GPIOA, 7); break;
146 case 11: palClearPad(GPIOB, 12); break;
147 case 12: palClearPad(GPIOC, 13); break;
148 case 13: palClearPad(GPIOB, 11); break;
149 case 14: palClearPad(GPIOB, 9); break;
150 }
151
152 if (matrix_debouncing[col] != data) {
153 matrix_debouncing[col] = data;
154 debouncing = true;
155 debouncing_time = timer_read();
156 }
157 }
158
159 if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
160 for (int row = 0; row < MATRIX_ROWS; row++) {
161 matrix[row] = 0;
162 for (int col = 0; col < MATRIX_COLS; col++) {
163 matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col);
164 }
165 }
166 debouncing = false;
167 }
168
169 matrix_scan_quantum();
170
171 return 1;
172}
173
174bool matrix_is_on(uint8_t row, uint8_t col) {
175 return (matrix[row] & (1<<col));
176}
177
178matrix_row_t matrix_get_row(uint8_t row) {
179 return matrix[row];
180}
181
182void matrix_print(void) {
183 printf("\nr/c 01234567\n");
184 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
185 printf("%X0: ", row);
186 matrix_row_t data = matrix_get_row(row);
187 for (int col = 0; col < MATRIX_COLS; col++) {
188 if (data & (1<<col))
189 printf("1");
190 else
191 printf("0");
192 }
193 printf("\n");
194 }
195}
diff --git a/keyboards/hadron/ver3/mcuconf.h b/keyboards/hadron/ver3/mcuconf.h
index d0776b046..94d761cfb 100644
--- a/keyboards/hadron/ver3/mcuconf.h
+++ b/keyboards/hadron/ver3/mcuconf.h
@@ -225,7 +225,7 @@
225 * ST driver system settings. 225 * ST driver system settings.
226 */ 226 */
227#define STM32_ST_IRQ_PRIORITY 8 227#define STM32_ST_IRQ_PRIORITY 8
228#define STM32_ST_USE_TIMER 2 228#define STM32_ST_USE_TIMER 3
229 229
230/* 230/*
231 * UART driver system settings. 231 * UART driver system settings.
diff --git a/keyboards/hadron/ver3/rules.mk b/keyboards/hadron/ver3/rules.mk
index 2a8662315..599fb53fa 100644
--- a/keyboards/hadron/ver3/rules.mk
+++ b/keyboards/hadron/ver3/rules.mk
@@ -1,57 +1,25 @@
1# project specific files 1# projecct specific files
2SRC = matrix.c
3
4## chip/board settings
5# - the next two should match the directories in
6# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
7MCU_FAMILY = STM32
8MCU_SERIES = STM32F3xx
9
10# Linker script to use
11# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
12# or <this_dir>/ld/
13MCU_LDSCRIPT = STM32F303xC
14
15# Startup code to use
16# - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
17MCU_STARTUP = stm32f3xx
18
19# Board: it should exist either in <chibios>/os/hal/boards/
20# or <this_dir>/boards
21BOARD = GENERIC_STM32_F303XC
22 2
23# Cortex version 3# Cortex version
24MCU = cortex-m4 4MCU = STM32F303
25
26# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
27ARMV = 7
28
29USE_FPU = yes
30
31# Vector table for application
32# 0x00000000-0x00001000 area is occupied by bootlaoder.*/
33# The CORTEX_VTOR... is needed only for MCHCK/Infinity KB
34# OPT_DEFS = -DCORTEX_VTOR_INIT=0x08005000
35OPT_DEFS =
36
37# Options to pass to dfu-util when flashing
38DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave
39 5
40# Build Options 6# Build Options
41# comment out to disable the options. 7# comment out to disable the options.
42# 8#
43BACKLIGHT_ENABLE = no 9BACKLIGHT_ENABLE = no
44BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration 10BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration
45## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) 11## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
46MOUSEKEY_ENABLE = yes # Mouse keys 12MOUSEKEY_ENABLE = yes # Mouse keys
47EXTRAKEY_ENABLE = yes # Audio control and System control 13EXTRAKEY_ENABLE = yes # Audio control and System control
48CONSOLE_ENABLE = no # Console for debug 14CONSOLE_ENABLE = no # Console for debug
49COMMAND_ENABLE = no # Commands for debug and configuration 15COMMAND_ENABLE = yes # Commands for debug and configuration
50#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 16#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
51NKRO_ENABLE = yes # USB Nkey Rollover 17NKRO_ENABLE = yes # USB Nkey Rollover
52CUSTOM_MATRIX = yes # Custom matrix file 18CUSTOM_MATRIX = no # Custom matrix file
53AUDIO_ENABLE = yes 19AUDIO_ENABLE = yes
54RGBLIGHT_ENABLE = no 20RGBLIGHT_ENABLE = no
21RGB_MATRIX_ENABLE = no #WS2812 once arm_rgb is implemented
55HAPTIC_ENABLE += DRV2605L 22HAPTIC_ENABLE += DRV2605L
56QWIIC_ENABLE += MICRO_OLED 23QWIIC_ENABLE += MICRO_OLED
24ENCODER_ENABLER = yes
57# SERIAL_LINK_ENABLE = yes 25# SERIAL_LINK_ENABLE = yes
diff --git a/keyboards/hadron/ver3/ver3.c b/keyboards/hadron/ver3/ver3.c
index 37169fe2f..e99ed11a7 100644
--- a/keyboards/hadron/ver3/ver3.c
+++ b/keyboards/hadron/ver3/ver3.c
@@ -16,9 +16,36 @@
16#include "ver3.h" 16#include "ver3.h"
17#include "qwiic.h" 17#include "qwiic.h"
18#include "action_layer.h" 18#include "action_layer.h"
19#include "matrix.h"
20#include "haptic.h" 19#include "haptic.h"
21 20
21#ifdef RGB_MATRIX_ENABLE
22#include "rgblight.h"
23
24const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
25 /*{row | col << 4}
26 | {x=0..224, y=0..64}
27 | | modifier
28 | | | */
29 {{1|(13<<4)}, {195, 3}, 0},
30 {{4|(13<<4)}, {195, 16}, 0},
31 {{4|(10<<4)}, {150, 16}, 0},
32 {{4|(7<<4)}, {105, 16}, 0},
33 {{4|(4<<4)}, {60, 16}, 0},
34 {{4|(1<<4)}, {15, 16}, 0},
35 {{1|(1<<4)}, {15, 3}, 0},
36 {{1|(4<<4)}, {60, 3}, 0},
37 {{1|(7<<4)}, {105, 3}, 0},
38 {{1|(10<<4)}, {150, 3}, 0}
39};
40
41#endif
42
43uint8_t *o_fb;
44
45uint16_t counterst = 0;
46
47
48
22#ifdef QWIIC_MICRO_OLED_ENABLE 49#ifdef QWIIC_MICRO_OLED_ENABLE
23 50
24/* screen off after this many milliseconds */ 51/* screen off after this many milliseconds */
@@ -41,7 +68,7 @@ void draw_ui(void) {
41 send_command(DISPLAYON); 68 send_command(DISPLAYON);
42 69
43/* Layer indicator is 41 x 10 pixels */ 70/* Layer indicator is 41 x 10 pixels */
44#define LAYER_INDICATOR_X 0 71#define LAYER_INDICATOR_X 5
45#define LAYER_INDICATOR_Y 0 72#define LAYER_INDICATOR_Y 0
46 73
47 draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0); 74 draw_string(LAYER_INDICATOR_X + 1, LAYER_INDICATOR_Y + 2, "LAYER", PIXEL_ON, NORM, 0);
@@ -49,7 +76,7 @@ void draw_ui(void) {
49 draw_char(LAYER_INDICATOR_X + 34, LAYER_INDICATOR_Y + 2, layer + 0x30, PIXEL_ON, XOR, 0); 76 draw_char(LAYER_INDICATOR_X + 34, LAYER_INDICATOR_Y + 2, layer + 0x30, PIXEL_ON, XOR, 0);
50 77
51/* Matrix display is 19 x 9 pixels */ 78/* Matrix display is 19 x 9 pixels */
52#define MATRIX_DISPLAY_X 0 79#define MATRIX_DISPLAY_X 5
53#define MATRIX_DISPLAY_Y 18 80#define MATRIX_DISPLAY_Y 18
54 81
55 for (uint8_t x = 0; x < MATRIX_ROWS; x++) { 82 for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
@@ -184,5 +211,10 @@ if (queue_for_send) {
184 send_command(DISPLAYOFF); /* 0xAE */ 211 send_command(DISPLAYOFF); /* 0xAE */
185 } 212 }
186#endif 213#endif
214 if (counterst == 0) {
215 //testPatternFB(o_fb);
216 }
217 counterst = (counterst + 1) % 1024;
218 //rgblight_task();
187 matrix_scan_user(); 219 matrix_scan_user();
188} 220}
diff --git a/keyboards/hadron/ver3/ver3.h b/keyboards/hadron/ver3/ver3.h
index 516f7b9a1..95926469b 100644
--- a/keyboards/hadron/ver3/ver3.h
+++ b/keyboards/hadron/ver3/ver3.h
@@ -1,4 +1,4 @@
1/* Copyright 2018 Jack Humbert <jack.humb@gmail.com> 1/* Copyright 2018 ishtob
2 * 2 *
3 * This program is free software: you can redistribute it and/or modify 3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -13,9 +13,6 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#ifndef VER3_H 16#pragma once
17#define VER3_H
18 17
19#include "hadron.h" 18#include "hadron.h" \ No newline at end of file
20
21#endif \ No newline at end of file