mirror of
https://xff.cz/git/pinephone-keyboard
synced 2024-12-22 12:58:48 -05:00
Fix key release change detection in polling mode
This commit is contained in:
parent
93687e1b04
commit
c8d8eef090
@ -80,6 +80,8 @@ void timer1_interupt(void) __interrupt(IRQ_TIMER1)
|
|||||||
TF1 = 0;
|
TF1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// {{{ Key scanning
|
||||||
|
|
||||||
// Keyboard has 12 columns and 6 rows directly connected to GPIOs.
|
// Keyboard has 12 columns and 6 rows directly connected to GPIOs.
|
||||||
//
|
//
|
||||||
// C1 P95
|
// C1 P95
|
||||||
@ -262,6 +264,9 @@ void ext_int_deassert(void)
|
|||||||
P1_P9M0 |= BIT(0);
|
P1_P9M0 |= BIT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
// {{{ I2C
|
||||||
|
|
||||||
#define I2C_N_REGS 16
|
#define I2C_N_REGS 16
|
||||||
|
|
||||||
static uint8_t i2c_transfer = 0x00;
|
static uint8_t i2c_transfer = 0x00;
|
||||||
@ -427,10 +432,10 @@ void main(void)
|
|||||||
run_tasks = 0;
|
run_tasks = 0;
|
||||||
|
|
||||||
#if POLL_INPUT
|
#if POLL_INPUT
|
||||||
// every 10ms we will scan the keyboard keys state and check for changes
|
// every 20ms we will scan the keyboard keys state and check for changes
|
||||||
uint8_t keys[12];
|
uint8_t keys[12];
|
||||||
uint8_t active_rows = keyscan_scan(keys);
|
uint8_t active_rows = keyscan_scan(keys);
|
||||||
if (active_rows) {
|
|
||||||
// pressing FN+PINE+F switches to flashing mode (keys 1:2 3:5 5:2, electrically)
|
// pressing FN+PINE+F switches to flashing mode (keys 1:2 3:5 5:2, electrically)
|
||||||
if (keys[0] & BIT(2) && keys[2] & BIT(5) && keys[4] & BIT(2)) {
|
if (keys[0] & BIT(2) && keys[2] & BIT(5) && keys[4] & BIT(2)) {
|
||||||
EA = 0;
|
EA = 0;
|
||||||
@ -448,9 +453,8 @@ void main(void)
|
|||||||
ext_int_assert();
|
ext_int_assert();
|
||||||
delay_us(100);
|
delay_us(100);
|
||||||
ext_int_deassert();
|
ext_int_deassert();
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
//XXX: not figured out yet, not tested, not working
|
||||||
if (scan_active) {
|
if (scan_active) {
|
||||||
uint8_t active_rows = keyscan_scan(i2c_regs + 4);
|
uint8_t active_rows = keyscan_scan(i2c_regs + 4);
|
||||||
if (!active_rows) {
|
if (!active_rows) {
|
||||||
|
Loading…
Reference in New Issue
Block a user