 
     for (uint8_t i = 0; i != KEYPAD_NUM_ROWS_COLS ; i++) {
         digitalWrite(KEYPAD_COL_PIN_BASE + i, LOW);
-        for (uint8_t j = 0; j != KEYPAD_NUM_ROWS_COLS ; j++)
-            if (!digitalRead(KEYPAD_ROW_PIN_BASE + j))
-                // TODO Handle multibutton presses
+        for (uint8_t j = 0; j != KEYPAD_NUM_ROWS_COLS ; j++) {
+            uint16_t bitmask = (1 << (i * 4 + j));
+            if (has_press(j) && !was_pressed(bitmask))
                 queue_key(buttons[i][j]);
+            buttons_held ^= bitmask;
+        }
         digitalWrite(KEYPAD_COL_PIN_BASE + i, HIGH);
     }
 

    presses[tail] = key;
}

void handle_interrupt(void) {
    noInterrupts();
    if (action_function == NULL) {

    {'*', '0', '#', 'D'}
};

uint16_t buttons_held = 0;

static inline char dequeue_key(void) {
    if (head == tail)
        return '\0';
