Compare commits
27 Commits
v8.4.1
...
semaphore-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aeaef7b788 | ||
|
|
b4c2204e50 | ||
|
|
4c0546de6c | ||
|
|
bea4c34a51 | ||
|
|
bdc6232780 | ||
|
|
1d2d1c5049 | ||
|
|
67f07abd0d | ||
|
|
4bfcd6e02c | ||
|
|
7eb190489b | ||
|
|
640c034111 | ||
|
|
a6f12848ed | ||
|
|
47f6a27e48 | ||
|
|
9cc383a91d | ||
|
|
a441cdf5d2 | ||
|
|
8297dd5c48 | ||
|
|
225a481938 | ||
|
|
5572952dc8 | ||
|
|
7d011237f8 | ||
|
|
1a47c6e629 | ||
|
|
047a232e7e | ||
|
|
28f5999cbb | ||
|
|
fe7505a2df | ||
|
|
b6ac16074c | ||
|
|
0bf205c5d2 | ||
|
|
e4a99a9400 | ||
|
|
1e9b5833eb | ||
|
|
79b052fca7 |
20
CHANGELOG.md
20
CHANGELOG.md
@@ -5,6 +5,25 @@ 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.4] - 2018-08-14
|
||||
|
||||
Device Protocol: 4.4.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Don't wake the host if a key is held down through the beginning of sleep.
|
||||
- Ensure that secondary roles are triggered consistently.
|
||||
|
||||
## [8.4.3] - 2018-08-12
|
||||
|
||||
Device Protocol: 4.4.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Compensate "double tap to lock layer" timeouts for the timer fix to make them as long as before 8.3.3
|
||||
|
||||
## [8.4.2] - 2018-08-02
|
||||
|
||||
Device Protocol: 4.4.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Fix various bugs related to secondary role handling and sticky modifier states.
|
||||
|
||||
## [8.4.1] - 2018-07-31
|
||||
|
||||
Device Protocol: 4.4.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
||||
@@ -26,6 +45,7 @@ Device Protocol: 4.**4.0** | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardw
|
||||
Device Protocol: 4.3.1 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Implement the macro engine.
|
||||
- Fix the timer which makes it tick twice as fast as before.
|
||||
- Fix the nondeterministic bug that made USB hang.
|
||||
- Restore the Windows related commits of firmware 8.3.1 because the USB hang bug has been fixed.
|
||||
- Restore debouncing to 100ms until it gets really fixed.
|
||||
|
||||
@@ -44,7 +44,8 @@ SOURCE = $(wildcard src/*.c) \
|
||||
../lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_lptmr.c \
|
||||
../lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_spi.c \
|
||||
../lib/KSDK_2.0_MKL03Z8xxx4/devices/MKL03Z4/drivers/fsl_tpm.c \
|
||||
$(wildcard ../shared/*.c)
|
||||
$(wildcard ../shared/*.c) \
|
||||
$(wildcard ../shared/slave/*.c)
|
||||
|
||||
# Header files.
|
||||
IPATH = src \
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef __CONFIG_H__
|
||||
#define __CONFIG_H__
|
||||
|
||||
// Macros:
|
||||
|
||||
#define I2C_WATCHDOG_VALUE_REINIT 1
|
||||
#define I2C_WATCHDOG_VALUE_REBOOT 2
|
||||
|
||||
// #define DEBUG_OVER_SPI
|
||||
#define I2C_WATCHDOG I2C_WATCHDOG_VALUE_REINIT
|
||||
// #define I2C_WATCHDOG I2C_WATCHDOG_VALUE_REBOOT
|
||||
|
||||
#endif
|
||||
@@ -1,56 +0,0 @@
|
||||
#ifdef DEBUG_OVER_SPI
|
||||
|
||||
#include "debug_over_spi.h"
|
||||
#include "config.h"
|
||||
#include "fsl_gpio.h"
|
||||
|
||||
|
||||
#define EXAMPLE_SPI_MASTER (SPI0)
|
||||
#define EXAMPLE_SPI_MASTER_SOURCE_CLOCK (kCLOCK_BusClk)
|
||||
|
||||
#define BUFFER_SIZE (64)
|
||||
static uint8_t srcBuff[BUFFER_SIZE];
|
||||
|
||||
static spi_transfer_t xfer = {0};
|
||||
static spi_master_config_t userConfig;
|
||||
spi_master_handle_t handle;
|
||||
|
||||
static volatile bool masterFinished = true;
|
||||
|
||||
static void masterCallback(SPI_Type *base, spi_master_handle_t *masterHandle, status_t status, void *userData)
|
||||
{
|
||||
masterFinished = true;
|
||||
}
|
||||
|
||||
void DebugOverSpi_Init(void)
|
||||
{
|
||||
CLOCK_EnableClock(DEBUG_OVER_SPI_MOSI_CLOCK);
|
||||
CLOCK_EnableClock(DEBUG_OVER_SPI_SCK_CLOCK);
|
||||
|
||||
PORT_SetPinMux(DEBUG_OVER_SPI_MOSI_PORT, DEBUG_OVER_SPI_MOSI_PIN, kPORT_MuxAlt3);
|
||||
PORT_SetPinMux(DEBUG_OVER_SPI_SCK_PORT, DEBUG_OVER_SPI_SCK_PIN, kPORT_MuxAlt3);
|
||||
|
||||
GPIO_PinInit(DEBUG_OVER_SPI_MOSI_GPIO, DEBUG_OVER_SPI_MOSI_PIN, &(gpio_pin_config_t){kGPIO_DigitalOutput, 0});
|
||||
GPIO_PinInit(DEBUG_OVER_SPI_SCK_GPIO, DEBUG_OVER_SPI_SCK_PIN, &(gpio_pin_config_t){kGPIO_DigitalOutput, 0});
|
||||
|
||||
GPIO_SetPinsOutput(DEBUG_OVER_SPI_MOSI_GPIO, 1U << DEBUG_OVER_SPI_MOSI_PIN);
|
||||
GPIO_SetPinsOutput(DEBUG_OVER_SPI_SCK_GPIO, 1U << DEBUG_OVER_SPI_SCK_PIN);
|
||||
|
||||
SPI_MasterGetDefaultConfig(&userConfig);
|
||||
uint32_t srcFreq = CLOCK_GetFreq(EXAMPLE_SPI_MASTER_SOURCE_CLOCK);
|
||||
SPI_MasterInit(EXAMPLE_SPI_MASTER, &userConfig, srcFreq);
|
||||
SPI_MasterTransferCreateHandle(EXAMPLE_SPI_MASTER, &handle, masterCallback, NULL);
|
||||
}
|
||||
|
||||
void DebugOverSpi_Send(uint8_t *tx, uint8_t len)
|
||||
{
|
||||
if (masterFinished) {
|
||||
masterFinished = false;
|
||||
memcpy(srcBuff, tx, MIN(BUFFER_SIZE, len));
|
||||
xfer.txData = srcBuff;
|
||||
xfer.dataSize = len;
|
||||
SPI_MasterTransferNonBlocking(EXAMPLE_SPI_MASTER, &handle, &xfer);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifdef DEBUG_OVER_SPI
|
||||
|
||||
#ifndef __DEBUG_OVER_SPI_H__
|
||||
#define __DEBUG_OVER_SPI_H__
|
||||
|
||||
// Includes:
|
||||
|
||||
#include "fsl_common.h"
|
||||
#include "fsl_port.h"
|
||||
#include "fsl_spi.h"
|
||||
|
||||
// Macros:
|
||||
|
||||
#define DEBUG_OVER_SPI_MOSI_PORT PORTA
|
||||
#define DEBUG_OVER_SPI_MOSI_GPIO GPIOA
|
||||
#define DEBUG_OVER_SPI_MOSI_CLOCK kCLOCK_PortA
|
||||
#define DEBUG_OVER_SPI_MOSI_PIN 7
|
||||
|
||||
#define DEBUG_OVER_SPI_SCK_PORT PORTB
|
||||
#define DEBUG_OVER_SPI_SCK_GPIO GPIOB
|
||||
#define DEBUG_OVER_SPI_SCK_CLOCK kCLOCK_PortB
|
||||
#define DEBUG_OVER_SPI_SCK_PIN 0
|
||||
|
||||
// Functions:
|
||||
|
||||
void DebugOverSpi_Init(void);
|
||||
void DebugOverSpi_Send(uint8_t *tx, uint8_t len);
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define DebugOverSpi_Init()
|
||||
#define DebugOverSpi_Send(tx, len)
|
||||
#endif
|
||||
@@ -3,40 +3,31 @@
|
||||
#include "i2c_watchdog.h"
|
||||
#include "test_led.h"
|
||||
#include "init_peripherals.h"
|
||||
#include "config.h"
|
||||
|
||||
/* NOTE: Because of a bug in the ROM bootloader of the KL03Z, the watchdog timer is disabled and cannot be re-enabled.
|
||||
* See https://community.nxp.com/thread/457893
|
||||
* Therefore the hardware watchdog timer cannot be used without an extra way to enter bootloader or application mode.
|
||||
*/
|
||||
#ifdef I2C_WATCHDOG
|
||||
// NOTE: Because of a bug in the ROM bootloader of the KL03Z, the watchdog timer is disabled and cannot be re-enabled.
|
||||
// See https://community.nxp.com/thread/457893
|
||||
// Therefore the hardware watchdog timer cannot be used without an extra way to enter bootloader or application mode.
|
||||
static uint32_t prevWatchdogCounter = 0;
|
||||
static uint32_t I2cWatchdog_RecoveryCounter; /* counter for how many times we had to recover and restart */
|
||||
static uint32_t I2cWatchdog_RecoveryCounter; // Counter for how many times we had to recover and restart
|
||||
|
||||
void RunWatchdog(void)
|
||||
{
|
||||
static volatile uint32_t I2cWatchdog_WatchCounter = 0; /* counter for timer */
|
||||
static int cntr = 0;
|
||||
static volatile uint32_t I2cWatchdog_WatchCounter = 0; // Counter for timer
|
||||
static int counter = 0;
|
||||
|
||||
cntr++;
|
||||
if (cntr==100) { /* we get called from KEY_SCANNER_HANDLER() which runs at 1ms, thus scaling down by 100 here to get 100 ms period */
|
||||
cntr=0;
|
||||
counter++;
|
||||
if (counter == 100) { // We get called from KEY_SCANNER_HANDLER() which runs at 1ms, thus scaling down by 100 here to get 100 ms period
|
||||
counter=0;
|
||||
TestLed_Toggle();
|
||||
I2cWatchdog_WatchCounter++;
|
||||
|
||||
if (I2cWatchdog_WatchCounter>10) { /* do not check within the first 1000 ms, as I2C might not be running yet */
|
||||
if (I2cWatchdog_WatchCounter > 10) { // Do not check within the first 1000 ms, as I2C might not be running yet
|
||||
if (I2C_Watchdog == prevWatchdogCounter) { // Restart I2C if there hasn't been any interrupt during 100 ms. I2C_Watchdog gets incremented for every I2C transaction
|
||||
I2cWatchdog_RecoveryCounter++;
|
||||
#if I2C_WATCHDOG == I2C_WATCHDOG_VALUE_REBOOT
|
||||
NVIC_SystemReset();
|
||||
#endif
|
||||
#if I2C_WATCHDOG == I2C_WATCHDOG_VALUE_REINIT
|
||||
I2C_SlaveDeinit(I2C_BUS_BASEADDR);
|
||||
initI2c();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
prevWatchdogCounter = I2C_Watchdog; /* remember previous counter */
|
||||
prevWatchdogCounter = I2C_Watchdog;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "led_pwm.h"
|
||||
#include "slave_protocol_handler.h"
|
||||
#include "i2c_watchdog.h"
|
||||
#include "debug_over_spi.h"
|
||||
#include "main.h"
|
||||
|
||||
i2c_slave_config_t slaveConfig;
|
||||
@@ -23,7 +22,6 @@ static void i2cSlaveCallback(I2C_Type *base, i2c_slave_transfer_t *xfer, void *u
|
||||
{
|
||||
dosBuffer[0] = xfer->event;
|
||||
dosBuffer[1] = userData;
|
||||
DebugOverSpi_Send(dosBuffer, 2);
|
||||
|
||||
switch (xfer->event) {
|
||||
case kI2C_SlaveTransmitEvent:
|
||||
@@ -86,6 +84,5 @@ void InitPeripherals(void)
|
||||
InitLedDriver();
|
||||
TestLed_Init();
|
||||
LedPwm_Init();
|
||||
DebugOverSpi_Init();
|
||||
initI2c();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "fsl_lptmr.h"
|
||||
#include "key_scanner.h"
|
||||
#include "config.h"
|
||||
#include "i2c_watchdog.h"
|
||||
|
||||
void KEY_SCANNER_HANDLER(void)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#include "main.h"
|
||||
#include "init_clock.h"
|
||||
#include "slave/init_clock.h"
|
||||
#include "init_peripherals.h"
|
||||
#include "bootloader.h"
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "key_scanner.h"
|
||||
|
||||
DEFINE_BOOTLOADER_CONFIG_AREA(I2C_ADDRESS_LEFT_KEYBOARD_HALF_BOOTLOADER)
|
||||
@@ -15,11 +14,7 @@ key_matrix_t keyMatrix = {
|
||||
{PORTB, GPIOB, kCLOCK_PortB, 11},
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 6},
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 8},
|
||||
#ifdef DEBUG_OVER_SPI
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 8},
|
||||
#else
|
||||
{PORTB, GPIOB, kCLOCK_PortB, 0},
|
||||
#endif
|
||||
{PORTB, GPIOB, kCLOCK_PortB, 6},
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 3},
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 12}
|
||||
@@ -28,11 +23,7 @@ key_matrix_t keyMatrix = {
|
||||
{PORTB, GPIOB, kCLOCK_PortB, 7},
|
||||
{PORTB, GPIOB, kCLOCK_PortB, 10},
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 5},
|
||||
#ifdef DEBUG_OVER_SPI
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 5},
|
||||
#else
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 7},
|
||||
#endif
|
||||
{PORTA, GPIOA, kCLOCK_PortA, 4}
|
||||
}
|
||||
};
|
||||
|
||||
Submodule lib/agent updated: fa32f95438...80e8c014ec
@@ -460,73 +460,73 @@
|
||||
<storageModule moduleId="com.crt.config">
|
||||
<projectStorage><?xml version="1.0" encoding="UTF-8"?>
|
||||
<TargetConfig>
|
||||
<Properties property_3="NXP" property_4="MK22FN512xxx12" property_count="5" version="70200"/>
|
||||
<Properties property_3="NXP" property_4="MK22FN512xxx12" property_count="5" version="100200"/>
|
||||
<infoList vendor="NXP"><info chip="MK22FN512xxx12" name="MK22FN512xxx12"><chip><name>MK22FN512xxx12</name>
|
||||
<family>K2x</family>
|
||||
<vendor>NXP</vendor>
|
||||
<memory can_program="true" id="Flash" is_ro="true" size="512" type="Flash"/>
|
||||
<memory id="RAM" size="128" type="RAM"/>
|
||||
<memoryInstance derived_from="Flash" driver="FTFA_2K.cfx" id="PROGRAM_FLASH" location="0x0" size="0x80000"/>
|
||||
<memoryInstance derived_from="RAM" id="SRAM_UPPER" location="0x20000000" size="0x10000"/>
|
||||
<memoryInstance derived_from="RAM" id="SRAM_LOWER" location="0x1fff0000" size="0x10000"/>
|
||||
<peripheralInstance derived_from="FTFA_FlashConfig" id="FTFA_FlashConfig" location="0x400"/>
|
||||
<peripheralInstance derived_from="DMA" id="DMA" location="0x40008000"/>
|
||||
<peripheralInstance derived_from="FB" id="FB" location="0x4000C000"/>
|
||||
<peripheralInstance derived_from="FMC" id="FMC" location="0x4001F000"/>
|
||||
<peripheralInstance derived_from="FTFA" id="FTFA" location="0x40020000"/>
|
||||
<peripheralInstance derived_from="DMAMUX" id="DMAMUX" location="0x40021000"/>
|
||||
<peripheralInstance derived_from="FTM0" id="FTM0" location="0x40038000"/>
|
||||
<peripheralInstance derived_from="FTM1" id="FTM1" location="0x40039000"/>
|
||||
<peripheralInstance derived_from="FTM2" id="FTM2" location="0x4003A000"/>
|
||||
<peripheralInstance derived_from="FTM3" id="FTM3" location="0x40026000"/>
|
||||
<peripheralInstance derived_from="ADC0" id="ADC0" location="0x4003B000"/>
|
||||
<peripheralInstance derived_from="ADC1" id="ADC1" location="0x40027000"/>
|
||||
<peripheralInstance derived_from="DAC0" id="DAC0" location="0x4003F000"/>
|
||||
<peripheralInstance derived_from="DAC1" id="DAC1" location="0x40028000"/>
|
||||
<peripheralInstance derived_from="RNG" id="RNG" location="0x40029000"/>
|
||||
<peripheralInstance derived_from="LPUART0" id="LPUART0" location="0x4002A000"/>
|
||||
<peripheralInstance derived_from="SPI0" id="SPI0" location="0x4002C000"/>
|
||||
<peripheralInstance derived_from="SPI1" id="SPI1" location="0x4002D000"/>
|
||||
<peripheralInstance derived_from="I2S0" id="I2S0" location="0x4002F000"/>
|
||||
<peripheralInstance derived_from="CRC" id="CRC" location="0x40032000"/>
|
||||
<peripheralInstance derived_from="PDB0" id="PDB0" location="0x40036000"/>
|
||||
<peripheralInstance derived_from="PIT" id="PIT" location="0x40037000"/>
|
||||
<peripheralInstance derived_from="RTC" id="RTC" location="0x4003D000"/>
|
||||
<peripheralInstance derived_from="RFVBAT" id="RFVBAT" location="0x4003E000"/>
|
||||
<peripheralInstance derived_from="LPTMR0" id="LPTMR0" location="0x40040000"/>
|
||||
<peripheralInstance derived_from="RFSYS" id="RFSYS" location="0x40041000"/>
|
||||
<peripheralInstance derived_from="SIM" id="SIM" location="0x40047000"/>
|
||||
<peripheralInstance derived_from="PORTA" id="PORTA" location="0x40049000"/>
|
||||
<peripheralInstance derived_from="PORTB" id="PORTB" location="0x4004A000"/>
|
||||
<peripheralInstance derived_from="PORTC" id="PORTC" location="0x4004B000"/>
|
||||
<peripheralInstance derived_from="PORTD" id="PORTD" location="0x4004C000"/>
|
||||
<peripheralInstance derived_from="PORTE" id="PORTE" location="0x4004D000"/>
|
||||
<peripheralInstance derived_from="WDOG" id="WDOG" location="0x40052000"/>
|
||||
<peripheralInstance derived_from="EWM" id="EWM" location="0x40061000"/>
|
||||
<peripheralInstance derived_from="MCG" id="MCG" location="0x40064000"/>
|
||||
<peripheralInstance derived_from="OSC" id="OSC" location="0x40065000"/>
|
||||
<peripheralInstance derived_from="I2C0" id="I2C0" location="0x40066000"/>
|
||||
<peripheralInstance derived_from="I2C1" id="I2C1" location="0x40067000"/>
|
||||
<peripheralInstance derived_from="UART0" id="UART0" location="0x4006A000"/>
|
||||
<peripheralInstance derived_from="UART1" id="UART1" location="0x4006B000"/>
|
||||
<peripheralInstance derived_from="UART2" id="UART2" location="0x4006C000"/>
|
||||
<peripheralInstance derived_from="USB0" id="USB0" location="0x40072000"/>
|
||||
<peripheralInstance derived_from="CMP0" id="CMP0" location="0x40073000"/>
|
||||
<peripheralInstance derived_from="CMP1" id="CMP1" location="0x40073008"/>
|
||||
<peripheralInstance derived_from="VREF" id="VREF" location="0x40074000"/>
|
||||
<peripheralInstance derived_from="LLWU" id="LLWU" location="0x4007C000"/>
|
||||
<peripheralInstance derived_from="PMC" id="PMC" location="0x4007D000"/>
|
||||
<peripheralInstance derived_from="SMC" id="SMC" location="0x4007E000"/>
|
||||
<peripheralInstance derived_from="RCM" id="RCM" location="0x4007F000"/>
|
||||
<peripheralInstance derived_from="GPIOA" id="GPIOA" location="0x400FF000"/>
|
||||
<peripheralInstance derived_from="GPIOB" id="GPIOB" location="0x400FF040"/>
|
||||
<peripheralInstance derived_from="GPIOC" id="GPIOC" location="0x400FF080"/>
|
||||
<peripheralInstance derived_from="GPIOD" id="GPIOD" location="0x400FF0C0"/>
|
||||
<peripheralInstance derived_from="GPIOE" id="GPIOE" location="0x400FF100"/>
|
||||
<peripheralInstance derived_from="SystemControl" id="SystemControl" location="0xE000E000"/>
|
||||
<peripheralInstance derived_from="SysTick" id="SysTick" location="0xE000E010"/>
|
||||
<peripheralInstance derived_from="NVIC" id="NVIC" location="0xE000E100"/>
|
||||
<peripheralInstance derived_from="MCM" id="MCM" location="0xE0080000"/>
|
||||
<memory can_program="true" id="Flash" is_ro="true" size="0" type="Flash"/>
|
||||
<memory id="RAM" size="0" type="RAM"/>
|
||||
<memoryInstance derived_from="Flash" driver="FTFA_2K.cfx" id="PROGRAM_FLASH" location="0x00000000" size="0x00080000"/>
|
||||
<memoryInstance derived_from="RAM" id="SRAM_UPPER" location="0x20000000" size="0x00010000"/>
|
||||
<memoryInstance derived_from="RAM" id="SRAM_LOWER" location="0x1fff0000" size="0x00010000"/>
|
||||
<peripheralInstance derived_from="FTFA-FlashConfig" determined="infoFile" id="FTFA-FlashConfig" location="0x400"/>
|
||||
<peripheralInstance derived_from="DMA" determined="infoFile" id="DMA" location="0x40008000"/>
|
||||
<peripheralInstance derived_from="FB" determined="infoFile" id="FB" location="0x4000C000"/>
|
||||
<peripheralInstance derived_from="FMC" determined="infoFile" id="FMC" location="0x4001F000"/>
|
||||
<peripheralInstance derived_from="FTFA" determined="infoFile" id="FTFA" location="0x40020000"/>
|
||||
<peripheralInstance derived_from="DMAMUX" determined="infoFile" id="DMAMUX" location="0x40021000"/>
|
||||
<peripheralInstance derived_from="FTM0" determined="infoFile" id="FTM0" location="0x40038000"/>
|
||||
<peripheralInstance derived_from="FTM1" determined="infoFile" id="FTM1" location="0x40039000"/>
|
||||
<peripheralInstance derived_from="FTM2" determined="infoFile" id="FTM2" location="0x4003A000"/>
|
||||
<peripheralInstance derived_from="FTM3" determined="infoFile" id="FTM3" location="0x40026000"/>
|
||||
<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x4003B000"/>
|
||||
<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x40027000"/>
|
||||
<peripheralInstance derived_from="DAC0" determined="infoFile" id="DAC0" location="0x4003F000"/>
|
||||
<peripheralInstance derived_from="DAC1" determined="infoFile" id="DAC1" location="0x40028000"/>
|
||||
<peripheralInstance derived_from="RNG" determined="infoFile" id="RNG" location="0x40029000"/>
|
||||
<peripheralInstance derived_from="LPUART0" determined="infoFile" id="LPUART0" location="0x4002A000"/>
|
||||
<peripheralInstance derived_from="SPI0" determined="infoFile" id="SPI0" location="0x4002C000"/>
|
||||
<peripheralInstance derived_from="SPI1" determined="infoFile" id="SPI1" location="0x4002D000"/>
|
||||
<peripheralInstance derived_from="I2S0" determined="infoFile" id="I2S0" location="0x4002F000"/>
|
||||
<peripheralInstance derived_from="CRC" determined="infoFile" id="CRC" location="0x40032000"/>
|
||||
<peripheralInstance derived_from="PDB0" determined="infoFile" id="PDB0" location="0x40036000"/>
|
||||
<peripheralInstance derived_from="PIT" determined="infoFile" id="PIT" location="0x40037000"/>
|
||||
<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x4003D000"/>
|
||||
<peripheralInstance derived_from="RFVBAT" determined="infoFile" id="RFVBAT" location="0x4003E000"/>
|
||||
<peripheralInstance derived_from="LPTMR0" determined="infoFile" id="LPTMR0" location="0x40040000"/>
|
||||
<peripheralInstance derived_from="RFSYS" determined="infoFile" id="RFSYS" location="0x40041000"/>
|
||||
<peripheralInstance derived_from="SIM" determined="infoFile" id="SIM" location="0x40047000"/>
|
||||
<peripheralInstance derived_from="PORTA" determined="infoFile" id="PORTA" location="0x40049000"/>
|
||||
<peripheralInstance derived_from="PORTB" determined="infoFile" id="PORTB" location="0x4004A000"/>
|
||||
<peripheralInstance derived_from="PORTC" determined="infoFile" id="PORTC" location="0x4004B000"/>
|
||||
<peripheralInstance derived_from="PORTD" determined="infoFile" id="PORTD" location="0x4004C000"/>
|
||||
<peripheralInstance derived_from="PORTE" determined="infoFile" id="PORTE" location="0x4004D000"/>
|
||||
<peripheralInstance derived_from="WDOG" determined="infoFile" id="WDOG" location="0x40052000"/>
|
||||
<peripheralInstance derived_from="EWM" determined="infoFile" id="EWM" location="0x40061000"/>
|
||||
<peripheralInstance derived_from="MCG" determined="infoFile" id="MCG" location="0x40064000"/>
|
||||
<peripheralInstance derived_from="OSC" determined="infoFile" id="OSC" location="0x40065000"/>
|
||||
<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x40066000"/>
|
||||
<peripheralInstance derived_from="I2C1" determined="infoFile" id="I2C1" location="0x40067000"/>
|
||||
<peripheralInstance derived_from="UART0" determined="infoFile" id="UART0" location="0x4006A000"/>
|
||||
<peripheralInstance derived_from="UART1" determined="infoFile" id="UART1" location="0x4006B000"/>
|
||||
<peripheralInstance derived_from="UART2" determined="infoFile" id="UART2" location="0x4006C000"/>
|
||||
<peripheralInstance derived_from="USB0" determined="infoFile" id="USB0" location="0x40072000"/>
|
||||
<peripheralInstance derived_from="CMP0" determined="infoFile" id="CMP0" location="0x40073000"/>
|
||||
<peripheralInstance derived_from="CMP1" determined="infoFile" id="CMP1" location="0x40073008"/>
|
||||
<peripheralInstance derived_from="VREF" determined="infoFile" id="VREF" location="0x40074000"/>
|
||||
<peripheralInstance derived_from="LLWU" determined="infoFile" id="LLWU" location="0x4007C000"/>
|
||||
<peripheralInstance derived_from="PMC" determined="infoFile" id="PMC" location="0x4007D000"/>
|
||||
<peripheralInstance derived_from="SMC" determined="infoFile" id="SMC" location="0x4007E000"/>
|
||||
<peripheralInstance derived_from="RCM" determined="infoFile" id="RCM" location="0x4007F000"/>
|
||||
<peripheralInstance derived_from="GPIOA" determined="infoFile" id="GPIOA" location="0x400FF000"/>
|
||||
<peripheralInstance derived_from="GPIOB" determined="infoFile" id="GPIOB" location="0x400FF040"/>
|
||||
<peripheralInstance derived_from="GPIOC" determined="infoFile" id="GPIOC" location="0x400FF080"/>
|
||||
<peripheralInstance derived_from="GPIOD" determined="infoFile" id="GPIOD" location="0x400FF0C0"/>
|
||||
<peripheralInstance derived_from="GPIOE" determined="infoFile" id="GPIOE" location="0x400FF100"/>
|
||||
<peripheralInstance derived_from="SystemControl" determined="infoFile" id="SystemControl" location="0xE000E000"/>
|
||||
<peripheralInstance derived_from="SysTick" determined="infoFile" id="SysTick" location="0xE000E010"/>
|
||||
<peripheralInstance derived_from="NVIC" determined="infoFile" id="NVIC" location="0xE000E100"/>
|
||||
<peripheralInstance derived_from="MCM" determined="infoFile" id="MCM" location="0xE0080000"/>
|
||||
</chip>
|
||||
<processor><name gcc_name="cortex-m4">Cortex-M4</name>
|
||||
<family>Cortex-M</family>
|
||||
@@ -538,6 +538,6 @@
|
||||
</storageModule>
|
||||
<storageModule moduleId="com.nxp.mcuxpresso.core.datamodels">
|
||||
<sdkName>SDK_2.x_MK22FN512xxx12</sdkName>
|
||||
<sdkVersion>2.3.1</sdkVersion>
|
||||
<sdkVersion>2.2.0</sdkVersion>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "led_display.h"
|
||||
#include "usb_composite_device.h"
|
||||
#include "usb_report_updater.h"
|
||||
|
||||
static usb_basic_keyboard_report_t usbBasicKeyboardReports[2];
|
||||
uint32_t UsbBasicKeyboardActionCounter;
|
||||
@@ -45,7 +44,6 @@ usb_status_t UsbBasicKeyboardCallback(class_handle_t handle, uint32_t event, voi
|
||||
switch (event) {
|
||||
// This event is received when the report has been sent
|
||||
case kUSB_DeviceHidEventSendResponse:
|
||||
UsbReportUpdateSemaphore &= ~(1 << USB_BASIC_KEYBOARD_INTERFACE_INDEX);
|
||||
if (UsbCompositeDevice.attach) {
|
||||
error = kStatus_USB_Success;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "usb_composite_device.h"
|
||||
#include "usb_report_updater.h"
|
||||
|
||||
uint32_t UsbMediaKeyboardActionCounter;
|
||||
static usb_media_keyboard_report_t usbMediaKeyboardReports[2];
|
||||
@@ -43,7 +42,6 @@ usb_status_t UsbMediaKeyboardCallback(class_handle_t handle, uint32_t event, voi
|
||||
switch (event) {
|
||||
// This event is received when the report has been sent
|
||||
case kUSB_DeviceHidEventSendResponse:
|
||||
UsbReportUpdateSemaphore &= ~(1 << USB_MEDIA_KEYBOARD_INTERFACE_INDEX);
|
||||
if (UsbCompositeDevice.attach) {
|
||||
error = kStatus_USB_Success;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "usb_composite_device.h"
|
||||
#include "usb_report_updater.h"
|
||||
|
||||
uint32_t UsbMouseActionCounter;
|
||||
static usb_mouse_report_t usbMouseReports[2];
|
||||
@@ -43,7 +42,6 @@ usb_status_t UsbMouseCallback(class_handle_t handle, uint32_t event, void *param
|
||||
switch (event) {
|
||||
// This event is received when the report has been sent
|
||||
case kUSB_DeviceHidEventSendResponse:
|
||||
UsbReportUpdateSemaphore &= ~(1 << USB_MOUSE_INTERFACE_INDEX);
|
||||
if (UsbCompositeDevice.attach) {
|
||||
error = kStatus_USB_Success;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "usb_composite_device.h"
|
||||
#include "usb_report_updater.h"
|
||||
|
||||
uint32_t UsbSystemKeyboardActionCounter;
|
||||
static usb_system_keyboard_report_t usbSystemKeyboardReports[2];
|
||||
@@ -43,7 +42,6 @@ usb_status_t UsbSystemKeyboardCallback(class_handle_t handle, uint32_t event, vo
|
||||
switch (event) {
|
||||
// This event is received when the report has been sent
|
||||
case kUSB_DeviceHidEventSendResponse:
|
||||
UsbReportUpdateSemaphore &= ~(1 << USB_SYSTEM_KEYBOARD_INTERFACE_INDEX);
|
||||
if (UsbCompositeDevice.attach) {
|
||||
error = kStatus_USB_Success;
|
||||
}
|
||||
|
||||
@@ -20,14 +20,12 @@
|
||||
static uint32_t mouseUsbReportUpdateTime = 0;
|
||||
static uint32_t mouseElapsedTime;
|
||||
|
||||
uint16_t DoubleTapSwitchLayerTimeout = 150;
|
||||
static uint16_t DoubleTapSwitchLayerReleaseTimeout = 100;
|
||||
uint16_t DoubleTapSwitchLayerTimeout = 300;
|
||||
static uint16_t DoubleTapSwitchLayerReleaseTimeout = 200;
|
||||
|
||||
static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT];
|
||||
bool TestUsbStack = false;
|
||||
|
||||
volatile uint8_t UsbReportUpdateSemaphore = 0;
|
||||
|
||||
mouse_kinetic_state_t MouseMoveState = {
|
||||
.isScroll = false,
|
||||
.upState = SerializedMouseAction_MoveUp,
|
||||
@@ -236,6 +234,7 @@ static void handleSwitchLayerAction(key_state_t *keyState, key_action_t *action)
|
||||
static uint8_t basicScancodeIndex = 0;
|
||||
static uint8_t mediaScancodeIndex = 0;
|
||||
static uint8_t systemScancodeIndex = 0;
|
||||
static uint8_t stickyModifiers;
|
||||
|
||||
static void applyKeyAction(key_state_t *keyState, key_action_t *action)
|
||||
{
|
||||
@@ -247,8 +246,13 @@ static void applyKeyAction(key_state_t *keyState, key_action_t *action)
|
||||
|
||||
switch (action->type) {
|
||||
case KeyActionType_Keystroke:
|
||||
if (action->keystroke.scancode) {
|
||||
if (!keyState->previous) {
|
||||
stickyModifiers = action->keystroke.modifiers;
|
||||
}
|
||||
} else {
|
||||
ActiveUsbBasicKeyboardReport->modifiers |= action->keystroke.modifiers;
|
||||
|
||||
}
|
||||
switch (action->keystroke.keystrokeType) {
|
||||
case KeystrokeType_Basic:
|
||||
if (basicScancodeIndex >= USB_BASIC_KEYBOARD_MAX_KEYS || action->keystroke.scancode == 0) {
|
||||
@@ -271,6 +275,9 @@ static void applyKeyAction(key_state_t *keyState, key_action_t *action)
|
||||
}
|
||||
break;
|
||||
case KeyActionType_Mouse:
|
||||
if (!keyState->previous) {
|
||||
stickyModifiers = 0;
|
||||
}
|
||||
activeMouseStates[action->mouseAction] = true;
|
||||
break;
|
||||
case KeyActionType_SwitchLayer:
|
||||
@@ -278,11 +285,13 @@ static void applyKeyAction(key_state_t *keyState, key_action_t *action)
|
||||
break;
|
||||
case KeyActionType_SwitchKeymap:
|
||||
if (!keyState->previous) {
|
||||
stickyModifiers = 0;
|
||||
SwitchKeymapById(action->switchKeymap.keymapId);
|
||||
}
|
||||
break;
|
||||
case KeyActionType_PlayMacro:
|
||||
if (!keyState->previous) {
|
||||
stickyModifiers = 0;
|
||||
Macros_StartMacro(action->playMacro.macroId);
|
||||
}
|
||||
break;
|
||||
@@ -296,8 +305,6 @@ static secondary_role_t secondaryRole;
|
||||
|
||||
static void updateActiveUsbReports(void)
|
||||
{
|
||||
static uint8_t previousModifiers = 0;
|
||||
|
||||
if (MacroPlaying) {
|
||||
Macros_ContinueMacro();
|
||||
memcpy(ActiveUsbMouseReport, &MacroMouseReport, sizeof MacroMouseReport);
|
||||
@@ -320,7 +327,11 @@ static void updateActiveUsbReports(void)
|
||||
if (activeLayer == LayerId_Base) {
|
||||
activeLayer = GetActiveLayer();
|
||||
}
|
||||
bool layerGotReleased = previousLayer != LayerId_Base && activeLayer == LayerId_Base;
|
||||
bool layerChanged = previousLayer != activeLayer;
|
||||
if (layerChanged) {
|
||||
stickyModifiers = 0;
|
||||
}
|
||||
bool layerGotReleased = layerChanged && activeLayer == LayerId_Base;
|
||||
LedDisplay_SetLayer(activeLayer);
|
||||
|
||||
if (TestUsbStack) {
|
||||
@@ -359,28 +370,30 @@ static void updateActiveUsbReports(void)
|
||||
}
|
||||
|
||||
if (keyState->current) {
|
||||
if (SleepModeActive && !keyState->previous) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) {
|
||||
// Trigger secondary role.
|
||||
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Pressed) {
|
||||
secondaryRoleState = SecondaryRoleState_Triggered;
|
||||
keyState->current = false;
|
||||
} else if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) {
|
||||
// Press released secondary role key.
|
||||
if (!keyState->previous && action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole && secondaryRoleState == SecondaryRoleState_Released) {
|
||||
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) {
|
||||
secondaryRoleState = SecondaryRoleState_Pressed;
|
||||
secondaryRoleSlotId = slotId;
|
||||
secondaryRoleKeyId = keyId;
|
||||
secondaryRole = action->keystroke.secondaryRole;
|
||||
keyState->suppressed = true;
|
||||
}
|
||||
} else {
|
||||
// Trigger secondary role.
|
||||
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Pressed) {
|
||||
secondaryRoleState = SecondaryRoleState_Triggered;
|
||||
} else {
|
||||
applyKeyAction(keyState, action);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (keyState->suppressed) {
|
||||
keyState->suppressed = false;
|
||||
@@ -405,15 +418,12 @@ static void updateActiveUsbReports(void)
|
||||
// When a layer switcher key gets pressed along with another key that produces some modifiers
|
||||
// and the accomanying key gets released then keep the related modifiers active a long as the
|
||||
// layer switcher key stays pressed. Useful for Alt+Tab keymappings and the like.
|
||||
if (activeLayer != LayerId_Base && activeLayer == PreviousHeldLayer && basicScancodeIndex == 0) {
|
||||
ActiveUsbBasicKeyboardReport->modifiers |= previousModifiers;
|
||||
}
|
||||
ActiveUsbBasicKeyboardReport->modifiers |= stickyModifiers;
|
||||
|
||||
if (secondaryRoleState == SecondaryRoleState_Triggered && IS_SECONDARY_ROLE_MODIFIER(secondaryRole)) {
|
||||
ActiveUsbBasicKeyboardReport->modifiers |= SECONDARY_ROLE_MODIFIER_TO_HID_MODIFIER(secondaryRole);
|
||||
}
|
||||
|
||||
previousModifiers = ActiveUsbBasicKeyboardReport->modifiers;
|
||||
previousLayer = activeLayer;
|
||||
}
|
||||
|
||||
@@ -425,22 +435,6 @@ void UpdateUsbReports(void)
|
||||
KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId];
|
||||
}
|
||||
|
||||
if (SleepModeActive) {
|
||||
for (uint8_t slotId = 0; slotId < SLOT_COUNT; slotId++) {
|
||||
for (uint8_t keyId = 0; keyId < MAX_KEY_COUNT_PER_MODULE; keyId++) {
|
||||
if (KeyStates[slotId][keyId].current) {
|
||||
WakeUpHost();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (UsbReportUpdateSemaphore) {
|
||||
return;
|
||||
}
|
||||
|
||||
UsbReportUpdateCounter++;
|
||||
|
||||
ResetActiveUsbBasicKeyboardReport();
|
||||
@@ -456,32 +450,20 @@ void UpdateUsbReports(void)
|
||||
bool HasUsbMouseReportChanged = memcmp(ActiveUsbMouseReport, GetInactiveUsbMouseReport(), sizeof(usb_mouse_report_t)) != 0;
|
||||
|
||||
if (HasUsbBasicKeyboardReportChanged) {
|
||||
usb_status_t status = UsbBasicKeyboardAction();
|
||||
if (status == kStatus_USB_Success) {
|
||||
UsbReportUpdateSemaphore |= 1 << USB_BASIC_KEYBOARD_INTERFACE_INDEX;
|
||||
}
|
||||
UsbBasicKeyboardAction();
|
||||
}
|
||||
|
||||
if (HasUsbMediaKeyboardReportChanged) {
|
||||
usb_status_t status = UsbMediaKeyboardAction();
|
||||
if (status == kStatus_USB_Success) {
|
||||
UsbReportUpdateSemaphore |= 1 << USB_MEDIA_KEYBOARD_INTERFACE_INDEX;
|
||||
}
|
||||
UsbMediaKeyboardAction();
|
||||
}
|
||||
|
||||
if (HasUsbSystemKeyboardReportChanged) {
|
||||
usb_status_t status = UsbSystemKeyboardAction();
|
||||
if (status == kStatus_USB_Success) {
|
||||
UsbReportUpdateSemaphore |= 1 << USB_SYSTEM_KEYBOARD_INTERFACE_INDEX;
|
||||
}
|
||||
UsbSystemKeyboardAction();
|
||||
}
|
||||
|
||||
// Send out the mouse position and wheel values continuously if the report is not zeros, but only send the mouse button states when they change.
|
||||
if (HasUsbMouseReportChanged || ActiveUsbMouseReport->x || ActiveUsbMouseReport->y ||
|
||||
ActiveUsbMouseReport->wheelX || ActiveUsbMouseReport->wheelY) {
|
||||
usb_status_t status = UsbMouseAction();
|
||||
if (status == kStatus_USB_Success) {
|
||||
UsbReportUpdateSemaphore |= 1 << USB_MOUSE_INTERFACE_INDEX;
|
||||
}
|
||||
UsbMouseAction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
extern mouse_kinetic_state_t MouseMoveState;
|
||||
extern mouse_kinetic_state_t MouseScrollState;
|
||||
extern uint32_t UsbReportUpdateCounter;
|
||||
extern volatile uint8_t UsbReportUpdateSemaphore;
|
||||
extern bool TestUsbStack;
|
||||
|
||||
// Functions:
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"commander": "^2.11.0",
|
||||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"firmwareVersion": "8.4.1",
|
||||
"firmwareVersion": "8.4.4",
|
||||
"deviceProtocolVersion": "4.4.0",
|
||||
"moduleProtocolVersion": "4.0.0",
|
||||
"userConfigVersion": "4.1.0",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#define FIRMWARE_MAJOR_VERSION 8
|
||||
#define FIRMWARE_MINOR_VERSION 4
|
||||
#define FIRMWARE_PATCH_VERSION 1
|
||||
#define FIRMWARE_PATCH_VERSION 4
|
||||
|
||||
#define DEVICE_PROTOCOL_MAJOR_VERSION 4
|
||||
#define DEVICE_PROTOCOL_MINOR_VERSION 4
|
||||
|
||||
Reference in New Issue
Block a user