Remove the key scanning interrupt
This commit is contained in:
@@ -65,7 +65,6 @@ static void initInterruptPriorities(void)
|
||||
NVIC_SetPriority(PIT_I2C_WATCHDOG_IRQ_ID, 1);
|
||||
NVIC_SetPriority(I2C_EEPROM_BUS_IRQ_ID, 0);
|
||||
NVIC_SetPriority(PIT_TIMER_IRQ_ID, 3);
|
||||
NVIC_SetPriority(PIT_KEY_SCANNER_IRQ_ID, 4);
|
||||
NVIC_SetPriority(I2C_MAIN_BUS_IRQ_ID, 4);
|
||||
NVIC_SetPriority(USB_IRQ_ID, 4);
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#include "fsl_pit.h"
|
||||
#include "key_scanner.h"
|
||||
|
||||
uint32_t KeyScannerCounter;
|
||||
|
||||
void PIT_KEY_SCANNER_HANDLER(void)
|
||||
{
|
||||
KeyMatrix_ScanRow(&RightKeyMatrix);
|
||||
KeyScannerCounter++;
|
||||
PIT_ClearStatusFlags(PIT, PIT_KEY_SCANNER_CHANNEL, PIT_TFLG_TIF_MASK);
|
||||
}
|
||||
|
||||
void InitKeyScanner(void)
|
||||
{
|
||||
pit_config_t pitConfig;
|
||||
PIT_GetDefaultConfig(&pitConfig);
|
||||
PIT_Init(PIT, &pitConfig);
|
||||
PIT_SetTimerPeriod(PIT, PIT_KEY_SCANNER_CHANNEL, USEC_TO_COUNT(KEY_SCANNER_INTERVAL_USEC, PIT_SOURCE_CLOCK));
|
||||
PIT_EnableInterrupts(PIT, PIT_KEY_SCANNER_CHANNEL, kPIT_TimerInterruptEnable);
|
||||
EnableIRQ(PIT_KEY_SCANNER_IRQ_ID);
|
||||
PIT_StartTimer(PIT, PIT_KEY_SCANNER_CHANNEL);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef __KEY_SCANNER_H__
|
||||
#define __KEY_SCANNER_H__
|
||||
|
||||
// Includes:
|
||||
|
||||
#include "peripherals/pit.h"
|
||||
#include "right_key_matrix.h"
|
||||
|
||||
// Macros:
|
||||
|
||||
#define KEY_SCANNER_INTERVAL_USEC (1000 / RIGHT_KEY_MATRIX_ROWS_NUM)
|
||||
|
||||
// Variables:
|
||||
|
||||
extern uint32_t KeyScannerCounter;
|
||||
|
||||
// Functions:
|
||||
|
||||
void InitKeyScanner(void);
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "bus_pal_hardware.h"
|
||||
#include "command.h"
|
||||
#include "eeprom.h"
|
||||
#include "key_scanner.h"
|
||||
#include "right_key_matrix.h"
|
||||
#include "usb_commands/usb_command_apply_config.h"
|
||||
#include "peripherals/reset_button.h"
|
||||
#include "config_parser/config_globals.h"
|
||||
@@ -44,7 +44,6 @@ int main(void)
|
||||
} else {
|
||||
InitSlaveScheduler();
|
||||
KeyMatrix_Init(&RightKeyMatrix);
|
||||
InitKeyScanner();
|
||||
InitUsb();
|
||||
|
||||
while (1) {
|
||||
@@ -52,6 +51,8 @@ int main(void)
|
||||
UsbCommand_ApplyConfig();
|
||||
IsConfigInitialized = true;
|
||||
}
|
||||
KeyMatrix_ScanRow(&RightKeyMatrix);
|
||||
++MatrixScanCounter;
|
||||
UpdateUsbReports();
|
||||
__WFI();
|
||||
}
|
||||
|
||||
@@ -17,8 +17,4 @@
|
||||
#define PIT_TIMER_IRQ_ID PIT1_IRQn
|
||||
#define PIT_TIMER_CHANNEL kPIT_Chnl_1
|
||||
|
||||
#define PIT_KEY_SCANNER_HANDLER PIT2_IRQHandler
|
||||
#define PIT_KEY_SCANNER_IRQ_ID PIT2_IRQn
|
||||
#define PIT_KEY_SCANNER_CHANNEL kPIT_Chnl_2
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "right_key_matrix.h"
|
||||
|
||||
uint32_t MatrixScanCounter;
|
||||
|
||||
key_matrix_t RightKeyMatrix = {
|
||||
.colNum = RIGHT_KEY_MATRIX_COLS_NUM,
|
||||
.rowNum = RIGHT_KEY_MATRIX_ROWS_NUM,
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
// Variables:
|
||||
|
||||
extern key_matrix_t RightKeyMatrix;
|
||||
extern uint32_t MatrixScanCounter;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "i2c_watchdog.h"
|
||||
#include "buffer.h"
|
||||
#include "timer.h"
|
||||
#include "key_scanner.h"
|
||||
#include "right_key_matrix.h"
|
||||
#include "usb_report_updater.h"
|
||||
#include "usb_interfaces/usb_interface_basic_keyboard.h"
|
||||
#include "usb_interfaces/usb_interface_media_keyboard.h"
|
||||
@@ -20,7 +20,7 @@ void UsbCommand_GetDebugBuffer(void)
|
||||
SetDebugBufferUint32(5, I2cSlaveScheduler_Counter);
|
||||
SetDebugBufferUint32(9, I2cWatchdog_WatchCounter);
|
||||
SetDebugBufferUint32(13, I2cWatchdog_RecoveryCounter);
|
||||
SetDebugBufferUint32(17, KeyScannerCounter);
|
||||
SetDebugBufferUint32(17, MatrixScanCounter);
|
||||
SetDebugBufferUint32(21, UsbReportUpdateCounter);
|
||||
SetDebugBufferUint32(25, Timer_GetCurrentTime());
|
||||
SetDebugBufferUint32(29, UsbGenericHidActionCounter);
|
||||
|
||||
Reference in New Issue
Block a user