Thank you for your interest in contributing to PIOKMBox! This document provides guidelines and information for contributors.
- Raspberry Pi Pico SDK - Install the latest Pico SDK
- ARM Toolchain - arm-none-eabi-gcc
- CMake - Version 3.13 or higher
- Git - For version control and submodules
# Clone the repository with submodules
git clone --recursive https://github.com/yourusername/RaspberryKMBox.git
cd RaspberryKMBox
# Install Pico SDK (if not already installed)
# Follow instructions at: https://github.com/raspberrypi/pico-sdk
# Set environment variable
export PICO_SDK_PATH=/path/to/pico-sdk
# Build the project
./build.sh# Build for Pico (RP2040)
./build.sh pico
# Build for Pico 2 (RP2350)
./build.sh pico2
# Build both targets
./build.sh both
# Clean build
./build.sh both clean
# Debug build
./build.sh pico debug- Build both targets to ensure compatibility
- Test on hardware - Flash the firmware and verify functionality
- Check serial output - Monitor debug UART (GPIO 0/1) at 115200 baud
- Test KMBox commands - Verify serial protocol on GPIO 5/6
- Follow existing code style and formatting
- Use meaningful variable and function names
- Add comments for complex logic
- Keep functions focused and reasonably sized
- Use proper error handling
- Header files (.h) - Declarations and public interfaces
- Source files (.c) - Implementation
- PIO files (.pio) - Programmable I/O assembly code
- CMake - Build configuration in CMakeLists.txt
PIOKMbox.c- Main entry point and application loopusb_hid.*- USB HID device implementationkmbox_serial_handler.*- KMBox protocol handlingled_control.*- Status LED and NeoPixel controlwatchdog.*- System monitoring and recoverystate_management.*- System state coordination
- Fork the repository and create a feature branch
- Make your changes following the code guidelines
- Test thoroughly on both RP2040 and RP2350 if possible
- Update documentation if needed (README, comments)
- Submit a pull request with a clear description
## Description
Brief description of your changes.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tested on RP2040 (Pico)
- [ ] Tested on RP2350 (Pico 2)
- [ ] Serial communication tested
- [ ] USB functionality verified
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Documentation updated if needed
- [ ] No build warnings or errors- Plan the feature - Consider impact on existing code
- Update state management - Integrate with existing state machine
- Add appropriate logging - Use existing logging macros
- Consider timing - Respect real-time constraints
- Test edge cases - USB disconnect, power cycling, etc.
-
Serial Debug Output
- Monitor GPIO 0/1 at 115200 baud
- Use existing LOG_* macros for consistent output
- Enable verbose logging for development builds
-
LED Status Indicators
- Onboard LED shows USB device status
- NeoPixel shows overall system status
- Use these for visual debugging
-
Build Configurations
BUILD_CONFIG_DEBUG- Maximum verbosityBUILD_CONFIG_DEVELOPMENT- Standard developmentBUILD_CONFIG_PRODUCTION- Minimal logging
-
Build Failures
- Check PICO_SDK_PATH environment variable
- Ensure all submodules are initialized
- Verify ARM toolchain installation
-
USB Host Issues
- Check 5V power pin (GPIO 18)
- Verify USB host pins (GPIO 16/17)
- Monitor core1 heartbeat in debug output
-
Serial Communication
- Check UART pin connections (GPIO 5/6)
- Verify baud rate (115200)
- Test with simple terminal program
Releases are automated through GitHub Actions:
- Tag a release - Create a git tag starting with 'v' (e.g., v1.0.0)
- GitHub Actions - Automatically builds both targets
- Release created - Binaries uploaded to GitHub Releases
Follow semantic versioning (semver):
- Major - Breaking changes
- Minor - New features, backward compatible
- Patch - Bug fixes, backward compatible
- Issues - Use GitHub Issues for bug reports and feature requests
- Discussions - Use GitHub Discussions for questions and ideas
- Documentation - Check README.md for usage and setup information
By contributing to PIOKMBox, you agree that your contributions will be licensed under the same license as the project.