Skip to content

Commit

Permalink
Merge remote-tracking branch 'qmk/develop' into develop
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
Carlos Cardoso committed Sep 7, 2021
2 parents 37be6e5 + af19461 commit de9c2fb
Show file tree
Hide file tree
Showing 540 changed files with 1,011 additions and 9,886 deletions.
4 changes: 4 additions & 0 deletions docs/feature_oled_driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ bool oled_scroll_left(void);
// Returns true if the screen was not scrolling or stops scrolling
bool oled_scroll_off(void);

// Returns true if the oled is currently scrolling, false if it is
// not
bool is_oled_scrolling(void);

// Inverts the display
// Returns true if the screen was or is inverted
bool oled_invert(bool invert);
Expand Down
2 changes: 1 addition & 1 deletion docs/feature_velocikey.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ EXTRAKEY_ENABLE = yes
VELOCIKEY_ENABLE = yes
```

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

The following light effects will all be controlled by Velocikey when it is enabled:
- RGB Breathing
Expand Down
2 changes: 1 addition & 1 deletion docs/reference_glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ A 1 byte number that is sent as part of a HID report over USB that represents a
## Space Cadet Shift
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.

* [Space Cadet Shift Documentation](feature_space_cadet_shift.md)
* [Space Cadet Shift Documentation](feature_space_cadet.md)

## Tap
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.
Expand Down
4 changes: 4 additions & 0 deletions drivers/oled/oled_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ bool oled_scroll_left(void);
// Returns true if the screen was not scrolling or stops scrolling
bool oled_scroll_off(void);

// Returns true if the oled is currently scrolling, false if it is
// not
bool is_oled_scrolling(void);

// Inverts the display
// Returns true if the screen was or is inverted
bool oled_invert(bool invert);
Expand Down
2 changes: 2 additions & 0 deletions drivers/oled/ssd1306_sh1106.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,8 @@ bool oled_scroll_off(void) {
return !oled_scrolling;
}

bool is_oled_scrolling(void) { return oled_scrolling; }

bool oled_invert(bool invert) {
if (!oled_initialized) {
return oled_inverted;
Expand Down
27 changes: 0 additions & 27 deletions keyboards/1upkeyboards/1up60hse/1up60hse.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,3 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "1up60hse.h"

void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up

matrix_init_user();
}

void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)

matrix_scan_user();
}

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware

return process_record_user(keycode, record);
}

void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here

led_set_user(usb_led);
}
42 changes: 4 additions & 38 deletions keyboards/1upkeyboards/1up60rgb/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

void matrix_init_user(void) {
}

void matrix_scan_user(void) {
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

void led_set_user(uint8_t usb_led) {

if (usb_led & (1 << USB_LED_NUM_LOCK)) {

} else {

}

if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
} else {
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
}

if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {

} else {

}

if (usb_led & (1 << USB_LED_COMPOSE)) {

setPinOutput(B2);
writePinLow(B2);
} else {

setPinInput(B2);
writePinLow(B2);
}

if (usb_led & (1 << USB_LED_KANA)) {

} else {

}

}
42 changes: 4 additions & 38 deletions keyboards/1upkeyboards/1up60rgb/keymaps/iso/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

void matrix_init_user(void) {
}

void matrix_scan_user(void) {
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

void led_set_user(uint8_t usb_led) {

if (usb_led & (1 << USB_LED_NUM_LOCK)) {

} else {

}

if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
} else {
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
}

if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {

} else {

}

if (usb_led & (1 << USB_LED_COMPOSE)) {

setPinOutput(B2);
writePinLow(B2);
} else {

setPinInput(B2);
writePinLow(B2);
}

if (usb_led & (1 << USB_LED_KANA)) {

} else {

}

}
42 changes: 4 additions & 38 deletions keyboards/1upkeyboards/1up60rgb/keymaps/tsangan/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

void matrix_init_user(void) {
}

void matrix_scan_user(void) {
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

void led_set_user(uint8_t usb_led) {

if (usb_led & (1 << USB_LED_NUM_LOCK)) {

} else {

}

if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
} else {
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
}

if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {

} else {

}

if (usb_led & (1 << USB_LED_COMPOSE)) {

setPinOutput(B2);
writePinLow(B2);
} else {

setPinInput(B2);
writePinLow(B2);
}

if (usb_led & (1 << USB_LED_KANA)) {

} else {

}

}
16 changes: 0 additions & 16 deletions keyboards/1upkeyboards/super16/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
RGB_MOD, KC_1, KC_U, KC_P
),
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

void matrix_init_user(void) {

}

void matrix_scan_user(void) {

}

void led_set_user(uint8_t usb_led) {

}
88 changes: 33 additions & 55 deletions keyboards/3w6/rev1/matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ extern i2c_status_t tca9555_status;
// | 0 | 1 | 0 | 0 | A2 | A1 | A0 |
// | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
#define I2C_ADDR 0b0100000
#define I2C_ADDR_WRITE ((I2C_ADDR << 1) | I2C_WRITE)
#define I2C_ADDR_READ ((I2C_ADDR << 1) | I2C_READ)

// Register addresses
#define IODIRA 0x06 // i/o direction register
Expand Down Expand Up @@ -64,19 +62,14 @@ uint8_t init_tca9555(void) {
// - unused : input : 1
// - input : input : 1
// - driving : output : 0
tca9555_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT);
if (tca9555_status) goto out;
tca9555_status = i2c_write(IODIRA, I2C_TIMEOUT);
if (tca9555_status) goto out;
// This means: write on pin 5 of port 0, read on rest
tca9555_status = i2c_write(0b11011111, I2C_TIMEOUT);
if (tca9555_status) goto out;
// This means: we will write on pins 0 to 2 on port 1. read rest
tca9555_status = i2c_write(0b11111000, I2C_TIMEOUT);
if (tca9555_status) goto out;

out:
i2c_stop();
uint8_t conf[2] = {
// This means: write on pin 5 of port 0, read on rest
0b11011111,
// This means: we will write on pins 0 to 2 on port 1. read rest
0b11111000,
};
tca9555_status = i2c_writeReg(I2C_ADDR, IODIRA, conf, 2, I2C_TIMEOUT);

return tca9555_status;
}

Expand Down Expand Up @@ -192,36 +185,29 @@ static matrix_row_t read_cols(uint8_t row) {
if (tca9555_status) { // if there was an error
return 0;
} else {
uint8_t data = 0;
uint8_t port0 = 0;
uint8_t port1 = 0;
tca9555_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT);
if (tca9555_status) goto out;
tca9555_status = i2c_write(IREGP0, I2C_TIMEOUT);
if (tca9555_status) goto out;
tca9555_status = i2c_start(I2C_ADDR_READ, I2C_TIMEOUT);
if (tca9555_status) goto out;
tca9555_status = i2c_read_ack(I2C_TIMEOUT);
if (tca9555_status < 0) goto out;
port0 = (uint8_t)tca9555_status;
tca9555_status = i2c_read_nack(I2C_TIMEOUT);
if (tca9555_status < 0) goto out;
port1 = (uint8_t)tca9555_status;

// 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.
// 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.
// 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.
data |= ( port0 & 0x01 );
data |= ( port0 & 0x02 );
data |= ( port1 & 0x10 ) >> 2;
data |= ( port1 & 0x08 );
data |= ( port0 & 0x40 ) >> 2;
data = ~(data);

tca9555_status = I2C_STATUS_SUCCESS;
out:
i2c_stop();
return data;
uint8_t data = 0;
uint8_t ports[2] = {0};
tca9555_status = i2c_readReg(I2C_ADDR, IREGP0, ports, 2, I2C_TIMEOUT);
if (tca9555_status) { // if there was an error
// do nothing
return 0;
} else {
uint8_t port0 = ports[0];
uint8_t port1 = ports[1];

// 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.
// 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.
// 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.
data |= ( port0 & 0x01 );
data |= ( port0 & 0x02 );
data |= ( port1 & 0x10 ) >> 2;
data |= ( port1 & 0x08 );
data |= ( port0 & 0x40 ) >> 2;
data = ~(data);

tca9555_status = I2C_STATUS_SUCCESS;
return data;
}
}
}
}
Expand Down Expand Up @@ -263,18 +249,10 @@ static void select_row(uint8_t row) {
default: break;
}

tca9555_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT);
if (tca9555_status) goto out;
tca9555_status = i2c_write(OREGP0, I2C_TIMEOUT);
if (tca9555_status) goto out;
tca9555_status = i2c_write(port0, I2C_TIMEOUT);
if (tca9555_status) goto out;
tca9555_status = i2c_write(port1, I2C_TIMEOUT);
if (tca9555_status) goto out;
uint8_t ports[2] = {port0, port1};
tca9555_status = i2c_writeReg(I2C_ADDR, OREGP0, ports, 2, I2C_TIMEOUT);
// 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.
// 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.
out:
i2c_stop();
}
}
}
Loading

0 comments on commit de9c2fb

Please sign in to comment.