GitHub - ashen1queter/nRF52_dongle
<aside>
The glove powers on when a Li-Po battery is connected via a JST-PH connector to the SuperMini NRF52840’s onboard BAT terminals. BLE scanning begins immediately, filtering for a specific peripheral based on its UUID. Once identified, the device is bonded using the Peer Manager and added to a whitelist. Up to 8 peers can be whitelisted, after which scanning is restricted to whitelisted devices only. Upon connection, the glove discovers a custom characteristic under a specific custom service on the peripheral (NRF52840 dongle).
The dongle can be connected to the USB port of a host device (e.g., a laptop), upon which it begins advertising.
</aside>
<aside>
Upon discovering the characteristic its CCCD is subscribed to enable notifications and its value handle is set to indicate a successful connection. This serves as a flag for the dongle to then enable a CLI over USB CDC, allowing the user to configure custom actuation points. The three flex sensors are mapped as follows:
The configuration step for any key can be skipped by simply pressing Enter, in which case the dongle proceeds with default threshold already stored in its flash.
</aside>
<aside>
Once configuration is complete, the value handle of the characteristic is updated to indicate successful setup. This change is notified to the glove, signaling it to begin ADC sampling. Analog readings from the three flex sensors are first compared against a dead-zone threshold which prevents phantom bending and stored in an array of size 3 and sent as a single BLE Write Without Response to the dongle. Calibration offset is performed every 5 samples (placement of the calibration offset routine still under consideration). Each new sample set is written to the characteristic's value handle, and only after this write is complete, the next ADC sampling is triggered.
On the dongle, the incoming 3-sample payload is processed through a simple finite state machine that filters and calibrates each input to determine key actuation states (like press, release, rapid trigger, and tap). Each key's distance, direction, and velocity are analyzed to decide whether to send HID key press or release events via USBD.
</aside>
<aside>
Hardware
Software
<aside>
</aside>
<aside>
</aside>
<aside>
<aside>
Hardware
Software