Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17571a5feb | ||
|
|
83e782d74a | ||
|
|
312f56048b | ||
|
|
494621a841 | ||
|
|
94af52892c | ||
|
|
5862a34f18 | ||
|
|
9b9e5ed1b5 | ||
|
|
4393377365 | ||
|
|
1570364741 | ||
|
|
738a240860 | ||
|
|
43b48aa643 | ||
|
|
61a0540007 | ||
|
|
f2e313dd0a | ||
|
|
b239d0da50 | ||
|
|
23459e3791 | ||
|
|
6a54944cb1 |
60
CHANGELOG.md
60
CHANGELOG.md
@@ -5,38 +5,48 @@ 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.
|
||||
|
||||
## [7.0.0] - 2017-12-14
|
||||
|
||||
Device Protocol: **4.0.0** | Module Protocol: 3.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Make UsbCommand_JumpToModuleBootloader() more robust by not making it dependent on the state of the module driver.
|
||||
- Don't make horizontal scrolling and vertical scrolling affect each other.
|
||||
- Expose version numbers via the get property interface. `DEVICEPROTOCOL:MINOR`
|
||||
- Add DevicePropertyId_ConfigSizes. `DEVICEPROTOCOL:MINOR`
|
||||
- Remove DevicePropertyId_HardwareConfigSize and DevicePropertyId_UserConfigSize. `DEVICEPROTOCOL:MAJOR`
|
||||
|
||||
## [6.0.0] - 2017-12-12
|
||||
|
||||
Data Model: 4.0.0 (unchanged) | USB Protocol: 3.0.0 (major bump) | Slave Protocol: 3.0.0 (unchanged)
|
||||
Device Protocol: **3.0.0** | Module Protocol: 3.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Change the value of almost every USB protocol commands because there were unused intervals between them. `USBPROTOCOL:MAJOR`
|
||||
- Change the value of almost every Device Protocol commands because there were unused intervals between them. `DEVICEPROTOCOL:MAJOR`
|
||||
- Disable LED display icons by default.
|
||||
- Update LED brightness levels upon applying the configuration.
|
||||
|
||||
## [5.0.1] - 2017-12-09
|
||||
|
||||
Data Model: 4.0.0 (unchanged) | USB Protocol: 2.0.0 (unchanged) | Slave Protocol: 3.0.0 (unchanged)
|
||||
Device Protocol: 2.0.0 | Module Protocol: 3.0.0 | User Config: 4.0.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Make key presses continue to emit scancodes even if a USB interface (typically the mouse interface) is not polled by the host anymore.
|
||||
- Make scrolling always immediately react to keypresses regardless of the previous internal scroll state.
|
||||
|
||||
## [5.0.0] - 2017-12-04
|
||||
|
||||
Data Model: 4.0.0 (major bump) | USB Protocol: 2.0.0 (unchanged) | Slave Protocol: 3.0.0 (unchanged)
|
||||
Device Protocol: 2.0.0 | Module Protocol: 3.0.0 | User Config: **4.0.0** | Hardware Config: 1.0.0
|
||||
|
||||
- Move pointerRole from keymaps to module configurations as pointerMode. Add angularShift, modLayerPointerFunction, fnLayerPointerFunction, and mouseLayerPointerFunction to module configurations. `DATAMODEL:MAJOR`
|
||||
- Move pointerRole from keymaps to module configurations as pointerMode. Add angularShift, modLayerPointerFunction, fnLayerPointerFunction, and mouseLayerPointerFunction to module configurations. `USERCONFIG:MAJOR`
|
||||
|
||||
## [4.0.0] - 2017-11-30
|
||||
|
||||
Data Model: 3.0.0 (major bump) | USB Protocol: 2.0.0 (unchanged) | Slave Protocol: 3.0.0 (unchanged)
|
||||
Device Protocol: 2.0.0 | Module Protocol: 3.0.0 | User Config: **3.0.0** | Hardware Config: 1.0.0
|
||||
|
||||
- Implement mouse movement and scrolling deceleration and acceleration.
|
||||
- Toggle layers upon double tapping their keys. Make the double tap timeout configurable.
|
||||
- Make the parser read additional user configuration properties: dataModelMajorVersion, dataModelMinorVersion, dataModelPatchVersion, doubleTapSwitchLayerTimeout, iconsAndLayerTextsBrightness, alphanumericSegmentsBrightness, keyBacklightBrightness, mouseMoveInitialSpeed, mouseMoveAcceleration, mouseMoveDeceleratedSpeed, mouseMoveBaseSpeed, mouseMoveAcceleratedSpeed, mouseScrollInitialSpeed, mouseScrollAcceleration, mouseScrollDeceleratedSpeed, mouseScrollBaseSpeed, mouseScrollAcceleratedSpeed. `DATAMODEL:MAJOR`
|
||||
- Make the parser read additional user configuration properties: USERCONFIGMajorVersion, USERCONFIGMinorVersion, USERCONFIGPatchVersion, doubleTapSwitchLayerTimeout, iconsAndLayerTextsBrightness, alphanumericSegmentsBrightness, keyBacklightBrightness, mouseMoveInitialSpeed, mouseMoveAcceleration, mouseMoveDeceleratedSpeed, mouseMoveBaseSpeed, mouseMoveAcceleratedSpeed, mouseScrollInitialSpeed, mouseScrollAcceleration, mouseScrollDeceleratedSpeed, mouseScrollBaseSpeed, mouseScrollAcceleratedSpeed. `USERCONFIG:MAJOR`
|
||||
|
||||
## [3.0.0] - 2017-11-15
|
||||
|
||||
Data Model: 2.0.0 (major bump) | USB Protocol: 2.0.0 (major bump) | Slave Protocol: 3.0.0 (major bump)
|
||||
Device Protocol: **2.0.0** | Module Protocol: **3.0.0** | User Config: **2.0.0** | Hardware Config: 1.0.0
|
||||
|
||||
- Detect the use of USB interfaces and only wait for the ones that are actually used by the host.
|
||||
- Implement key debouncer.
|
||||
@@ -44,49 +54,49 @@ Data Model: 2.0.0 (major bump) | USB Protocol: 2.0.0 (major bump) | Slave Protoc
|
||||
- Make pressing the reset button revert to the factory preset.
|
||||
- Revert to the factory default state when the reset button is pressed upon firmware startup. Display FTY on the display in this case.
|
||||
- Make the LED display show the abbreviation of the current keymap even when it gets reinitialized by the I2C watchdog.
|
||||
- Swap SlaveCommand_RequestKeyStates and SlaveCommand_JumpToBootloader, thereby making SlaveCommand_JumpToBootloader the lower number because it's more essential and shouldn't change in the future. `SLAVEPROTOCOL:MAJOR`
|
||||
- Swap SlaveCommand_RequestKeyStates and SlaveCommand_JumpToBootloader, thereby making SlaveCommand_JumpToBootloader the lower number because it's more essential and shouldn't change in the future. `MODULEPROTOCOL:MAJOR`
|
||||
- Suppress pressed keys upon layer switcher key release.
|
||||
- Handle secondary role modifiers and layer switchers.
|
||||
- Make UsbCommand_JumpToSlaveBootloader expect a slave slot id instead of a uhkModuleDriverId. `USBPROTOCOL:MAJOR`
|
||||
- Set UsbResponse_InvalidCommand upon encountering with an invalid USB command. `USBPROTOCOL:MINOR`
|
||||
- Remove UsbCommandId_ReadMergeSensor now that it can be queried via UsbCommandId_GetKeyboardState. `USBPROTOCOL:MAJOR`
|
||||
- Make the getAdcValue and getDebugInfo USB commands utilize the first byte of the response to provide status as dictated by the UHK protocol. `USBPROTOCOL:MAJOR`
|
||||
- Make UsbCommand_JumpToSlaveBootloader expect a slave slot id instead of a uhkModuleDriverId. `DEVICEPROTOCOL:MAJOR`
|
||||
- Set UsbResponse_InvalidCommand upon encountering with an invalid USB command. `DEVICEPROTOCOL:MINOR`
|
||||
- Remove UsbCommandId_ReadMergeSensor now that it can be queried via UsbCommandId_GetKeyboardState. `DEVICEPROTOCOL:MAJOR`
|
||||
- Make the getAdcValue and getDebugInfo USB commands utilize the first byte of the response to provide status as dictated by the UHK protocol. `DEVICEPROTOCOL:MAJOR`
|
||||
- Switch keymap only upon keypress.
|
||||
- Handle layer toggle actions.
|
||||
- Keep the active layer active even if another layer switcher key gets pressed while holding it.
|
||||
- Read the new UserConfig.userConfigLength user config field. `DATAMODEL:MAJOR`
|
||||
- Read the new UserConfig.userConfigLength user config field. `USERCONFIG:MAJOR`
|
||||
- Change Ctrl and Alt back according to the official UHK factory keymap.
|
||||
- Update system keyboard HID descriptor which doesn't make the pointer go to the top left corner on OSX anymore.
|
||||
- Scan keyboard matrices in a more efficient manner from timer interrupts instead of the main loop.
|
||||
- Add UsbCommand_SendKbootCommand. `USBPROTOCOL:MINOR`
|
||||
- Make the reenumerate USB command accept a timeout value. `USBPROTOCOL:MINOR`
|
||||
- Make the config parser read the device name. `DATAMODEL:MAJOR`
|
||||
- Add UsbCommand_SendKbootCommand. `DEVICEPROTOCOL:MINOR`
|
||||
- Make the reenumerate USB command accept a timeout value. `DEVICEPROTOCOL:MINOR`
|
||||
- Make the config parser read the device name. `USERCONFIG:MAJOR`
|
||||
- Update release file format containing device and module directories and hex files instead of srec.
|
||||
- Remove obsolete ARM GCC build files.
|
||||
|
||||
## [2.1.0] - 2017-10-13
|
||||
|
||||
Data Model: 1.0.0 (unchanged) | USB Protocol: 1.2.0 (minor bump) | Slave Protocol: 2.1.0 (minor bump)
|
||||
Device Protocol: 1.**2.0** | Module Protocol: 2.**1.0** | User Config: 1.0.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Add jumpToSlaveBootloader USB and slave protocol command. `USBPROTOCOL:MINOR` `SLAVEPROTOCOL:MINOR`
|
||||
- Add jumpToSlaveBootloader USB and Module Protocol command. `DEVICEPROTOCOL:MINOR` `MODULEPROTOCOL:MINOR`
|
||||
- Fix generic HID descriptor enumeration error.
|
||||
|
||||
## [2.0.0] - 2017-10-10
|
||||
|
||||
Data Model: 1.0.0 (unchanged) | USB Protocol: 1.1.0 (minor bump) | Slave Protocol: 2.0.0 (major bump)
|
||||
Device Protocol: 1.**1.0** | Module Protocol: **2.0.0** | User Config: 1.0.0 | Hardware Config: 1.0.0
|
||||
|
||||
- Read the hardware and user configuration area of the EEPROM upon startup and set the default keymap.
|
||||
- Greatly improve the I2C watchdog and drivers. Communication between the halves or the add-ons should never fail again.
|
||||
- Implement generic enumeration sequence and per-slave state for UHK modules, allowing add-ons to be added. `SLAVEPROTOCOL:MAJOR`
|
||||
- Implement generic enumeration sequence and per-slave state for UHK modules, allowing add-ons to be added. `MODULEPROTOCOL:MAJOR`
|
||||
- Make the master cache the output fields of slave modules, allowing for more frequent input updates.
|
||||
- Optimize I2C protocol scheduler resulting in increased roustness and more efficient use of I2C bandwidth.
|
||||
- Add I2C message headers containing a length header, allowing for variable-length messages and a CRC16-CCITT checksum, allowing for robust communication. `SLAVEPROTOCOL:MAJOR`
|
||||
- Add I2C message headers containing a length header, allowing for variable-length messages and a CRC16-CCITT checksum, allowing for robust communication. `MODULEPROTOCOL:MAJOR`
|
||||
- Add mechanism to dump the internal state of the KL03 via SPI for debugging purposes.
|
||||
- Add merge sensor state and attached module IDs to GetDebugInfo(). `USBPROTOCOL:PATCH`
|
||||
- Throw ParserError_InvalidKeymapCount if keymapCount == 0. `DATAMODEL:PATCH`
|
||||
- Add merge sensor state and attached module IDs to GetDebugInfo(). `DEVICEPROTOCOL:PATCH`
|
||||
- Throw ParserError_InvalidKeymapCount if keymapCount == 0. `USERCONFIG:PATCH`
|
||||
|
||||
## [1.0.0] - 2017-08-30
|
||||
|
||||
Data Model: 1.0.0 | USB Protocol: 1.0.0 | Slave Protocol: 1.0.0
|
||||
Device Protocol: 1.0.0 | Module Protocol: 1.0.0 | User Config: 1.0.0 | Hardware Config: 1.0.0
|
||||
|
||||
- First Release
|
||||
|
||||
Submodule lib/agent updated: 04b43896c5...2702a74035
@@ -69,6 +69,13 @@ status_t UhkModuleSlaveDriver_Update(uint8_t uhkModuleDriverId)
|
||||
|
||||
switch (*uhkModulePhase) {
|
||||
|
||||
// Jump to bootloader
|
||||
case UhkModulePhase_JumpToBootloader:
|
||||
txMessage.data[0] = SlaveCommand_JumpToBootloader;
|
||||
txMessage.length = 1;
|
||||
status = tx(i2cAddress);
|
||||
break;
|
||||
|
||||
// Sync communication
|
||||
case UhkModulePhase_RequestSync:
|
||||
txMessage.data[0] = SlaveCommand_RequestProperty;
|
||||
@@ -177,19 +184,6 @@ status_t UhkModuleSlaveDriver_Update(uint8_t uhkModuleDriverId)
|
||||
}
|
||||
}
|
||||
status = kStatus_Uhk_NoTransfer;
|
||||
*uhkModulePhase = UhkModulePhase_JumpToBootloader;
|
||||
break;
|
||||
|
||||
// Jump to bootloader
|
||||
case UhkModulePhase_JumpToBootloader:
|
||||
if (uhkModuleState->jumpToBootloader) {
|
||||
txMessage.data[0] = SlaveCommand_JumpToBootloader;
|
||||
txMessage.length = 1;
|
||||
status = tx(i2cAddress);
|
||||
uhkModuleState->jumpToBootloader = false;
|
||||
} else {
|
||||
status = kStatus_Uhk_NoTransfer;
|
||||
}
|
||||
*uhkModulePhase = UhkModulePhase_SetTestLed;
|
||||
break;
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
UhkModulePhase_ProcessKeystates,
|
||||
|
||||
// Misc phases
|
||||
UhkModulePhase_JumpToBootloader,
|
||||
UhkModulePhase_SetTestLed,
|
||||
UhkModulePhase_SetLedPwmBrightness,
|
||||
UhkModulePhase_JumpToBootloader,
|
||||
|
||||
} uhk_module_phase_t;
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
uint8_t firmwareI2cAddress;
|
||||
uint8_t bootloaderI2cAddress;
|
||||
uhk_module_features_t features;
|
||||
bool jumpToBootloader;
|
||||
} uhk_module_state_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -2,29 +2,58 @@
|
||||
#include "usb_commands/usb_command_get_property.h"
|
||||
#include "usb_protocol_handler.h"
|
||||
#include "eeprom.h"
|
||||
#include "versions.h"
|
||||
|
||||
version_t deviceProtocolVersion = {
|
||||
DEVICE_PROTOCOL_MAJOR_VERSION,
|
||||
DEVICE_PROTOCOL_MINOR_VERSION,
|
||||
DEVICE_PROTOCOL_PATCH_VERSION,
|
||||
};
|
||||
|
||||
version_t protocolVersions[] =
|
||||
{
|
||||
{
|
||||
FIRMWARE_MAJOR_VERSION,
|
||||
FIRMWARE_MINOR_VERSION,
|
||||
FIRMWARE_PATCH_VERSION,
|
||||
},
|
||||
{
|
||||
DEVICE_PROTOCOL_MAJOR_VERSION,
|
||||
DEVICE_PROTOCOL_MINOR_VERSION,
|
||||
DEVICE_PROTOCOL_PATCH_VERSION,
|
||||
},
|
||||
{
|
||||
MODULE_PROTOCOL_MAJOR_VERSION,
|
||||
MODULE_PROTOCOL_MINOR_VERSION,
|
||||
MODULE_PROTOCOL_PATCH_VERSION,
|
||||
},
|
||||
{
|
||||
USER_CONFIG_MAJOR_VERSION,
|
||||
USER_CONFIG_MINOR_VERSION,
|
||||
USER_CONFIG_PATCH_VERSION,
|
||||
},
|
||||
{
|
||||
HARDWARE_CONFIG_MAJOR_VERSION,
|
||||
HARDWARE_CONFIG_MINOR_VERSION,
|
||||
HARDWARE_CONFIG_PATCH_VERSION,
|
||||
}
|
||||
};
|
||||
|
||||
uint16_t configSizes[] = {HARDWARE_CONFIG_SIZE, USER_CONFIG_SIZE};
|
||||
|
||||
void UsbCommand_GetProperty(void)
|
||||
{
|
||||
uint8_t propertyId = GetUsbRxBufferUint8(1);
|
||||
|
||||
switch (propertyId) {
|
||||
case SystemPropertyId_UsbProtocolVersion:
|
||||
SetUsbTxBufferUint8(1, SYSTEM_PROPERTY_USB_PROTOCOL_VERSION);
|
||||
case DevicePropertyId_DeviceProtocolVersion:
|
||||
memcpy(GenericHidOutBuffer+1, (uint8_t*)&deviceProtocolVersion, sizeof(deviceProtocolVersion));
|
||||
break;
|
||||
case SystemPropertyId_BridgeProtocolVersion:
|
||||
SetUsbTxBufferUint8(1, SYSTEM_PROPERTY_BRIDGE_PROTOCOL_VERSION);
|
||||
case DevicePropertyId_ProtocolVersions:
|
||||
memcpy(GenericHidOutBuffer+1, (uint8_t*)&protocolVersions, sizeof(protocolVersions));
|
||||
break;
|
||||
case SystemPropertyId_DataModelVersion:
|
||||
SetUsbTxBufferUint8(1, SYSTEM_PROPERTY_DATA_MODEL_VERSION);
|
||||
break;
|
||||
case SystemPropertyId_FirmwareVersion:
|
||||
SetUsbTxBufferUint8(1, SYSTEM_PROPERTY_FIRMWARE_VERSION);
|
||||
break;
|
||||
case SystemPropertyId_HardwareConfigSize:
|
||||
SetUsbTxBufferUint16(1, HARDWARE_CONFIG_SIZE);
|
||||
break;
|
||||
case SystemPropertyId_UserConfigSize:
|
||||
SetUsbTxBufferUint16(1, USER_CONFIG_SIZE);
|
||||
case DevicePropertyId_ConfigSizes:
|
||||
memcpy(GenericHidOutBuffer+1, (uint8_t*)&configSizes, sizeof(configSizes));
|
||||
break;
|
||||
default:
|
||||
SetUsbTxBufferUint8(0, UsbStatusCode_GetProperty_InvalidProperty);
|
||||
|
||||
@@ -1,22 +1,12 @@
|
||||
#ifndef __USB_COMMAND_GET_PROPERTY_H__
|
||||
#define __USB_COMMAND_GET_PROPERTY_H__
|
||||
|
||||
// Macros:
|
||||
|
||||
#define SYSTEM_PROPERTY_USB_PROTOCOL_VERSION 1
|
||||
#define SYSTEM_PROPERTY_BRIDGE_PROTOCOL_VERSION 1
|
||||
#define SYSTEM_PROPERTY_DATA_MODEL_VERSION 1
|
||||
#define SYSTEM_PROPERTY_FIRMWARE_VERSION 1
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef enum {
|
||||
SystemPropertyId_UsbProtocolVersion = 0,
|
||||
SystemPropertyId_BridgeProtocolVersion = 1,
|
||||
SystemPropertyId_DataModelVersion = 2,
|
||||
SystemPropertyId_FirmwareVersion = 3,
|
||||
SystemPropertyId_HardwareConfigSize = 4,
|
||||
SystemPropertyId_UserConfigSize = 5,
|
||||
DevicePropertyId_DeviceProtocolVersion = 0,
|
||||
DevicePropertyId_ProtocolVersions = 1,
|
||||
DevicePropertyId_ConfigSizes = 2,
|
||||
} system_property_t;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -13,5 +13,5 @@ void UsbCommand_JumpToModuleBootloader(void)
|
||||
}
|
||||
|
||||
uint8_t uhkModuleDriverId = SLOT_ID_TO_UHK_MODULE_DRIVER_ID(slotId);
|
||||
UhkModuleStates[uhkModuleDriverId].jumpToBootloader = true;
|
||||
UhkModuleStates[uhkModuleDriverId].phase = UhkModulePhase_JumpToBootloader;
|
||||
}
|
||||
|
||||
@@ -99,15 +99,21 @@ void processMouseKineticState(mouse_kinetic_state_t *kineticState)
|
||||
|
||||
float distance = kineticState->currentSpeed * elapsedTime / 1000;
|
||||
|
||||
|
||||
if (kineticState->isScroll && !kineticState->wasMoveAction) {
|
||||
kineticState->xSum = 0;
|
||||
kineticState->ySum = 0;
|
||||
}
|
||||
|
||||
// Update horizontal state
|
||||
|
||||
bool horizontalMovement = true;
|
||||
if (activeMouseStates[kineticState->leftState]) {
|
||||
kineticState->xSum -= distance;
|
||||
} else if (activeMouseStates[kineticState->rightState]) {
|
||||
kineticState->xSum += distance;
|
||||
} else {
|
||||
horizontalMovement = false;
|
||||
}
|
||||
|
||||
float xSumInt;
|
||||
@@ -115,15 +121,20 @@ void processMouseKineticState(mouse_kinetic_state_t *kineticState)
|
||||
kineticState->xSum = xSumFrac;
|
||||
kineticState->xOut = xSumInt;
|
||||
|
||||
if (kineticState->isScroll && !kineticState->wasMoveAction && kineticState->xOut == 0) {
|
||||
if (kineticState->isScroll && !kineticState->wasMoveAction && kineticState->xOut == 0 && horizontalMovement) {
|
||||
kineticState->xOut = kineticState->xSum > 0 ? 1 : -1;
|
||||
kineticState->xSum = 0;
|
||||
}
|
||||
|
||||
// Update vertical state
|
||||
|
||||
bool verticalMovement = true;
|
||||
if (activeMouseStates[kineticState->upState]) {
|
||||
kineticState->ySum -= distance;
|
||||
} else if (activeMouseStates[kineticState->downState]) {
|
||||
kineticState->ySum += distance;
|
||||
} else {
|
||||
verticalMovement = false;
|
||||
}
|
||||
|
||||
float ySumInt;
|
||||
@@ -131,7 +142,7 @@ void processMouseKineticState(mouse_kinetic_state_t *kineticState)
|
||||
kineticState->ySum = ySumFrac;
|
||||
kineticState->yOut = ySumInt;
|
||||
|
||||
if (kineticState->isScroll && !kineticState->wasMoveAction && kineticState->yOut == 0) {
|
||||
if (kineticState->isScroll && !kineticState->wasMoveAction && kineticState->yOut == 0 && verticalMovement) {
|
||||
kineticState->yOut = kineticState->ySum > 0 ? 1 : -1;
|
||||
kineticState->ySum = 0;
|
||||
}
|
||||
|
||||
41
scripts/generate-versions-h.js
Executable file
41
scripts/generate-versions-h.js
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env node
|
||||
const fs = require('fs');
|
||||
|
||||
const versionPropertyPrefixes = ['firmware', 'deviceProtocol', 'moduleProtocol', 'userConfig', 'hardwareConfig'];
|
||||
const patchVersions = ['Major', 'Minor', 'Patch'];
|
||||
const package = JSON.parse(fs.readFileSync(`${__dirname}/package.json`));
|
||||
|
||||
const versionVariables = versionPropertyPrefixes.map(versionPropertyPrefix => {
|
||||
const versionPropertyName = `${versionPropertyPrefix}Version`
|
||||
const versionPropertyValues = package[versionPropertyName].split('.');
|
||||
return patchVersions.map(patchVersion => {
|
||||
const versionPropertyValue = versionPropertyValues.shift();
|
||||
const versionPropertyMacroName = `${versionPropertyPrefix}${patchVersion}Version`.split(/(?=[A-Z])/).join('_').toUpperCase()
|
||||
return ` #define ${versionPropertyMacroName} ${versionPropertyValue}`;
|
||||
}).join('\n') + '\n';
|
||||
}).join('\n');
|
||||
|
||||
fs.writeFileSync(`${__dirname}/../shared/versions.h`,
|
||||
`// Please do not edit this file by hand!
|
||||
// It is to be regenerated by /scripts/generate-versions-h.js
|
||||
|
||||
#ifndef __VERSIONS_H__
|
||||
#define __VERSIONS_H__
|
||||
|
||||
// Includes:
|
||||
|
||||
#include "fsl_common.h"
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef struct {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
uint16_t patch;
|
||||
} version_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
${versionVariables}
|
||||
#endif
|
||||
`);
|
||||
@@ -5,8 +5,10 @@ require('shelljs/global');
|
||||
config.fatal = true;
|
||||
config.verbose = true;
|
||||
|
||||
exec(`${__dirname}/generate-versions-h.js`);
|
||||
|
||||
const package = JSON.parse(fs.readFileSync(`${__dirname}/package.json`));
|
||||
const version = package.version;
|
||||
const version = package.firmwareVersion;
|
||||
const releaseName = `uhk-firmware-${version}`;
|
||||
const releaseDir = `${__dirname}/${releaseName}`;
|
||||
const modulesDir = `${releaseDir}/modules`;
|
||||
@@ -28,7 +30,7 @@ exec(`/opt/Freescale/KDS_v3/eclipse/kinetis-design-studio \
|
||||
-cleanBuild uhk-right`
|
||||
);
|
||||
|
||||
for (let device of package.devices) {
|
||||
for (const device of package.devices) {
|
||||
const deviceDir = `${releaseDir}/devices/${device.name}`;
|
||||
const deviceSource = `${__dirname}/../${device.source}`;
|
||||
mkdir('-p', deviceDir);
|
||||
@@ -37,7 +39,7 @@ for (let device of package.devices) {
|
||||
exec(`${usbDir}/user-config-json-to-bin.ts ${deviceDir}/config.bin`);
|
||||
}
|
||||
|
||||
for (let module of package.modules) {
|
||||
for (const module of package.modules) {
|
||||
const moduleDir = `${releaseDir}/modules`;
|
||||
const moduleSource = `${__dirname}/../${module.source}`;
|
||||
mkdir('-p', moduleDir);
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
"commander": "^2.11.0",
|
||||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"version": "6.0.0",
|
||||
"dataModelVersion": "4.0.0",
|
||||
"usbProtocolVersion": "3.0.0",
|
||||
"slaveProtocolVersion": "3.0.0",
|
||||
"firmwareVersion": "7.0.0",
|
||||
"deviceProtocolVersion": "4.0.0",
|
||||
"moduleProtocolVersion": "3.0.0",
|
||||
"userConfigVersion": "4.0.0",
|
||||
"hardwareConfigVersion": "1.0.0",
|
||||
"devices": [
|
||||
{
|
||||
"deviceId": 1,
|
||||
|
||||
41
shared/versions.h
Normal file
41
shared/versions.h
Normal file
@@ -0,0 +1,41 @@
|
||||
// Please do not edit this file by hand!
|
||||
// It is to be regenerated by /scripts/generate-versions-h.js
|
||||
|
||||
#ifndef __VERSIONS_H__
|
||||
#define __VERSIONS_H__
|
||||
|
||||
// Includes:
|
||||
|
||||
#include "fsl_common.h"
|
||||
|
||||
// Typedefs:
|
||||
|
||||
typedef struct {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
uint16_t patch;
|
||||
} version_t;
|
||||
|
||||
// Variables:
|
||||
|
||||
#define FIRMWARE_MAJOR_VERSION 6
|
||||
#define FIRMWARE_MINOR_VERSION 0
|
||||
#define FIRMWARE_PATCH_VERSION 0
|
||||
|
||||
#define DEVICE_PROTOCOL_MAJOR_VERSION 3
|
||||
#define DEVICE_PROTOCOL_MINOR_VERSION 0
|
||||
#define DEVICE_PROTOCOL_PATCH_VERSION 0
|
||||
|
||||
#define MODULE_PROTOCOL_MAJOR_VERSION 3
|
||||
#define MODULE_PROTOCOL_MINOR_VERSION 0
|
||||
#define MODULE_PROTOCOL_PATCH_VERSION 0
|
||||
|
||||
#define USER_CONFIG_MAJOR_VERSION 4
|
||||
#define USER_CONFIG_MINOR_VERSION 0
|
||||
#define USER_CONFIG_PATCH_VERSION 0
|
||||
|
||||
#define HARDWARE_CONFIG_MAJOR_VERSION 1
|
||||
#define HARDWARE_CONFIG_MINOR_VERSION 0
|
||||
#define HARDWARE_CONFIG_PATCH_VERSION 0
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user