Brings ESP32 firmware variant up to par with the nRF firmware.#5
Merged
Conversation
Owner
RobertDaleSmith
commented
Sep 26, 2025
- BLE Central (auto pairs to BLE mice)
- BLE HIDS (Human Interface Device Service)
- BLE NUS (Nordic UART Service)
- BLE DIS (Device Information Service)
- BLE BAS (Battery Activity Service)
- BLE RSSI signal monitoring
- USB HID
- USB Dual CDC
- CDC_1: UART bridge
- CDC_2: Log monitoring
- Status LED (connection/activity)
- User Button (hold to clear bonds)
Adds Nordic UART Service (NUS) client support with bidirectional bridge to USB CDC, matching the nRF firmware functionality. Key features: - BLE NUS client with auto-discovery of TX/RX characteristics by properties - Property-based handle detection (NOTIFY for TX, WRITE for RX) - Bidirectional data bridge: BLE NUS ↔ USB CDC with packet framing - Same packet framing protocol as nRF version (0xAA 0x55 markers + CRC) - Clean logging separation: UART0 logs via TX|6 pin, CDC for data only - Support for variable-length packets (no 64-byte fragmentation) - Configurable NUS support via ENABLE_NUS_CLIENT_MODE Core components: - ble_nus.c/h: NUS GATT server implementation - ble_nus_client.c/h: NUS GATT client with auto-discovery - nus_cdc_bridge.c/h: Bidirectional data bridge coordinator - Enhanced USB CDC with nRF-compatible packet framing - UART0 remapping for external logging (J-Link compatible) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…is for Uart bridge and second is for log monitoring
- Registers dedicated GATT client application (app_id=1) for NUS service - Maintains ESP HID library's existing GATT client (app_id=0) for HID service - Implements proper GATT connection establishment using esp_ble_gattc_open() - Routes GATT events based on interface to prevent service conflicts - Adds delayed NUS discovery after HID connection to avoid timing conflicts - Fixes HID reconnection issues by isolating NUS and HID service operations - Both HID mouse reports and NUS data transmission now work simultaneously - Maintains functionality across disconnect/reconnect cycles This follows ESP-IDF best practices for multiple GATT service clients. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…g streaming Major performance improvements for both HID passthrough and NUS data streaming: HID Latency Optimizations: - Remove logging from critical HID input path for immediate report sending - Increase FreeRTOS tick rate from 100Hz to 1000Hz for better timing precision - Increase ESP HID event stack size from 4KB to 8KB for better performance - Reduce RSSI polling from per-input + 2s timer to 10s timer only - Remove unnecessary service discovery delays between separate GATT instances BLE Scanning Optimizations: - Reduce scan windows from 5s to 1s with 50ms delays for faster device discovery - Add device name logging when devices are found during scanning Logging Elimination: - Remove all verbose per-event GATT client logging (main bottleneck) - Remove per-packet CDC logging during NUS streaming - Remove verbose NUS bridge logging during data forwarding - Remove detailed GATT event routing logs - Remove verbose NUS GATT event logging The system now provides zero-latency HID passthrough with clean logging, maintaining full performance for both HID and NUS services simultaneously across reconnections with separate GATT instances. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add button.c/h module for XIAO ESP32-S3 boot button (GPIO0) - Support single-click, double-click, and long-press detection - Implement non-blocking time-based debouncing to prevent watchdog issues - Long-press triggers BLE bond clearing functionality - Use FreeRTOS tasks and ESP timers for reliable event handling - Fixed GPIO0 strapping pin compatibility issues 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
… advertisement data logging • Add complete BLE Device Information Service (DIS) implementation - New ble_device_info.c/h module with independent GATT interface - Supports all standard DIS characteristics: manufacturer, model, firmware version, etc. - Includes PnP ID support for vendor/product ID extraction - Device name integration from advertisement data • Enhance BLE connection logging with advertisement packet details - Add appearance data capture and human-readable decoding (Mouse, Keyboard, etc.) - Store advertisement data during device scan and display on connection - Add appearance_to_string() function for device type identification • Clean up verbose connection logging - Reduce ESP_LOGI to ESP_LOGD for routine service discovery messages - Eliminate duplicate device information printing - Standardize address logging format across modules - Remove verbose forwarding event spam • Maintain architectural independence between HID, NUS, and DIS services - Each service operates with separate GATT interfaces - Independent service discovery and connection management - Proper cleanup and state management on disconnect 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…vertisement packets • Extract and parse manufacturer data during BLE device scanning - Add company ID identification from first 2 bytes of manufacturer data - Log detailed hex dump of manufacturer-specific payload data - Enhanced GAP debug logging with manufacturer data information • Update scan result handling to support manufacturer data parameters - Extend add_ble_scan_result() function signature for manufacturer data - Maintain compatibility with existing scan result processing - Prepare infrastructure for displaying manufacturer data on connection The manufacturer data contains: - Bytes 0-1: Company identifier (little-endian) - Bytes 2+: Company-specific payload (may include VID/PID for some vendors) This allows immediate identification of device manufacturer during scanning, complementing the standardized DIS PnP ID data obtained after connection. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…HID device logging - Add comprehensive advertisement packet inspection for HID devices showing: * Device name, UUID, appearance, RSSI, address type * Manufacturer data analysis with company ID extraction * Raw advertisement and scan response data dumps - Clean up duplicate PnP ID logging in DIS service - Remove redundant NUS connection ready messages - Improve manufacturer data detection and hex dump formatting - Enable detailed packet analysis before connection for debugging 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove ble_nus.c and ble_nus.h (NUS GATT server) as they were never initialized or used - Update CMakeLists.txt to exclude unused NUS server from build - ESP32 only acts as NUS GATT client via ble_nus_client.c to connect to MouthPad - Reduces binary size and eliminates dead code The ESP32 functions purely as a BLE central device connecting to: - MouthPad's NUS service (via ble_nus_client.c) ✅ - MouthPad's HID service ✅ - MouthPad's DIS service (via ble_device_info.c) ✅ 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Rename ble_nus_client.c/.h to ble_nus.c/.h - Update all includes from "ble_nus_client.h" to "ble_nus.h" - Update CMakeLists.txt to reference new filenames - No functional changes, purely naming cleanup Since the unused NUS GATT server code was removed, the "client" suffix is no longer needed - the remaining NUS code is clearly for client functionality. This provides cleaner, more intuitive naming: Before: ble_nus_client.c (NUS client) + ble_nus.c (unused server) After: ble_nus.c (NUS client only) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Rename ble_device_info.c/.h to ble_dis.c/.h - Update all includes from "ble_device_info.h" to "ble_dis.h" - Update CMakeLists.txt to reference new filenames - No functional changes, purely naming cleanup Rationale: "ble_dis" is more concise and aligns with standard BLE terminology: - DIS = Device Information Service (standard BLE service) - Matches naming pattern with other BLE services (ble_nus, ble_bas) - Shorter, cleaner naming convention ESP32 BLE architecture now uses consistent naming: ├── ble_nus.c/h - Nordic UART Service client ├── ble_dis.c/h - Device Information Service client └── ble_bas.c/h - Battery Service client 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Rename bootloader_trigger.c/.h to dev_dfu.c/.h - Update include references in main.c and usb_cdc.c - Update CMakeLists.txt to reference dev_dfu.c - Maintains consistent naming convention for device firmware update functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Rename ble_transport.c/.h to ble_central.c/.h - Update all function names: ble_transport_* -> ble_central_* - Update all type names: ble_transport_scan_result_t -> ble_central_scan_result_t - Update TAG name: BLE_TRANSPORT -> BLE_CENTRAL - Update all references in main.c and self-includes - Update CMakeLists.txt to reference ble_central.c This clarifies the architecture where ble_central handles BLE central role operations (scanning, discovery) while nus_cdc_bridge provides the actual transport bridging functionality between BLE services and USB interfaces. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…rchitecture - Rename nus_cdc_bridge.c/.h to ble_transport.c/.h - Update all function names: nus_cdc_bridge_* -> ble_transport_* - Update TAG name: NUS_CDC_BRIDGE -> BLE_TRANSPORT - Update all references in main.c and self-includes - Update CMakeLists.txt to reference ble_transport.c This completes the architecture refactoring where: - ble_central.c handles BLE central role operations (scanning, discovery) - ble_transport.c implements the transport bridge between BLE and USB interfaces 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Renamed uart_transport.c/h to transport_uart.c/h and updated all function names from uart_transport_* to transport_uart_* to allow alphabetical ordering with future transport_hid module. Changes: - Renamed files: uart_transport.c/h → transport_uart.c/h - Updated function names: uart_transport_* → transport_uart_* - Updated TAG: "UART_TRANSPORT" → "TRANSPORT_UART" - Updated all references in main.c - CMakeLists.txt automatically updated by git 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.