Skip to content

Commit

Permalink
Merge pull request #8 from sysdevmike/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Mike Wu authored Mar 11, 2020
2 parents 3287f97 + f3ca1be commit 93eda2a
Show file tree
Hide file tree
Showing 69 changed files with 22 additions and 143,697 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
23 changes: 15 additions & 8 deletions firmware/HID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ uint8_t const desc_hid_report[] =
{
TUD_HID_REPORT_DESC_KEYBOARD(),
};

Adafruit_USBD_HID usb_hid;

void HID::begin(void) {
Expand All @@ -225,8 +226,8 @@ void HID::begin(void) {
Bluefruit.setTxPower(0);
Bluefruit.autoConnLed(false);

bleDIS.setManufacturer("TODO");
bleDIS.setModel("TODO");
bleDIS.setManufacturer("Bluetooth");
bleDIS.setModel("Bluetooth");

bleDIS.begin();
bleHID.begin();
Expand All @@ -247,6 +248,8 @@ void HID::begin(void) {
usb_hid.setPollInterval(2);
usb_hid.setReportDescriptor(desc_hid_report, sizeof(desc_hid_report));
usb_hid.begin();
USBDevice.setProductDescriptor("Kinesis BLEx");
USBDevice.setManufacturerDescriptor("USB");
}

void HID::sendKeys(
Expand Down Expand Up @@ -300,13 +303,17 @@ void HID::sendKeys(
}
}

if (memcmp(&report, &oldReport, sizeof(report))) {
if(usb_hid.ready()) {
usb_hid.sendReport(0, &report, sizeof(report));
} else {
bleHID.keyboardReport(&report);
}
bool setReport = memcmp(&report, &oldReport, sizeof(report));
if(!setReport) {
return;
}

if(usb_hid.ready()) {
usb_hid.sendReport(0, &report, sizeof(report));
return;
}

bleHID.keyboardReport(&report);
}

bool HID::isUSB(void) {
Expand Down
4 changes: 3 additions & 1 deletion firmware/Keyboard.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Keyboard.h"
#include "config.h"

Keyboard::Keyboard(void)
: matrix(), keymap(), hid(), power(), restTimer() {
Expand Down Expand Up @@ -26,9 +27,10 @@ void Keyboard::update(void) {
led.process();

#if REST_TIMER
restCheck();
restCheck();
#endif


sleepCheck();
}

Expand Down
2 changes: 1 addition & 1 deletion firmware/Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int Power::VBATReading(void) {
analogReference(AR_DEFAULT);
analogReadResolution(10);

return raw;
return raw * MV_PER_LSB * VBAT_DIVIDER_COMP;
}

uint8_t Power::percentageFrom(float mvolts) {
Expand Down
4 changes: 2 additions & 2 deletions firmware/Power.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Power {

private:
const float MV_PER_LSB = 0.73242188F;
const float VBAT_DIVIDER = 0.71275837F;
const float VBAT_DIVIDER_COMP = 1.403F;
const float VBAT_DIVIDER = 0.5F;
const float VBAT_DIVIDER_COMP = 2.0F;
const uint8_t VBAT_PIN = A6;
const uint8_t USB_PIN = A7;

Expand Down
Binary file modified hardware/.DS_Store
Binary file not shown.
Binary file removed hardware/Eagle Files/.DS_Store
Binary file not shown.
Binary file removed hardware/Eagle Files/V3 Gerbers/.DS_Store
Binary file not shown.
Loading

0 comments on commit 93eda2a

Please sign in to comment.