Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
don’t disable interrupts for scan latency measurement
While disabling interrupts means we measure the scan latency and only the scan
latency, that measurement (≈100μs) is not representative for real-life scan
latency, where matrix scanning is often interrupted by interrupts (≈208μs).
  • Loading branch information
stapelberg committed May 8, 2021
1 parent 3900346 commit cae21f3
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions sources/kinx.c
Expand Up @@ -215,11 +215,6 @@ void kinx_scan(void) {
.keys = {KEY_NONE, KEY_NONE, KEY_NONE, KEY_NONE, KEY_NONE, KEY_NONE},
};


#ifdef MEASURE_SCAN_LATENCY
// Measure cycles for scan()
__asm volatile ("cpsid i"); // disable interrupts
#endif
DWT->CYCCNT = 0;

int row, col, keynum = 0;
Expand Down Expand Up @@ -301,7 +296,6 @@ void kinx_scan(void) {

#ifdef MEASURE_SCAN_LATENCY
const uint32_t scan_cycles = DWT->CYCCNT;
__asm volatile ("cpsie i"); // re-enable interrupts

if (scan_cycles > longest_scan_cycles) {
longest_scan_cycles = scan_cycles;
Expand Down

0 comments on commit cae21f3

Please sign in to comment.