This repository is derived from raspberrypi/utils, and further encapsulates the ws2812, pwm, and servo libraries based on this.
The specific modifications are as follows:
- Added freenove_ws2812.h and freenove_ws2812.c in
utils/piolib/examplesfor the freenove_ws2812 library - Added freenove_pwm.h and freenove_pwm.c in
utils/piolib/examplesfor the freenove_pwm library - Modified CMakeLists.txt in
utils/piolib/examplesto generate shared libraries and test files - Added setup.py in
utils/pythonto set up the Python environment, compile code and generate shared libraries - Added piolib_ws2812.py in
utils/pythonfor the freenove_ws2812 library - Added piolib_pwm.py in
utils/pythonfor the freenove_pwm library - Added piolib_servo.py in
utils/pythonfor the freenove_servo library - Added ws2812_demo.py, pwm_demo.py and servo_demo.py in
utils/pythonto test the freenove_ws2812, freenove_pwm, and freenove_servo libraries
- Clone the repository:
cd ~ && git clone https://github.com/Freenove/utils.git - Install build tools, compile the code to generate shared libraries, and install the shared libraries to the Raspberry Pi 5 directory:
cd utils/python/ && sudo python setup.py - Test:
- Navigate to the python directory:
cd ~/utils/python - Test WS2812 LED driver:
python ws2812_demo.py - Test PWM driver:
python pwm_demo.py - Test servo driver:
python servo_demo.py
- Enter the examples directory:
cd ~/utils/python/examples - Refer to the code in the directory and write your own code.
- Modify the CMakeLists.txt file and add your written code to the CMakeLists.txt file.
- Use cmake to create a build folder and load compilation files:
cmake -B build -S - Enter the build folder and compile:
cd build && make - Run the test file:
./xxx - Install the library to the shared folder:
sudo make install. After executing this command, thelibxxx.sofile will be automatically installed to/usr/local/lib/. - Enter the python directory:
cd ~/utils/python - Write code to call the shared library based on Python's
ctypesmodule. You can refer to thepiolib_xxx.pyfiles for this step. - Write test files and test:
python xxx_demo.py. You can refer to thexxx_demo.pyfiles for this step.
A collection of scripts and simple applications
- dtmerge - A tool for applying compiled DT overlays (
*.dtbo) to base Device Tree files (*.dtb). Also includes thedtoverlayanddtparamutilities. - eeptools - Tools for creating and managing EEPROMs for HAT+ and HAT board.
- kdtc - A tool for compiling overlays with #includes, etc., as used in the kernel tree.
- otpset - A short script to help with reading and setting the customer OTP bits.
- overlaycheck - A tool for validating the overlay files and README in a kernel source tree.
- ovmerge - A tool for merging DT overlay source files (
*-overlay.dts), flattening and sorting.dtsfiles for easy comparison, displaying the include tree, etc. - pinctrl - A more powerful replacement for raspi-gpio, a tool for displaying and modifying the GPIO and pin muxing state of a system, bypassing the kernel.
- piolib - A library for accessing the Pi 5's PIO hardware.
- raspinfo - A short script to dump information about the Pi. Intended for the submission of bug reports.
- rpifwcrypto - A command line application and shared library for the firmware cryptography service. Intended for use with Raspberry Pi Connect and secure-boot provisioner.
- vclog - A tool to get VideoCore 'assert' or 'msg' logs with optional -f to wait for new logs to arrive.