bsiever / microbit-pxt-blehid

Micro:bit MakeCode support to act as a Human Interface Devices (keyboard, mouse, etc.) over Bluetooth
https://bsiever.github.io/microbit-pxt-blehid/
MIT License
30 stars 10 forks source link

Reduce Memory (RAM) #3

Closed bsiever closed 2 years ago

bsiever commented 2 years ago

Reduce memory: Replace static memory for report with table-based approach.

struct reporterEntry {
   uint8_t *data;
   uint16_t reportIDOffset;
   uint16_t length;
   reportEntry *next;
}

static reportEntry *reports;

Or maybe static array instead of linked list of nodes?

bsiever commented 2 years ago

HID Service Report Descriptors dictate the max number of services. Might as well use a table rather than a list. (Easier to manage, contiguous and less prone to corruption, etc.)

bsiever commented 2 years ago

Hmm....onDataRead appears to need to write data (params.update must be true) and / or it requires use fo the memory for the characteristic?

This appears to be a dead end.

bsiever commented 2 years ago

Tried on branch memmin --- it's a dud. Stack needs real memory for BLE operations.