Skip to content

Commit 60e8877

Browse files
added some more refactor to dos
1 parent b0825a4 commit 60e8877

9 files changed

Lines changed: 28 additions & 8 deletions

File tree

firmware/bluetooth.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ StatePayload statedata;
4141
/**************************************************************************************************************************/
4242
void bt_setup(uint8_t BLEProfile)
4343
{
44+
//TODO review what can be extracted for single boards
45+
46+
//TODO review what is needed for split boards and provide in separate module
4447
ble_gap_conn_params_t _ppcp;
4548
_ppcp = ((ble_gap_conn_params_t) {
4649
.min_conn_interval = 6,
@@ -88,7 +91,7 @@ sd_ble_gap_ppcp_set(&_ppcp);
8891
bledis.setModel(DEVICE_MODEL); // Defined in keyboard_config.h
8992
bledis.begin();
9093

91-
94+
//TODO Split Battery Reporting Service into separate module.
9295
// Configure and Start Battery Service
9396
blebas.begin();
9497
blebas.write(100); // put the battery level at 100% - until it is updated by the battery monitoring loop.
@@ -98,6 +101,7 @@ sd_ble_gap_ppcp_set(&_ppcp);
98101
statedata.layer =0;
99102
statedata.timesync=0;
100103

104+
//TODO Get Peripheral into separate module
101105
#if BLE_PERIPHERAL == 1 // PERIPHERAL IS THE SLAVE BOARD
102106

103107
Linkdata.keycode[0] =0; // initialize the slave to master link data...
@@ -152,7 +156,7 @@ sd_ble_gap_ppcp_set(&_ppcp);
152156
* up to 11.25 ms. Therefore BLEHidAdafruit::begin() will try to set the min and max
153157
* connection interval to 11.25 ms and 15 ms respectively for best performance.
154158
*/
155-
159+
//TODO setup LED feedback for both USB and BLE
156160
#if BLE_HID == 1
157161
blehid.begin();
158162
// Set callback for set LED from central
@@ -164,6 +168,7 @@ sd_ble_gap_ppcp_set(&_ppcp);
164168
* min = 9*1.25=11.25 ms, max = 12*1.25= 15 ms
165169
*/
166170

171+
//TODO split central role into separate module.
167172
#if BLE_CENTRAL == 1 // CENTRAL IS THE MASTER BOARD
168173

169174
KBLinkClientService.begin();
@@ -197,6 +202,8 @@ ble_gap_addr_t bt_getMACAddr(void)
197202
/**************************************************************************************************************************/
198203
//
199204
/**************************************************************************************************************************/
205+
206+
//TODO setup advertising setup group of tasks
200207
void bt_startAdv(void)
201208
{
202209
// Advertising packet

firmware/firmware_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#endif
5050
#endif
5151

52-
52+
//todo review if timings are needed and default values.
5353
#ifndef DEBOUNCETIME
5454
#define DEBOUNCETIME 3 // changing this to 1 and you will have problems with the debounce logic - repeated keys perhaps...
5555
#endif

firmware/firmware_loop.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
/**************************************************************************************************************************/
99
// Keyboard Scanning
1010
/**************************************************************************************************************************/
11-
11+
//todo get scanning code into separate module
12+
//todo get generic code scanning module for non-nrf52 boards.
1213
#if DIODE_DIRECTION == COL2ROW
1314
#define writeRow(r) digitalWrite(r,LOW)
1415
#define modeCol(c) pinMode(c, INPUT_PULLUP)
@@ -94,6 +95,7 @@ LOG_LV1("BLEMIC","scanMatrix" );
9495
}
9596
#endif
9697

98+
//TODO refactor stringbuffer into HID queues
9799
void UpdateQueue()
98100
{
99101
#ifdef ENABLE_COMBOS
@@ -215,17 +217,17 @@ void sendKeyPresses() {
215217
KeyScanner::specialfunction = 0;
216218
} else if (KeyScanner::consumer > 0)
217219
{
218-
// send consumeer code
220+
// TODO send consumeer code
219221
KeyScanner::consumer = 0;
220222
} else if (KeyScanner::mouse > 0)
221223
{
222-
// send mouse code
224+
// TODO send mouse code
223225
KeyScanner::mouse = 0;
224226
}
225227

226228
}
227229

228-
230+
//TODO re-implement sleep as module
229231
void checkforsleep()
230232
{
231233

@@ -312,6 +314,8 @@ void updatebattery()
312314
keyboardstate.vbat_vdd = batterymonitor.vbat_vdd;
313315
}
314316

317+
318+
//todo Implement LEDs as module
315319
void updateleds()
316320
{
317321
keyboardstate.statusledtimer = keyboardstate.timestamp;

firmware/firmware_setup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ byte columns[] MATRIX_COL_PINS; // Contains the GPIO Pin Numbers defined in
3030
std::vector<HIDKeyboard> reportbuffer;
3131

3232
/**************************************************************************************************************************/
33+
//todo setup save to flash as module.
3334
void setupConfig() {
3435
InternalFS.begin();
3536
loadConfig();
@@ -150,12 +151,14 @@ void setuphid()
150151
bluemicro_hid.begin();
151152
}
152153

154+
//todo: delete setupnrf52 if no longer needed
153155
void setupnrf52()
154156
{
155157
setupGpio(); // checks that NFC functions on GPIOs are disabled.
156158
setupWDT();
157159
}
158160

161+
//todo re-install debug CLI as module
159162
void serialsplash()
160163
{
161164
Serial.begin(115200);

firmware/keymap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define BIRTHDAY MC(KC_Z)
3333

3434
#ifdef ENABLE_AUDIO
35+
//todo re-install audio features as module
3536
//extern BlueMicro_tone speaker;
3637
#endif
3738

firmware/keyscanner.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "keyscanner.h"
66

7+
//todo refactor KeyScanner and split into get/update/send sequences
78

89
KeyScanner::KeyScanner(PersistentState* cfg, DynamicState* stat) { // Constructor
910
config=cfg;

firmware/keystate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515

16-
16+
//todo review default tap/hold tap/doubletap defaullt timings
1717
#ifndef DOUBLETAP_TIME_LIMIT
1818
#define DOUBLETAP_TIME_LIMIT 200
1919
#endif

firmware/nrf52battery.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "nrf52battery.h"
66

7+
//todo split battery read from battery update
8+
79
/**************************************************************************************************************************/
810
BLEBas blebas; // Battery Service
911

firmware/sleep.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "sleep.h"
66

7+
//todo refactor sleep so that each module can register a pre-sleep command.
8+
79
extern led_handler statusLEDs; /// Typically a Blue and Red LED
810
/**************************************************************************************************************************/
911
// Prepare sense pins for waking up from complete shutdown

0 commit comments

Comments
 (0)