Instead of scanning the keyboard matrix from the main loop and utilizing busy loops, try to use a PIT interrupt handler to do the same thing, scanning one row per interrupt call without busy loops.

For some reason, this makes the movement of the mouse pointer very slow and makes it jump from time to time, so I ended up adding INTERRUPT_KEY_SCANNER and disabling the timer interrupt.
Also double bufferred the mouse report just like the others. Unfortunately this does not affect this issue.
This commit is contained in:
László Monda
2017-11-02 01:11:41 +01:00
parent 024f24f489
commit 00dfd96d55
15 changed files with 157 additions and 43 deletions

21
right/src/key_scanner.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef __KEY_SCANNER_H__
#define __KEY_SCANNER_H__
// Includes:
#include "key_matrix_instance.h"
// Macros:
#define KEY_SCANNER_INTERVAL_USEC (1000 / KEYBOARD_MATRIX_ROWS_NUM)
#define PIT_KEY_SCANNER_HANDLER PIT1_IRQHandler
#define PIT_KEY_SCANNER_IRQ_ID PIT1_IRQn
#define PIT_KEY_SCANNER_CHANNEL kPIT_Chnl_1
#define PIT_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_BusClk)
// Functions:
void InitKeyScanner(void);
#endif