void EMSCRIPTEN_KEEPALIVE keypad_key_event(unsigned int row, unsigned int col, bool press) { if (row == 2 && col == 0) { intrpt_set(INT_ON, press); if (press && calc_is_off()) { asic.ship_mode_enabled = false; control.readBatteryStatus = ~1; intrpt_pulse(19); } } else { if (press) { keypad.key_map[row] |= 1 << col; if (keypad.mode == 1) { keypad.status |= 4; keypad_intrpt_check(); } } else { keypad.data[row] = keypad.key_map[row] &= ~(1 << col); keypad.status |= 2; keypad_intrpt_check(); } } }
void keypad_key_event(unsigned int row, unsigned int col, bool press) { if (row == 2 && col == 0) { intrpt_set(INT_ON, press); if (press && control.ports[0] & 0x40) { control.readBatteryStatus = ~1; intrpt_pulse(19); } } else { if (press) { keypad.key_map[row] |= 1 << col; if (keypad.mode == 1) { keypad.status |= 4; keypad_intrpt_check(); } } else { keypad.key_map[row] &= ~(1 << col); } } }
void QtKeypadBridge::keyEvent(QKeyEvent *event, bool press) { Qt::Key key = static_cast<Qt::Key>(event->key()); auto& keymap = keymap_tp; for(unsigned int row = 0; row < sizeof(keymap)/sizeof(*keymap); ++row) { for(unsigned int col = 0; col < sizeof(*keymap)/sizeof(**keymap); ++col) { for(unsigned int index = 0; index < sizeof((**keymap).key)/sizeof(*(**keymap).key); ++index) { if(key == keymap[row][col].key[index] && keymap[row][col].alt == (bool(event->modifiers() & Qt::AltModifier) || bool(event->modifiers() & Qt::MetaModifier))) { keypad_key_event(row, col, press); notifyKeypadStateChanged(row, col, press); return; } } } } keypad.gpio_enable |= 0x800; keypad_intrpt_check(); }