mirror of
https://xff.cz/git/pinephone-keyboard/
synced 2024-11-09 22:15:42 +01:00
Allow to switch to bootloader mode via FN+PINE+F
This commit is contained in:
parent
8a6af7acf7
commit
e59f647d83
1 changed files with 7 additions and 17 deletions
|
@ -214,7 +214,6 @@ static uint8_t i2c_addr = 0;
|
||||||
static uint8_t i2c_regs[I2C_N_REGS] = {0xaa, 0x55};
|
static uint8_t i2c_regs[I2C_N_REGS] = {0xaa, 0x55};
|
||||||
static uint8_t i2c_cmd[I2C_N_REGS];
|
static uint8_t i2c_cmd[I2C_N_REGS];
|
||||||
static uint8_t i2c_cmd_len = 0;
|
static uint8_t i2c_cmd_len = 0;
|
||||||
static uint8_t go_boot = 0;
|
|
||||||
|
|
||||||
void i2c_b_interupt(void) __interrupt(IRQ_I2CB)
|
void i2c_b_interupt(void) __interrupt(IRQ_I2CB)
|
||||||
{
|
{
|
||||||
|
@ -239,15 +238,6 @@ void i2c_b_interupt(void) __interrupt(IRQ_I2CB)
|
||||||
if (i2c_cmd_len < 16)
|
if (i2c_cmd_len < 16)
|
||||||
i2c_cmd[i2c_cmd_len++] = tmp;
|
i2c_cmd[i2c_cmd_len++] = tmp;
|
||||||
|
|
||||||
if (i2c_cmd_len) {
|
|
||||||
if (i2c_cmd[0] == 0xa0)
|
|
||||||
ext_int_assert();
|
|
||||||
else if (i2c_cmd[0] == 0xa1)
|
|
||||||
ext_int_deassert();
|
|
||||||
else if (i2c_cmd[0] == 0xa2)
|
|
||||||
go_boot = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
PAGESW = 0;
|
PAGESW = 0;
|
||||||
|
|
||||||
P0_I2CBCR1 &= ~BIT(7); // clear data pending
|
P0_I2CBCR1 &= ~BIT(7); // clear data pending
|
||||||
|
@ -359,13 +349,6 @@ void main(void)
|
||||||
|
|
||||||
keyscan_idle();
|
keyscan_idle();
|
||||||
while (1) {
|
while (1) {
|
||||||
if (go_boot) {
|
|
||||||
EA = 0;
|
|
||||||
__asm__("mov r6,#0x5a");
|
|
||||||
__asm__("mov r7,#0xe7");
|
|
||||||
__asm__("ljmp 0x0118");
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -377,6 +360,13 @@ void main(void)
|
||||||
//__asm__("nop");
|
//__asm__("nop");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i2c_regs[4 + 0] & BIT(2) && i2c_regs[4 + 2] & BIT(5) && i2c_regs[4 + 4] & BIT(2)) {
|
||||||
|
EA = 0;
|
||||||
|
__asm__("mov r6,#0x5a");
|
||||||
|
__asm__("mov r7,#0xe7");
|
||||||
|
__asm__("ljmp 0x0118");
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue