forked from mirrors/qmk_userspace
[Test] Reset timer for every unit test and provide timestamps for log messages (#17028)
This commit is contained in:
parent
e2ab98f960
commit
962e4c0e18
20 changed files with 1011 additions and 41 deletions
|
@ -16,6 +16,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include "keycode_util.hpp"
|
||||
extern "C" {
|
||||
#include "keyboard.h"
|
||||
#include "test_matrix.h"
|
||||
|
@ -26,8 +29,13 @@ extern "C" {
|
|||
typedef uint8_t layer_t;
|
||||
|
||||
struct KeymapKey {
|
||||
KeymapKey(layer_t layer, uint8_t col, uint8_t row, uint16_t keycode) : layer(layer), position({.col = col, .row = row}), code(keycode), report_code(keycode) { validate(); }
|
||||
KeymapKey(layer_t layer, uint8_t col, uint8_t row, uint16_t keycode, uint16_t report_code) : layer(layer), position({.col = col, .row = row}), code(keycode), report_code(report_code) { validate(); }
|
||||
KeymapKey(layer_t layer, uint8_t col, uint8_t row, uint16_t keycode) : layer(layer), position({.col = col, .row = row}), code(keycode), report_code(keycode), name(get_keycode_identifier_or_default(keycode)) {
|
||||
validate();
|
||||
}
|
||||
|
||||
KeymapKey(layer_t layer, uint8_t col, uint8_t row, uint16_t keycode, uint16_t report_code) : layer(layer), position({.col = col, .row = row}), code(keycode), report_code(report_code), name{get_keycode_identifier_or_default(keycode)} {
|
||||
validate();
|
||||
}
|
||||
|
||||
void press();
|
||||
void release();
|
||||
|
@ -35,6 +43,7 @@ struct KeymapKey {
|
|||
const layer_t layer;
|
||||
const keypos_t position;
|
||||
const uint16_t code;
|
||||
std::string name;
|
||||
/* Sometimes the keycode does not match the code that is send in the usb report, so we provide it here. */
|
||||
const uint16_t report_code;
|
||||
|
||||
|
@ -43,4 +52,5 @@ struct KeymapKey {
|
|||
assert(position.col <= MATRIX_COLS);
|
||||
assert(position.row <= MATRIX_ROWS);
|
||||
}
|
||||
};
|
||||
uint32_t timestamp_pressed;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue