aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/scarletbandana/config.h7
-rw-r--r--keyboards/scarletbandana/info.json12
-rw-r--r--keyboards/scarletbandana/keymaps/default/config.h2
-rw-r--r--keyboards/scarletbandana/keymaps/default/keymap.c32
-rw-r--r--keyboards/scarletbandana/matrix.c326
-rw-r--r--keyboards/scarletbandana/readme.md30
-rw-r--r--keyboards/scarletbandana/rules.mk5
-rw-r--r--keyboards/scarletbandana/scarletbandana.c82
-rw-r--r--keyboards/scarletbandana/scarletbandana.h17
9 files changed, 47 insertions, 466 deletions
diff --git a/keyboards/scarletbandana/config.h b/keyboards/scarletbandana/config.h
index 74443b3f8..58c5d4a41 100644
--- a/keyboards/scarletbandana/config.h
+++ b/keyboards/scarletbandana/config.h
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright 2017 Cole Markham 2Copyright 2019 Cole Markham
3 3
4This program is free software: you can redistribute it and/or modify 4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by 5it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
25#define DEVICE_VER 0x0001 25#define DEVICE_VER 0x0001
26#define MANUFACTURER WoodKeys.click 26#define MANUFACTURER WoodKeys.click
27#define PRODUCT Scarlet Bandana Version IV mark.2 27#define PRODUCT Scarlet Bandana Version IV mark.2
28#define DESCRIPTION What keyboard is that? 28#define DESCRIPTION 65% with macro keys
29 29
30/* key matrix size */ 30/* key matrix size */
31#define MATRIX_ROWS 5 31#define MATRIX_ROWS 5
@@ -52,4 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
52#define NO_MUSIC_MODE 52#define NO_MUSIC_MODE
53#endif 53#endif
54 54
55#define NO_ACTION_MACRO
56#define NO_ACTION_FUNCTION
57
55#define DEBOUNCING_DELAY 5 58#define DEBOUNCING_DELAY 5
diff --git a/keyboards/scarletbandana/info.json b/keyboards/scarletbandana/info.json
new file mode 100644
index 000000000..9fb7c230a
--- /dev/null
+++ b/keyboards/scarletbandana/info.json
@@ -0,0 +1,12 @@
1{
2 "keyboard_name": "Scarlet Bandana Version IV Mark 2",
3 "url": "",
4 "maintainer": "qmk",
5 "width": 18.5,
6 "height": 5,
7 "layouts": {
8 "LAYOUT_all": {
9 "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2.5, "y":0}, {"x":3.5, "y":0}, {"x":4.5, "y":0}, {"x":5.5, "y":0}, {"x":6.5, "y":0}, {"x":7.5, "y":0}, {"x":8.5, "y":0}, {"x":9.5, "y":0}, {"x":10.5, "y":0}, {"x":11.5, "y":0}, {"x":12.5, "y":0}, {"x":13.5, "y":0}, {"x":14.5, "y":0}, {"x":15.5, "y":0}, {"x":16.5, "y":0}, {"x":17.5, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2.5, "y":1, "w":1.5}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":6, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":13, "y":1}, {"x":14, "y":1}, {"x":15, "y":1}, {"x":16, "y":1, "w":1.5}, {"x":17.5, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2.5, "y":2, "w":1.75}, {"x":4.25, "y":2}, {"x":5.25, "y":2}, {"x":6.25, "y":2}, {"x":7.25, "y":2}, {"x":8.25, "y":2}, {"x":9.25, "y":2}, {"x":10.25, "y":2}, {"x":11.25, "y":2}, {"x":12.25, "y":2}, {"x":13.25, "y":2}, {"x":14.25, "y":2}, {"x":15.25, "y":2, "w":2.25}, {"x":17.5, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2.5, "y":3, "w":2.25}, {"x":4.75, "y":3}, {"x":5.75, "y":3}, {"x":6.75, "y":3}, {"x":7.75, "y":3}, {"x":8.75, "y":3}, {"x":9.75, "y":3}, {"x":10.75, "y":3}, {"x":11.75, "y":3}, {"x":12.75, "y":3}, {"x":13.75, "y":3}, {"x":14.75, "y":3, "w":1.75}, {"x":16.5, "y":3}, {"x":17.5, "y":3}, {"x":0, "y":4}, {"x":1, "y":4}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":1.25}, {"x":5, "y":4, "w":1.25}, {"x":6.25, "y":4, "w":2.25}, {"x":8.5, "y":4, "w":1.75}, {"x":10.25, "y":4, "w":2.25}, {"x":12.5, "y":4}, {"x":13.5, "y":4}, {"x":14.5, "y":4}, {"x":15.5, "y":4}, {"x":16.5, "y":4}, {"x":17.5, "y":4}]
10 }
11 }
12} \ No newline at end of file
diff --git a/keyboards/scarletbandana/keymaps/default/config.h b/keyboards/scarletbandana/keymaps/default/config.h
index 97210115b..36f483c11 100644
--- a/keyboards/scarletbandana/keymaps/default/config.h
+++ b/keyboards/scarletbandana/keymaps/default/config.h
@@ -1,4 +1,4 @@
1/* Copyright 2017 Cole Markham, WoodKeys.click 1/* Copyright 2019 Cole Markham, WoodKeys.click
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
diff --git a/keyboards/scarletbandana/keymaps/default/keymap.c b/keyboards/scarletbandana/keymaps/default/keymap.c
index c67eeab7f..3d4c96160 100644
--- a/keyboards/scarletbandana/keymaps/default/keymap.c
+++ b/keyboards/scarletbandana/keymaps/default/keymap.c
@@ -1,4 +1,4 @@
1/* Copyright 2017 Cole Markham 1/* Copyright 2019 Cole Markham
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,7 +13,7 @@
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#include "../../scarletbandana.h" 16#include QMK_KEYBOARD_H
17 17
18#ifdef RGBLIGHT_ENABLE 18#ifdef RGBLIGHT_ENABLE
19//Following line allows macro to read current RGB settings 19//Following line allows macro to read current RGB settings
@@ -41,39 +41,35 @@ bool TOG_STATUS = false;
41int RGB_current_mode; 41int RGB_current_mode;
42 42
43const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 43const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44 [_QWERTY] = KEYMAP( 44 [_QWERTY] = LAYOUT_all(
45 KC_F1, KC_F2, 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,\ 45 KC_F1, KC_F2, 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_DEL, KC_PGUP,\
46 KC_F3, KC_F4, 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_PGDN,\ 46 KC_F3, KC_F4, 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_PGDN,\
47 KC_F5, KC_F6, 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_DEL, KC_HOME,\ 47 KC_F5, KC_F6, 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,\
48 KC_F7, KC_F8, KC_LSFT,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT,KC_SLASH,KC_RSFT,KC_UP,KC_END,\ 48 KC_F7, KC_F8, KC_LSFT,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT,KC_SLASH,KC_RSFT,KC_UP,KC_END,\
49 KC_F9, KC_F10, KC_LCTL,KC_LGUI,KC_LALT, RAISE, KC_SPACE, LOWER, KC_RALT,KC_APP,KC_RCTRL,KC_LEFT,KC_DOWN,KC_RIGHT), 49 KC_F9, KC_F10, KC_LCTL,KC_LGUI,KC_LALT, RAISE, KC_SPACE, LOWER, KC_RALT,KC_APP,KC_RCTRL,KC_LEFT,KC_DOWN,KC_RIGHT),
50 50
51 [_RAISE] = KEYMAP( 51 [_RAISE] = LAYOUT_all(
52 RGB_MOD, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\ 52 RGB_MOD, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______,\
53 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\ 53 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\
54 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______,\ 54 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\
55 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,\ 55 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,\
56 _______, _______, _______,_______,_______, _______, _______, _______, _______,_______,_______,_______,_______,_______), 56 _______, _______, _______,_______,_______, _______, _______, _______, _______,_______,_______,_______,_______,_______),
57 57
58 [_LOWER] = KEYMAP( 58 [_LOWER] = LAYOUT_all(
59 RGB_MOD, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\ 59 RGB_MOD, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______,\
60 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\ 60 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\
61 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______,\ 61 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\
62 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,\ 62 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,\
63 _______, _______, _______,_______,_______, _______, _______, _______, _______,_______,_______,_______,_______,_______), 63 _______, _______, _______,_______,_______, _______, _______, _______, _______,_______,_______,_______,_______,_______),
64 64
65 [_ADJUST] = KEYMAP( 65 [_ADJUST] = LAYOUT_all(
66 RESET, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\ 66 RESET, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______,\
67 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\ 67 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\
68 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______, _______,\ 68 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,\
69 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,\ 69 _______, _______, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,\
70 _______, _______, _______,_______,_______, _______, _______, _______, _______,_______,_______,_______,_______,_______) 70 _______, _______, _______,_______,_______, _______, _______, _______, _______,_______,_______,_______,_______,_______)
71}; 71};
72 72
73const uint16_t PROGMEM fn_actions[] = {
74
75};
76
77// Setting ADJUST layer RGB back to default 73// Setting ADJUST layer RGB back to default
78void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { 74void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
79 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { 75 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
diff --git a/keyboards/scarletbandana/matrix.c b/keyboards/scarletbandana/matrix.c
deleted file mode 100644
index 7b7934c9e..000000000
--- a/keyboards/scarletbandana/matrix.c
+++ /dev/null
@@ -1,326 +0,0 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3Copyright 2017 Cole Markham <cole@ccmcomputing.net>
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/*
20 * scan matrix
21 */
22#include <stdint.h>
23#include <stdbool.h>
24#if defined(__AVR__)
25#include <avr/io.h>
26#include "pincontrol.h"
27#endif
28#include "wait.h"
29#include "print.h"
30#include "debug.h"
31#include "util.h"
32#include "matrix.h"
33#include "config.h"
34#include "timer.h"
35//#include "audio.h"
36
37#ifndef DEBOUNCING_DELAY
38# define DEBOUNCING_DELAY 5
39#endif
40
41#if (DEBOUNCING_DELAY > 0)
42 static uint16_t debouncing_time;
43 static bool debouncing = false;
44#endif
45
46#if (MATRIX_COLS <= 8)
47# define print_matrix_header() print("\nr/c 01234567\n")
48# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
49# define matrix_bitpop(i) bitpop(matrix[i])
50# define ROW_SHIFTER ((uint8_t)1)
51#elif (MATRIX_COLS <= 16)
52# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
53# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
54# define matrix_bitpop(i) bitpop16(matrix[i])
55# define ROW_SHIFTER ((uint16_t)1)
56#elif (MATRIX_COLS <= 32)
57# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
58# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
59# define matrix_bitpop(i) bitpop32(matrix[i])
60# define ROW_SHIFTER ((uint32_t)1)
61#endif
62
63static matrix_row_t matrix_debouncing[MATRIX_ROWS];
64
65static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
66static const uint8_t col_pins[4] = MATRIX_COL_PINS;
67static const uint8_t xcol_pins[MATRIX_COLS - 16] = MATRIX_XCOL_PINS;
68//
69//float init_song[][2] = SONG(QWERTY_SOUND);
70
71/* matrix state(1:on, 0:off) */
72static matrix_row_t matrix[MATRIX_ROWS];
73static matrix_row_t matrix_debouncing[MATRIX_ROWS];
74static void init_rows(void);
75static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
76static void unselect_cols(void);
77static void init_cols(void);
78static void select_col(uint8_t col);
79//static void demux_enable(bool enabled);
80
81__attribute__ ((weak))
82void matrix_init_quantum(void) {
83 matrix_init_kb();
84}
85
86__attribute__ ((weak))
87void matrix_scan_quantum(void) {
88 matrix_scan_kb();
89}
90
91__attribute__ ((weak))
92void matrix_init_kb(void) {
93 matrix_init_user();
94}
95
96__attribute__ ((weak))
97void matrix_scan_kb(void) {
98 matrix_scan_user();
99}
100
101__attribute__ ((weak))
102void matrix_init_user(void) {
103}
104
105__attribute__ ((weak))
106void matrix_scan_user(void) {
107}
108
109inline
110uint8_t matrix_rows(void)
111{
112 return MATRIX_ROWS;
113}
114
115inline
116uint8_t matrix_cols(void)
117{
118 return MATRIX_COLS;
119}
120
121void matrix_init(void)
122{
123 debug_enable = true;
124 debug_matrix = true;
125 debug_mouse = true;
126 dprintf("matrix init");
127 // initialize row and col
128 init_cols();
129 init_rows();
130
131
132// PLAY_NOTE_ARRAY(init_song, false, 0);
133
134
135 // initialize matrix state: all keys off
136 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
137 matrix[i] = 0;
138 matrix_debouncing[i] = 0;
139 }
140
141 matrix_init_quantum();
142
143}
144
145uint8_t _matrix_scan(void)
146{
147 // Set col, read rows
148 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
149# if (DEBOUNCING_DELAY > 0)
150 bool matrix_changed = read_rows_on_col(matrix_debouncing, current_col);
151 if (matrix_changed) {
152 debouncing = true;
153 debouncing_time = timer_read();
154 }
155# else
156 read_rows_on_col(matrix, current_col);
157# endif
158
159 }
160
161 // Unselect cols
162 unselect_cols();
163
164# if (DEBOUNCING_DELAY > 0)
165 if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
166 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
167 matrix[i] = matrix_debouncing[i];
168 }
169 debouncing = false;
170 }
171# endif
172
173 return 1;
174}
175
176uint8_t matrix_scan(void)
177{
178 uint8_t ret = _matrix_scan();
179 matrix_scan_quantum();
180 return ret;
181}
182
183bool matrix_is_modified(void)
184{
185 if (debouncing) return false;
186 return true;
187}
188
189inline
190bool matrix_is_on(uint8_t row, uint8_t col)
191{
192 return (matrix[row] & ((matrix_row_t)1<<col));
193}
194
195inline
196matrix_row_t matrix_get_row(uint8_t row)
197{
198 return matrix[row];
199}
200
201void matrix_print(void)
202{
203 print("\nr/c 0123456789ABCDEF\n");
204 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
205 phex(row); print(": ");
206 pbin_reverse16(matrix_get_row(row));
207 print("\n");
208 }
209}
210
211uint8_t matrix_key_count(void)
212{
213 uint8_t count = 0;
214 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
215 count += bitpop16(matrix[i]);
216 }
217 return count;
218}
219
220
221static void init_rows(void)
222{
223 for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
224 uint8_t pin = row_pins[x];
225 pinMode(pin, PinDirectionInput);
226 digitalWrite(pin, PinLevelHigh);
227 }
228}
229
230
231static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
232{
233 bool matrix_changed = false;
234
235 // Select col and wait for col selection to stabilize
236 select_col(current_col);
237 wait_us(30);
238// wait_ms(1000);
239// PLAY_NOTE_ARRAY(init_song, false, 0);
240
241 // For each row...
242 for(uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++)
243 {
244
245 // Store last value of row prior to reading
246 matrix_row_t last_row_value = current_matrix[row_index];
247
248 // Check row pin state
249 uint8_t pin = row_pins[row_index];
250 if (digitalRead(pin) == 0)
251 {
252 // Pin LO, set col bit
253 current_matrix[row_index] |= (ROW_SHIFTER << current_col);
254 }
255 else
256 {
257 // Pin HI, clear col bit
258 current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
259 }
260
261 // Determine if the matrix changed state
262 if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
263 {
264 matrix_changed = true;
265 }
266 }
267
268 return matrix_changed;
269}
270
271static void select_col(uint8_t col)
272{
273 for (uint8_t y = 16; y < MATRIX_COLS; y++) {
274 uint8_t pin = xcol_pins[y-16];
275 if (y == col) {
276 digitalWrite(pin, PinLevelLow);
277 } else {
278 digitalWrite(pin, PinLevelHigh);
279 }
280 }
281 if (col >= 16) {
282// demux_enable(false);
283// digitalWrite(MATRIX_EN_PIN, PinLevelHigh);
284 } else {
285 for(uint8_t x = 0; x < 4; x++) {
286 uint8_t pin = col_pins[x];
287 pinMode(pin, PinDirectionOutput);
288 digitalWrite(pin, (col >> x) & 0x1);
289 }
290// demux_enable(true);
291 digitalWrite(MATRIX_EN_PIN, PinLevelLow);
292 }
293}
294
295static void init_cols(void) {
296 for (uint8_t y = 16; y < MATRIX_COLS; y++) {
297 uint8_t pin = xcol_pins[y-16];
298 pinMode(pin, PinDirectionOutput);
299 }
300 for(uint8_t x = 0; x < 4; x++) {
301 uint8_t pin = col_pins[x];
302 pinMode(pin, PinDirectionOutput);
303 }
304 pinMode(MATRIX_EN_PIN, PinDirectionOutput);
305// digitalWrite(MATRIX_EN_PIN, PinLevelHigh);
306 unselect_cols();
307}
308
309static void unselect_cols(void)
310{
311 for (uint8_t y = 16; y < MATRIX_COLS; y++) {
312 uint8_t pin = xcol_pins[y-16];
313 digitalWrite(pin, PinLevelHigh);
314 }
315// demux_enable(false);
316// digitalWrite(MATRIX_EN_PIN, PinLevelHigh);
317}
318
319//static void demux_enable(uint8_t state)
320//{
321// if (enabled){
322// digitalWrite(F7, PinLevelLow);
323// } else {
324// digitalWrite(F7, PinLevelHigh);
325// }
326//}
diff --git a/keyboards/scarletbandana/readme.md b/keyboards/scarletbandana/readme.md
index 6d5d9b553..83281bae3 100644
--- a/keyboards/scarletbandana/readme.md
+++ b/keyboards/scarletbandana/readme.md
@@ -1,31 +1,11 @@
1# Meira 1# Scarlet Bandana Version IV Mark 2
2
3![Miera](https://imgur.com/kF4MFlW)
4
5A 4x12 ortholinear low-profile keyboard.
6 2
7Keyboard Maintainer: [Cole Markham](https://github.com/colemarkham) 3Keyboard Maintainer: [Cole Markham](https://github.com/colemarkham)
8Hardware Supported: Meira/ProMicro, Meira/FeatherBLE 4Hardware Supported: Scarlet Bandana Version IV Mark 2
9Hardware Availability: [WoodKeys.click](https://woodkeys.click/meira) 5Hardware Availability: [WoodKeys.click](https://woodkeys.click/product/scarlet-bandana-version-iv-mark-2/)
10
11Two controllers are support: the Pro Micro, and the Adafruit Feather BLE 32u4. Support for each is defined as a hardware revision subfolder in QMK. Main differences include processor frequencies and matrix pinouts.
12 6
13Make example for this keyboard (after setting up your build environment): 7Make example for this keyboard (after setting up your build environment):
14 8
15 make meira/promicro:default 9 make scarletbandana:default
16
17or
18
19 make meira/featherble:default
20
21See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information on generic QMK configuration and setup.
22
23Both the Pro Micro and the Feather BLE use the Catalina bootloader, which is typically programmed using avrdude.
24
25## Matrix
26
27In order to have enough pins for the matrix and other functions, a custom matrix is implemented using a demultiplexer to scan the columns. Since the demux is active low, the diodes must be oriented with the cathode connected to the demux pin. When looking at the bottom of the board with the controller at the top right, the cathode mark on the diode should be toward the left.
28
29## LED Controller
30 10
31The in-switch LEDs are driven by an ISSI LED controller (IS31FL3731). The micro controller communicates with this chip using I2C. Individual LED control is possible, but currently only general backlighting support is implemented. This functionality is located in lighting.c, issi.c, and TWILib.c. \ No newline at end of file 11See 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/scarletbandana/rules.mk b/keyboards/scarletbandana/rules.mk
index b6f61d8a4..2767697c5 100644
--- a/keyboards/scarletbandana/rules.mk
+++ b/keyboards/scarletbandana/rules.mk
@@ -45,13 +45,13 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
45# Atmel DFU loader 4096 45# Atmel DFU loader 4096
46# LUFA bootloader 4096 46# LUFA bootloader 4096
47# USBaspLoader 2048 47# USBaspLoader 2048
48OPT_DEFS += -DBOOTLOADER_SIZE=4096 48BOOTLOADER = atmel-dfu
49 49
50 50
51# Build Options 51# Build Options
52# change yes to no to disable 52# change yes to no to disable
53# 53#
54BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 54BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 55MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
56EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 56EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
57CONSOLE_ENABLE = no # Console for debug(+400) 57CONSOLE_ENABLE = no # Console for debug(+400)
@@ -67,3 +67,4 @@ AUDIO_ENABLE = yes # Audio output on port C6
67RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 67RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 68FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
69BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality, also set ISSI_ENABLE below for Miera 69BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality, also set ISSI_ENABLE below for Miera
70EXTRAFLAGS += -flto
diff --git a/keyboards/scarletbandana/scarletbandana.c b/keyboards/scarletbandana/scarletbandana.c
index 6926312ec..6ef183c2c 100644
--- a/keyboards/scarletbandana/scarletbandana.c
+++ b/keyboards/scarletbandana/scarletbandana.c
@@ -1,4 +1,4 @@
1/* Copyright 2017 Cole Markham, WoodKeys.click 1/* Copyright 2019 Cole Markham, WoodKeys.click
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
@@ -14,89 +14,9 @@
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#include "scarletbandana.h" 16#include "scarletbandana.h"
17#include <LUFA/Common/Common.h>
18 17
19#include "quantum.h"
20 18
21#ifdef AUDIO_ENABLE
22 float tone_startup[][2] = SONG(STARTUP_SOUND);
23 float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
24#endif
25 19
26 20
27void shutdown_user(void) {
28 #ifdef AUDIO_ENABLE
29 PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
30 _delay_ms(150);
31 stop_all_notes();
32 #endif
33}
34 21
35 22
36void matrix_init_kb(void)
37{
38 // This is required to access the pins in the F-register
39 JTAG_DISABLE();
40 debug_enable=true;
41 print("sb matrix_init_kb\n");
42#ifdef AUDIO_ENABLE
43 _delay_ms(20); // gets rid of tick
44 PLAY_NOTE_ARRAY(tone_startup, false, 0);
45#endif
46
47
48 // put your keyboard start-up code here
49 // runs once when the firmware starts up
50 matrix_init_user();
51}
52
53void matrix_scan_kb(void)
54{
55 matrix_scan_user();
56}
57
58bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
59 // Test code that turns on the switch led for the key that is pressed
60 // set_backlight_by_keymap(record->event.key.col, record->event.key.row);
61 if (keycode == RESET) {
62 reset_keyboard_kb();
63 } else {
64 }
65 return process_record_user(keycode, record);
66}
67
68void led_set_kb(uint8_t usb_led) {
69 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
70 led_set_user(usb_led);
71}
72
73//void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
74//{
75//#ifdef AUDIO_ENABLE
76// int8_t sign = 1;
77//#endif
78// if(id == LFK_ESC_TILDE){
79// // Send ~ on shift-esc
80// void (*method)(uint8_t) = (event->event.pressed) ? &add_key : &del_key;
81// uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT));
82// method(shifted ? KC_GRAVE : KC_ESCAPE);
83// send_keyboard_report();
84// }else if(event->event.pressed){
85// switch(id){
86// case LFK_CLEAR:
87// // Go back to default layer
88// layer_clear();
89// break;
90//#ifdef ISSI_ENABLE
91// case LFK_LED_TEST:
92// led_test();
93// break;
94//#endif
95// }
96// }
97//}
98
99void reset_keyboard_kb(){
100 xprintf("programming!\n");
101 reset_keyboard();
102}
diff --git a/keyboards/scarletbandana/scarletbandana.h b/keyboards/scarletbandana/scarletbandana.h
index 77b6afa7a..8178e8c8d 100644
--- a/keyboards/scarletbandana/scarletbandana.h
+++ b/keyboards/scarletbandana/scarletbandana.h
@@ -1,4 +1,4 @@
1/* Copyright 2017 Cole Markham 1/* Copyright 2019 Cole Markham
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,23 +13,20 @@
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 SCARLETBANDANA_H 16#pragma once
17#define SCARLETBANDANA_H
18 17
19#include "quantum.h" 18#include "quantum.h"
20 19
21void reset_keyboard_kb(void);
22
23// This a shortcut to help you visually see your layout. 20// This a shortcut to help you visually see your layout.
24// The following is an example using the Planck MIT layout 21// The following is an example using the Planck MIT layout
25// The first section contains all of the arguments 22// The first section contains all of the arguments
26// The second converts the arguments into a two-dimensional array 23// The second converts the arguments into a two-dimensional array
27#define KEYMAP( \ 24#define LAYOUT_all( \
28 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, k0f, k0g, \ 25 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, k0f, k2f, k0g, \
29 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f, k1g, \ 26 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f, k1g, \
30 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e, k2f, k2g, \ 27 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e, k2g, \
31 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3e, k3f, k3g, \ 28 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3e, k3f, k3g, \
32 k40, k41, k42, k43, k44, k45, k47, k49, k4a, k4b, k4c, k4e, k4f, k4g \ 29 k40, k41, k42, k43, k44, k45, k47, k49, k4a, k4b, k4c, k4e, k4f, k4g \
33) \ 30) \
34{ \ 31{ \
35 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, k0f, k0g }, \ 32 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, k0f, k0g }, \
@@ -39,5 +36,3 @@ void reset_keyboard_kb(void);
39 { k40, k41, k42, k43, k44, k45, KC_NO, k47, KC_NO, k49, k4a, k4b, k4c, KC_NO, k4e, k4f, k4g } \ 36 { k40, k41, k42, k43, k44, k45, KC_NO, k47, KC_NO, k49, k4a, k4b, k4c, KC_NO, k4e, k4f, k4g } \
40} 37}
41 38
42#endif
43