How treehopper-electronics/treehopper-sdk works
High-level components
• Hardware/Board (Treehopper PCB with EFM8 microcontroller)
• On-board firmware (EFM8 C code, USB descriptors, peripheral drivers)
• Host communication layer (USB stacks: WinUSB, libusb, Mac IOKit)
• Core API layer (shared C/C++ “Treehopper” core code)
• Language-specific SDKs and wrappers (C++, .NET, Java, Python, MATLAB, PowerShell)
• Code-generation tool (RegisterGenerator)
• Sample applications and demos (for each language)
• Documentation system (Doxygen, Sandcastle)
Relationships and data flows
– Drivers for each peripheral (gpio.c, i2c.c, spi.c, uart.c, softPwm.c…)
– USB device descriptors and firmware logic (descriptors.c, callback.c)
– FirmwareConnectionService (handles incoming commands)
– Windows: WinUSBConnectionService
– Linux: LibUsbConnectionService
– macOS: MacUsbConnectionService
– UWP/UWP wrappers, PowerShell shim
• From the Core API block, branch out to each language SDK:
– C++: API/ folder (HardwareI2c, Pin, Utility, Libraries…)
– .NET: NET/API (ConnectionService.cs, UsbConnection.cs, Treehopper.csproj…)
– Java: Java/api/treehopper (ConnectionService.java, TreehopperUsb.java…)
– Python: Python/treehopper/api (find_boards.py, i2c.py, treehopper_usb.py…)
– MATLAB: Demos folder (init.m, blink.m…)
– PowerShell: PowerShell cmdlets (GetTreehopper.cs, SetTreehopper.cs…)
Architectural patterns and principles
• Layered architecture: Hardware → Firmware → USB transport → Core API → Language wrappers → Demos
• Adapter/Factory pattern: ConnectionService abstracts platform-specific USB layers
• Code generation: RegisterGenerator produces register bindings for each language
• Modular drivers: each peripheral (ADC, SPI, I2C, sensor libraries) lives in its own folder
• Cross-platform partitioning: separate src/linux, src/win, src/mac for C++
Technologies & frameworks
• Firmware: Silicon Labs EFM8 SDK, ANSI C, USB 2.0
• C++: CMake, libusb, WinUSB, Doxygen
• .NET: C#/.NET Framework / Xamarin (Android, UWP), Sandcastle
• Java: Gradle, Android SDK, javax.usb, Javadoc
• Python: setuptools, PyPI packaging
• MATLAB: .m scripts
• PowerShell: .NET Core modules
Final checklist
• Every major folder in the repo (Firmware-EFM8, C++/API, NET/API, Java/api, Python/treehopper, RegisterGenerator, Demos) appears as a component.
• Clear grouping of platform-specific adapters and language wrappers.