Move keyboard event handling into action.c

Since keyboard_layout.[ch] has gained more features, and handles more than just
filling out the keyboard report, move it to action.[ch] instead. I see no sane
way to separate the keyboard and mouse report filling, unless we want to loop
over key states twice, hence them being in the same file.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
Gergely Nagy
2016-12-15 18:32:28 +01:00
parent 440c6d8ca8
commit 39dd0df58c
8 changed files with 123 additions and 158 deletions

View File

@@ -1,3 +1,4 @@
#include "action.h"
#include "fsl_port.h"
#include "usb_api.h"
#include "usb_composite_device.h"
@@ -6,7 +7,6 @@
#include "fsl_i2c.h"
#include "i2c.h"
#include "i2c_addresses.h"
#include "keyboard_layout.h"
static usb_device_endpoint_struct_t UsbKeyboardEndpoints[USB_KEYBOARD_ENDPOINT_COUNT] = {{
USB_KEYBOARD_ENDPOINT_INDEX | (USB_IN << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
@@ -100,7 +100,7 @@ void UsbKeyboadTask(){
readLeftKeys(leftKeyStates);
fillKeyboardReport(&UsbKeyboardReport[newLayout], leftKeyStates, keyMatrix.keyStates);
HandleKeyboardEvents(&UsbKeyboardReport[newLayout], &UsbMouseReport, leftKeyStates, keyMatrix.keyStates);
// Change to the new layout in atomic operation (int copy). Even if
// the copy is not atomic itself, only single bit changes. So it can