Skip to content

Commit de9c2fb

Browse files
author
Carlos Cardoso
committed
Merge remote-tracking branch 'qmk/develop' into develop
* qmk/develop: 3w6 - Refactor use of AVR only I2C functions (qmk#14339) Refactor use of legacy i2c implementation (qmk#14341) ergodone - Refactor use of legacy i2c implementation (qmk#14340) [Keyboard] Redox media (qmk#13084) [Keyboard] Zinc: fix RGBLED_NUM bug (qmk#13287) Fix eeprom for Durgod boards (qmk#14324) [Bug] Fix compile issues for boards with custom matrix (qmk#14323) Tidy up defines within STM EEPROM emulation (qmk#14275) Remove empty override functions (qmk#14312) Highlight keycode (qmk#14317) [Core] Add `is_oled_scrolling` (qmk#14305) [Keyboard] Fix rotary encoder function for Voice65 (qmk#14316) Fix Space Cadet md link (qmk#14300) Enable extra keys for Technik ortho and stagger (qmk#14282) FJLabs Ready100 Configurator Fixes (qmk#14291) Naiping NPhhkb: 60_tsangan_hhkb Community Layout support (qmk#14292) takashicompany/endzone34: correct QMK Configurator key sequence (qmk#14290)
2 parents 37be6e5 + af19461 commit de9c2fb

File tree

540 files changed

+1011
-9886
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

540 files changed

+1011
-9886
lines changed

docs/feature_oled_driver.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ bool oled_scroll_left(void);
356356
// Returns true if the screen was not scrolling or stops scrolling
357357
bool oled_scroll_off(void);
358358

359+
// Returns true if the oled is currently scrolling, false if it is
360+
// not
361+
bool is_oled_scrolling(void);
362+
359363
// Inverts the display
360364
// Returns true if the screen was or is inverted
361365
bool oled_invert(bool invert);

docs/feature_velocikey.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ EXTRAKEY_ENABLE = yes
1313
VELOCIKEY_ENABLE = yes
1414
```
1515

16-
Then, while using your keyboard, you need to also turn it on with the VLK_TOG keycode, which toggles the feature on and off.
16+
Then, while using your keyboard, you need to also turn it on with the `VLK_TOG` keycode, which toggles the feature on and off.
1717

1818
The following light effects will all be controlled by Velocikey when it is enabled:
1919
- RGB Breathing

docs/reference_glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ A 1 byte number that is sent as part of a HID report over USB that represents a
130130
## Space Cadet Shift
131131
A special set of shift keys which allow you to type various types of braces by tapping the left or right shift one or more times.
132132

133-
* [Space Cadet Shift Documentation](feature_space_cadet_shift.md)
133+
* [Space Cadet Shift Documentation](feature_space_cadet.md)
134134

135135
## Tap
136136
Pressing and releasing a key. In some situations you will need to distinguish between a key down and a key up event, and Tap always refers to both at once.

drivers/oled/oled_driver.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ bool oled_scroll_left(void);
313313
// Returns true if the screen was not scrolling or stops scrolling
314314
bool oled_scroll_off(void);
315315

316+
// Returns true if the oled is currently scrolling, false if it is
317+
// not
318+
bool is_oled_scrolling(void);
319+
316320
// Inverts the display
317321
// Returns true if the screen was or is inverted
318322
bool oled_invert(bool invert);

drivers/oled/ssd1306_sh1106.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ bool oled_scroll_off(void) {
692692
return !oled_scrolling;
693693
}
694694

695+
bool is_oled_scrolling(void) { return oled_scrolling; }
696+
695697
bool oled_invert(bool invert) {
696698
if (!oled_initialized) {
697699
return oled_inverted;

keyboards/1upkeyboards/1up60hse/1up60hse.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,3 @@
1414
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1515
*/
1616
#include "1up60hse.h"
17-
18-
void matrix_init_kb(void) {
19-
// put your keyboard start-up code here
20-
// runs once when the firmware starts up
21-
22-
matrix_init_user();
23-
}
24-
25-
void matrix_scan_kb(void) {
26-
// put your looping keyboard code here
27-
// runs every cycle (a lot)
28-
29-
matrix_scan_user();
30-
}
31-
32-
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
33-
// put your per-action keyboard code here
34-
// runs for every action, just before processing by the firmware
35-
36-
return process_record_user(keycode, record);
37-
}
38-
39-
void led_set_kb(uint8_t usb_led) {
40-
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
41-
42-
led_set_user(usb_led);
43-
}

keyboards/1upkeyboards/1up60rgb/keymaps/default/keymap.c

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
1818

1919
};
2020

21-
void matrix_init_user(void) {
22-
}
23-
24-
void matrix_scan_user(void) {
25-
}
26-
27-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
28-
return true;
29-
}
30-
3121
void led_set_user(uint8_t usb_led) {
32-
33-
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
34-
35-
} else {
36-
37-
}
38-
3922
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
40-
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
41-
} else {
42-
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
43-
}
44-
45-
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
46-
47-
} else {
48-
49-
}
50-
51-
if (usb_led & (1 << USB_LED_COMPOSE)) {
52-
23+
setPinOutput(B2);
24+
writePinLow(B2);
5325
} else {
54-
26+
setPinInput(B2);
27+
writePinLow(B2);
5528
}
56-
57-
if (usb_led & (1 << USB_LED_KANA)) {
58-
59-
} else {
60-
61-
}
62-
6329
}

keyboards/1upkeyboards/1up60rgb/keymaps/iso/keymap.c

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
1818

1919
};
2020

21-
void matrix_init_user(void) {
22-
}
23-
24-
void matrix_scan_user(void) {
25-
}
26-
27-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
28-
return true;
29-
}
30-
3121
void led_set_user(uint8_t usb_led) {
32-
33-
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
34-
35-
} else {
36-
37-
}
38-
3922
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
40-
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
41-
} else {
42-
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
43-
}
44-
45-
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
46-
47-
} else {
48-
49-
}
50-
51-
if (usb_led & (1 << USB_LED_COMPOSE)) {
52-
23+
setPinOutput(B2);
24+
writePinLow(B2);
5325
} else {
54-
26+
setPinInput(B2);
27+
writePinLow(B2);
5528
}
56-
57-
if (usb_led & (1 << USB_LED_KANA)) {
58-
59-
} else {
60-
61-
}
62-
6329
}

keyboards/1upkeyboards/1up60rgb/keymaps/tsangan/keymap.c

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
1818

1919
};
2020

21-
void matrix_init_user(void) {
22-
}
23-
24-
void matrix_scan_user(void) {
25-
}
26-
27-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
28-
return true;
29-
}
30-
3121
void led_set_user(uint8_t usb_led) {
32-
33-
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
34-
35-
} else {
36-
37-
}
38-
3922
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
40-
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
41-
} else {
42-
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
43-
}
44-
45-
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
46-
47-
} else {
48-
49-
}
50-
51-
if (usb_led & (1 << USB_LED_COMPOSE)) {
52-
23+
setPinOutput(B2);
24+
writePinLow(B2);
5325
} else {
54-
26+
setPinInput(B2);
27+
writePinLow(B2);
5528
}
56-
57-
if (usb_led & (1 << USB_LED_KANA)) {
58-
59-
} else {
60-
61-
}
62-
6329
}

keyboards/1upkeyboards/super16/keymaps/default/keymap.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
2323
RGB_MOD, KC_1, KC_U, KC_P
2424
),
2525
};
26-
27-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
28-
return true;
29-
}
30-
31-
void matrix_init_user(void) {
32-
33-
}
34-
35-
void matrix_scan_user(void) {
36-
37-
}
38-
39-
void led_set_user(uint8_t usb_led) {
40-
41-
}

keyboards/3w6/rev1/matrix.c

Lines changed: 33 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ extern i2c_status_t tca9555_status;
3535
// | 0 | 1 | 0 | 0 | A2 | A1 | A0 |
3636
// | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
3737
#define I2C_ADDR 0b0100000
38-
#define I2C_ADDR_WRITE ((I2C_ADDR << 1) | I2C_WRITE)
39-
#define I2C_ADDR_READ ((I2C_ADDR << 1) | I2C_READ)
4038

4139
// Register addresses
4240
#define IODIRA 0x06 // i/o direction register
@@ -64,19 +62,14 @@ uint8_t init_tca9555(void) {
6462
// - unused : input : 1
6563
// - input : input : 1
6664
// - driving : output : 0
67-
tca9555_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT);
68-
if (tca9555_status) goto out;
69-
tca9555_status = i2c_write(IODIRA, I2C_TIMEOUT);
70-
if (tca9555_status) goto out;
71-
// This means: write on pin 5 of port 0, read on rest
72-
tca9555_status = i2c_write(0b11011111, I2C_TIMEOUT);
73-
if (tca9555_status) goto out;
74-
// This means: we will write on pins 0 to 2 on port 1. read rest
75-
tca9555_status = i2c_write(0b11111000, I2C_TIMEOUT);
76-
if (tca9555_status) goto out;
77-
78-
out:
79-
i2c_stop();
65+
uint8_t conf[2] = {
66+
// This means: write on pin 5 of port 0, read on rest
67+
0b11011111,
68+
// This means: we will write on pins 0 to 2 on port 1. read rest
69+
0b11111000,
70+
};
71+
tca9555_status = i2c_writeReg(I2C_ADDR, IODIRA, conf, 2, I2C_TIMEOUT);
72+
8073
return tca9555_status;
8174
}
8275

@@ -192,36 +185,29 @@ static matrix_row_t read_cols(uint8_t row) {
192185
if (tca9555_status) { // if there was an error
193186
return 0;
194187
} else {
195-
uint8_t data = 0;
196-
uint8_t port0 = 0;
197-
uint8_t port1 = 0;
198-
tca9555_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT);
199-
if (tca9555_status) goto out;
200-
tca9555_status = i2c_write(IREGP0, I2C_TIMEOUT);
201-
if (tca9555_status) goto out;
202-
tca9555_status = i2c_start(I2C_ADDR_READ, I2C_TIMEOUT);
203-
if (tca9555_status) goto out;
204-
tca9555_status = i2c_read_ack(I2C_TIMEOUT);
205-
if (tca9555_status < 0) goto out;
206-
port0 = (uint8_t)tca9555_status;
207-
tca9555_status = i2c_read_nack(I2C_TIMEOUT);
208-
if (tca9555_status < 0) goto out;
209-
port1 = (uint8_t)tca9555_status;
210-
211-
// The initial state was all ones and any depressed key at a given column for the currently selected row will have its bit flipped to zero.
212-
// The return value is a row as represented in the generic matrix code were the rightmost bits represent the lower columns and zeroes represent non-depressed keys while ones represent depressed keys.
213-
// Since the pins are not ordered sequentially, we have to build the correct dataset from the two ports. Refer to the schematic to see where every pin is connected.
214-
data |= ( port0 & 0x01 );
215-
data |= ( port0 & 0x02 );
216-
data |= ( port1 & 0x10 ) >> 2;
217-
data |= ( port1 & 0x08 );
218-
data |= ( port0 & 0x40 ) >> 2;
219-
data = ~(data);
220-
221-
tca9555_status = I2C_STATUS_SUCCESS;
222-
out:
223-
i2c_stop();
224-
return data;
188+
uint8_t data = 0;
189+
uint8_t ports[2] = {0};
190+
tca9555_status = i2c_readReg(I2C_ADDR, IREGP0, ports, 2, I2C_TIMEOUT);
191+
if (tca9555_status) { // if there was an error
192+
// do nothing
193+
return 0;
194+
} else {
195+
uint8_t port0 = ports[0];
196+
uint8_t port1 = ports[1];
197+
198+
// The initial state was all ones and any depressed key at a given column for the currently selected row will have its bit flipped to zero.
199+
// The return value is a row as represented in the generic matrix code were the rightmost bits represent the lower columns and zeroes represent non-depressed keys while ones represent depressed keys.
200+
// Since the pins are not ordered sequentially, we have to build the correct dataset from the two ports. Refer to the schematic to see where every pin is connected.
201+
data |= ( port0 & 0x01 );
202+
data |= ( port0 & 0x02 );
203+
data |= ( port1 & 0x10 ) >> 2;
204+
data |= ( port1 & 0x08 );
205+
data |= ( port0 & 0x40 ) >> 2;
206+
data = ~(data);
207+
208+
tca9555_status = I2C_STATUS_SUCCESS;
209+
return data;
210+
}
225211
}
226212
}
227213
}
@@ -263,18 +249,10 @@ static void select_row(uint8_t row) {
263249
default: break;
264250
}
265251

266-
tca9555_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT);
267-
if (tca9555_status) goto out;
268-
tca9555_status = i2c_write(OREGP0, I2C_TIMEOUT);
269-
if (tca9555_status) goto out;
270-
tca9555_status = i2c_write(port0, I2C_TIMEOUT);
271-
if (tca9555_status) goto out;
272-
tca9555_status = i2c_write(port1, I2C_TIMEOUT);
273-
if (tca9555_status) goto out;
252+
uint8_t ports[2] = {port0, port1};
253+
tca9555_status = i2c_writeReg(I2C_ADDR, OREGP0, ports, 2, I2C_TIMEOUT);
274254
// Select the desired row by writing a byte for the entire GPIOB bus where only the bit representing the row we want to select is a zero (write instruction) and every other bit is a one.
275255
// Note that the row - MATRIX_ROWS_PER_SIDE reflects the fact that being on the right hand, the columns are numbered from MATRIX_ROWS_PER_SIDE to MATRIX_ROWS, but the pins we want to write to are indexed from zero up on the GPIOB bus.
276-
out:
277-
i2c_stop();
278256
}
279257
}
280258
}

0 commit comments

Comments
 (0)