Make UhkBuffer allocate a Buffer.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
class UhkBuffer {
|
class UhkBuffer {
|
||||||
|
private static eepromSize = 32 * 1024;
|
||||||
private static maxStringByteLength = 0xFFFF;
|
private static maxStringByteLength = 0xFFFF;
|
||||||
private static longStringPrefix = 0xFF;
|
private static longStringPrefix = 0xFF;
|
||||||
private static stringEncoding = 'utf8';
|
private static stringEncoding = 'utf8';
|
||||||
@@ -7,9 +8,10 @@ class UhkBuffer {
|
|||||||
buffer: Buffer;
|
buffer: Buffer;
|
||||||
offset: number;
|
offset: number;
|
||||||
|
|
||||||
constructor(buffer: Buffer) {
|
constructor() {
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
this.buffer = buffer;
|
this.buffer = new Buffer(UhkBuffer.eepromSize);
|
||||||
|
this.buffer.fill(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
readInt8(): number {
|
readInt8(): number {
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
/// <reference path="KeystrokeAction.ts" />
|
/// <reference path="KeystrokeAction.ts" />
|
||||||
|
|
||||||
let fs = require('fs');
|
let fs = require('fs');
|
||||||
let buffer: Buffer = new Buffer(1000);
|
let writer = new UhkBuffer();
|
||||||
buffer.fill(0);
|
|
||||||
let writer = new UhkBuffer(buffer);
|
|
||||||
|
|
||||||
let uhkConfig = JSON.parse(fs.readFileSync('uhk-config.json'));
|
let uhkConfig = JSON.parse(fs.readFileSync('uhk-config.json'));
|
||||||
let keyActions = uhkConfig.keymaps[0].layers[0].modules[0].keyActions;
|
let keyActions = uhkConfig.keymaps[0].layers[0].modules[0].keyActions;
|
||||||
@@ -153,4 +151,4 @@ function serializeSwitchLayerAction(switchLayerAction) {
|
|||||||
|
|
||||||
new KeystrokeAction();
|
new KeystrokeAction();
|
||||||
serializeKeyActions(keyActions);
|
serializeKeyActions(keyActions);
|
||||||
fs.writeFileSync('uhk-config.bin', buffer);
|
fs.writeFileSync('uhk-config.bin', writer.buffer);
|
||||||
|
|||||||
@@ -33,7 +33,10 @@
|
|||||||
true,
|
true,
|
||||||
"spaces"
|
"spaces"
|
||||||
],
|
],
|
||||||
"max-line-length": [true, 100],
|
"max-line-length": [
|
||||||
|
true,
|
||||||
|
100
|
||||||
|
],
|
||||||
"no-trailing-whitespace": true,
|
"no-trailing-whitespace": true,
|
||||||
"trailing-comma": [
|
"trailing-comma": [
|
||||||
true, {
|
true, {
|
||||||
|
|||||||
Reference in New Issue
Block a user