8 Commits

Author SHA1 Message Date
László Monda
3196abe574 Bump firmware version to 8.4.5, update changelog, package.json and versions.h 2018-08-21 21:56:41 +02:00
László Monda
5f0bae1840 Merge branch 'layer-cache' 2018-08-21 16:11:07 +02:00
László Monda
c3a38c8b59 Split the point to point that features Agent installation and running the external tool. 2018-08-21 04:21:06 +02:00
László Monda
1f9d31cad4 Update build instructions. 2018-08-21 04:18:54 +02:00
László Monda
b89de6655e Upgrade to the latest MCUXpresso IDE. 2018-08-21 03:50:30 +02:00
Eric Tang
4a1b747197 Implement a layer cache 2018-08-19 11:28:28 -07:00
László Monda
eca87d2f62 Merge pull request #159 from UltimateHackingKeyboard/suppress-keys
Suppress pressed keys when the layer or keymap changes
2018-08-19 05:00:10 +02:00
Eric Tang
2e2b9d08a9 Suppress pressed keys when the layer or keymap changes 2018-08-18 19:52:07 -07:00
9 changed files with 37 additions and 26 deletions

View File

@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to the [UHK Versioning](VERSIONING.md) conventions.
## [8.4.5] - 2018-08-21
Device Protocol: 4.4.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
- Suppress pressed keys when the layer or keymap changes.
## [8.4.4] - 2018-08-14
Device Protocol: 4.4.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0

View File

@@ -12,19 +12,15 @@ If you're one of the brave few who wants to hack the firmware then read on.
`git clone --recursive git@github.com:UltimateHackingKeyboard/firmware.git`
2. Download and install MCUXpresso IDE for [Linux](https://storage.googleapis.com/ugl-static/mcuxpresso-ide/mcuxpressoide-10.1.1_606.x86_64.deb.bin), [Mac](https://storage.googleapis.com/ugl-static/mcuxpresso-ide/MCUXpressoIDE_10.1.1_606.pkg), or [Windows](https://storage.googleapis.com/ugl-static/mcuxpresso-ide/MCUXpressoIDE_10.1.1_606.exe).
2. Download and install MCUXpresso IDE for [Linux](https://storage.googleapis.com/ugl-static/mcuxpresso-ide/mcuxpressoide-10.2.1_795.x86_64.deb.bin), [Mac](https://storage.googleapis.com/ugl-static/mcuxpresso-ide/MCUXpressoIDE_10.2.1_795.pkg), or [Windows](https://storage.googleapis.com/ugl-static/mcuxpresso-ide/MCUXpressoIDE_10.2.1_795.exe).
3. In the IDE, import the project by invoking *File -> Import -> General -> Existing Projects into Workspace*, select the *left* or *right* directory depending on the desired firmware, then click on the *Finish* button.
## Building and flashing the firmware
4. In order to be able to flash the firmware via USB from the IDE, you must build [Agent](https://github.com/UltimateHackingKeyboard/agent) which is Git submodule of the this repo and located in the `lib/agent` directory.
For the left keyboard half, make sure to power it via the right keyboard half (which must be powered via USB). Also connect the left keyboard half to your SEGGER J-Link USB debug probe (which must also be connected via USB). Then in KDS, click on *Run -> Run Configurations*, select *GDB SEGGER J-Link Debugging -> uhk60-left_release_jlink*, and click on the *Debug* button.
5. Finally, in the IDE, click on *Run -> External Tools -> External Tools Configurations*, then select a release firmware to be flashed such as *uhk60-right_release_kboot*, and click on the *Run* button.
For the right keyboard half, flash [the bootloader](https://github.com/UltimateHackingKeyboard/bootloader) first.
At this point, you can flash the right firmware via USB from KDS. To achieve this, you must build [Agent](https://github.com/UltimateHackingKeyboard/agent) that is Git submodule of the this repo and located in the `lib/agent` directory. Then in KDS, click on *Run -> Run Configurations*, select *C/C++ Application -> uhk60-right_release_kboot*, and click on the *Run* button.
From this point on, you can upgrade the firmwares of both halves via USB by using the uhk60-left_release_kboot and uhk60-right_release_kboot run configurations. Alternatively, you can use your SEGGER J-Link probe.
Going forward, it's easier to flash the firmware of your choice by using the downwards toolbar icon which is located rightwards of the *green play + toolbox icon*.
## Contributing

View File

@@ -5,6 +5,7 @@
#include "config_parser/parse_keymap.h"
#include "config_parser/config_globals.h"
#include "macros.h"
#include "usb_report_updater.h"
keymap_reference_t AllKeymaps[MAX_KEYMAP_NUM] = {
{
@@ -24,6 +25,7 @@ void SwitchKeymapById(uint8_t index)
ValidatedUserConfigBuffer.offset = AllKeymaps[index].offset;
ParseKeymap(&ValidatedUserConfigBuffer, index, AllKeymapsCount, AllMacrosCount);
LedDisplay_UpdateText();
KeymapChanged = true;
}
bool SwitchKeymapByAbbreviation(uint8_t length, char *abbrev)

View File

@@ -15,7 +15,7 @@ void updateLayerStates(void)
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
key_state_t *keyState = &KeyStates[slotId][keyId];
if (keyState->current) {
if (keyState->current && !keyState->suppressed) {
key_action_t action = CurrentKeymap[LayerId_Base][slotId][keyId];
if (action.type == KeyActionType_SwitchLayer) {
if (action.switchLayer.mode != SwitchLayerMode_Toggle) {

View File

@@ -25,6 +25,8 @@ static uint16_t DoubleTapSwitchLayerReleaseTimeout = 200;
static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT];
bool TestUsbStack = false;
bool KeymapChanged = false;
static uint8_t layerCache[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
volatile uint8_t UsbReportUpdateSemaphore = 0;
@@ -333,7 +335,8 @@ static void updateActiveUsbReports(void)
if (layerChanged) {
stickyModifiers = 0;
}
bool layerGotReleased = layerChanged && activeLayer == LayerId_Base;
bool keymapChangedLastCycle = KeymapChanged;
KeymapChanged = false;
LedDisplay_SetLayer(activeLayer);
if (TestUsbStack) {
@@ -358,7 +361,7 @@ static void updateActiveUsbReports(void)
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
key_state_t *keyState = &KeyStates[slotId][keyId];
key_action_t *action = &CurrentKeymap[activeLayer][slotId][keyId];
key_action_t *action;
if (keyState->debouncing) {
if ((uint8_t)(Timer_GetCurrentTime() - keyState->timestamp) > (keyState->previous ? DebounceTimePress : DebounceTimeRelease)) {
@@ -371,19 +374,24 @@ static void updateActiveUsbReports(void)
keyState->debouncing = true;
}
if (keyState->current) {
if (SleepModeActive && !keyState->previous) {
if (keyState->current && !keyState->previous) {
if (SleepModeActive) {
WakeUpHost();
}
key_action_t *baseAction = &CurrentKeymap[LayerId_Base][slotId][keyId];
if (layerGotReleased && !(baseAction->type == KeyActionType_Keystroke && baseAction->keystroke.scancode == 0 && baseAction->keystroke.modifiers)) {
keyState->suppressed = true;
}
// Trigger secondary role.
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Pressed) {
if (secondaryRoleState == SecondaryRoleState_Pressed) {
// Trigger secondary role.
secondaryRoleState = SecondaryRoleState_Triggered;
keyState->current = false;
} else {
layerCache[slotId][keyId] = activeLayer;
}
}
action = &CurrentKeymap[layerCache[slotId][keyId]][slotId][keyId];
if (keyState->current) {
if ((KeymapChanged || keymapChangedLastCycle) && keyState->previous) {
keyState->suppressed = true;
} else if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) {
// Press released secondary role key.
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) {
@@ -397,9 +405,7 @@ static void updateActiveUsbReports(void)
applyKeyAction(keyState, action);
}
} else {
if (keyState->suppressed) {
keyState->suppressed = false;
}
keyState->suppressed = false;
// Release secondary role key.
if (keyState->previous && secondaryRoleSlotId == slotId && secondaryRoleKeyId == keyId) {

View File

@@ -72,6 +72,7 @@
extern uint32_t UsbReportUpdateCounter;
extern volatile uint8_t UsbReportUpdateSemaphore;
extern bool TestUsbStack;
extern bool KeymapChanged;
// Functions:

View File

@@ -15,7 +15,7 @@
"commander": "^2.11.0",
"shelljs": "^0.7.8"
},
"firmwareVersion": "8.4.4",
"firmwareVersion": "8.4.5",
"deviceProtocolVersion": "4.4.0",
"moduleProtocolVersion": "4.0.0",
"userConfigVersion": "4.1.0",

View File

@@ -20,7 +20,7 @@
#define FIRMWARE_MAJOR_VERSION 8
#define FIRMWARE_MINOR_VERSION 4
#define FIRMWARE_PATCH_VERSION 4
#define FIRMWARE_PATCH_VERSION 5
#define DEVICE_PROTOCOL_MAJOR_VERSION 4
#define DEVICE_PROTOCOL_MINOR_VERSION 4