Thank you for your interest in contributing! This document provides guidelines for contributing to the project.
- Raspberry Pi Pico W or Pico 2 W (for testing)
- pico-sdk 2.2.0 or later
- CMake 3.13+
- ARM GCC toolchain (
gcc-arm-none-eabi) - Git
-
Clone the repository
git clone https://github.com/sinricpro/pico-sdk.git cd pico-sdk -
Initialize submodules
git submodule add https://github.com/DaveGamble/cJSON.git lib/cJSON git submodule update --init --recursive
-
Set pico-sdk path
export PICO_SDK_PATH=/path/to/pico-sdk -
Build
cmake -B build -DPICO_BOARD=pico_w cmake --build build -j$(nproc)
- Standard: C11
- Indentation: 4 spaces (no tabs)
- Line length: 100 characters maximum
- Naming conventions:
- Functions:
sinricpro_module_action()(snake_case) - Types:
sinricpro_type_t(snake_case with_tsuffix) - Constants:
SINRICPRO_CONSTANT(UPPER_SNAKE_CASE) - Macros:
SINRICPRO_MACRO(UPPER_SNAKE_CASE)
- Functions:
- Headers:
include/sinricpro/ - Implementation:
src/ - Examples:
examples/ - Tests:
tests/(future)
- Use Doxygen-style comments for public APIs
- Include usage examples in header comments
- Document all function parameters and return values
Example:
/**
* @brief Send a power state event
*
* @param device Device pointer
* @param state Power state (true=ON, false=OFF)
* @return true if event sent successfully
*/
bool sinricpro_switch_send_power_state_event(sinricpro_switch_t *device, bool state);-
Create capability files (if needed)
- Header:
include/sinricpro/capabilities/capability_name.h - Implementation:
src/capabilities/capability_name.c
- Header:
-
Create device files
- Header:
include/sinricpro/sinricpro_device_name.h - Implementation:
src/devices/sinricpro_device_name.c
- Header:
-
Add to CMakeLists.txt
# In capabilities section src/capabilities/capability_name.c # In devices section src/devices/sinricpro_device_name.c
-
Create example
- Directory:
examples/device_name/ - Files:
CMakeLists.txt,main.c - Add to main
CMakeLists.txtexamples section
- Directory:
-
Add device type constant
- Update
sinricpro_device.hwith new device type
- Update
-
Update README.md
- Add to supported devices list
- Add to examples list
Before submitting a PR:
-
Build all examples
cmake --build build -j$(nproc) -
Check for warnings
- Code should compile without warnings
- Use
-Wall -Wextraflags
-
Test on hardware
- Flash example to Pico W
- Verify functionality with SinricPro portal
- Test voice commands with Alexa/Google
GitHub Actions will automatically:
- Build all examples on push/PR
- Run CodeQL security analysis
- Upload build artifacts
-
Fork the repository
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Follow code style guidelines
- Add/update documentation
- Create examples if adding new features
-
Test thoroughly
- Build all examples
- Test on hardware
- Check for memory leaks
-
Commit with clear messages
git commit -m "feat: add support for XYZ device"Use conventional commit format:
feat:- New featurefix:- Bug fixdocs:- Documentation changesrefactor:- Code refactoringtest:- Adding testschore:- Build/tooling changes
-
Push to your fork
git push origin feature/your-feature-name
-
Create Pull Request
- Describe what changes you made
- Reference any related issues
- Include screenshots/videos if applicable
- List tested hardware configurations
When reporting bugs, please include:
- Hardware: Pico W or Pico 2 W
- SDK version: pico-sdk version used
- SinricPro SDK version: commit hash or release version
- Steps to reproduce
- Expected behavior
- Actual behavior
- Serial output/logs (if applicable)
- Code snippet (minimal reproducible example)
For feature requests:
- Check existing issues first
- Describe the use case
- Explain why it would be useful
- Provide examples if possible
All submissions require code review. We'll check for:
- Code quality and style
- Documentation completeness
- Test coverage
- Performance implications
- Security considerations
By contributing, you agree that your contributions will be licensed under the MIT License.
- Open an issue for questions
- Check existing issues and PRs
- Review the main README.md
Thank you for contributing! 🎉