Skip to content

Commit

Permalink
Change firmware version to keyboard data, add packet count
Browse files Browse the repository at this point in the history
  • Loading branch information
sebirdman committed Jul 4, 2018
1 parent 9ba3ffd commit e82d032
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions POC/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ allColor("#FF0000");
allColor("#0000FF");

// sparkle();
const data = keyboard.getFirmwareVersion();
console.log("Firmware Version:" + data);
const data = keyboard.getKeyboardData();
console.log("Firmware Version:" + data.firmware);
keyboard.setBrightness(63);

// sparkleBatch();
Expand Down
7 changes: 5 additions & 2 deletions src/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ export class Keyboard {
this.featureReports(new TriggerPacket().buildPacketBytes());
}

public getFirmwareVersion() {
public getKeyboardData() {
this.featureReports(new FirmwarePacket().buildPacketBytes());
const fwVer = this.readDataFromDevice();
return fwVer[3] + "." + fwVer[4] + "." + fwVer[5] + "." + fwVer[6] + "." + fwVer[7];
return {
firmware: fwVer[4] + "." + fwVer[5] + "." + fwVer[6] + "." + fwVer[7],
packetCount: fwVer[3],
};
}

/**
Expand Down

0 comments on commit e82d032

Please sign in to comment.