Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flobernd/raspi-fanshim
Lightweight library to control the pimoroni Fan SHIM device on a Raspberry Pi
https://github.com/flobernd/raspi-fanshim
Last synced: 2 months ago
JSON representation
Lightweight library to control the pimoroni Fan SHIM device on a Raspberry Pi
- Host: GitHub
- URL: https://github.com/flobernd/raspi-fanshim
- Owner: flobernd
- License: mit
- Created: 2019-08-04T11:12:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-10-02T13:23:53.000Z (over 5 years ago)
- Last Synced: 2024-05-02T00:26:25.278Z (9 months ago)
- Language: C
- Homepage:
- Size: 11.7 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Raspberry Pi Fan SHIM library
Provides functions to control the pimoroni `Fan SHIM` device on a Raspberry Pi.
## Features
### Fan control
Basic functions to enable/disable the fan or query its state.
```c
/**
* @brief Queries the current status of the fan.
*
* @return `True`, if the fan is currently running or `false`, if not.
*/
bool RaspiFanshimIsFanEnabled(void);/**
* @brief Enables or disables the fan.
*
* @param enabled Pass `true` to enable the fan, `false` to disable it.
*/
void RaspiFanshimEnableFan(bool enabled);/**
* @brief Toggles the fan.
*/
void RaspiFanshimToggleFan(void);
```### LED control
Allows setting the color and brightness value of the integrated `APA102` LED.
```c
/**
* @brief Updates the color of the `Fan SHIM`s integrated `APA102` LED.
*
* @param r The red color component.
* @param g The green color component.
* @param b The blue color component.
* @param brightness The LED brightness (0..31).
*/
void RaspiFanshimUpdateLED(uint8_t r, uint8_t g, uint8_t b, uint8_t brightness);
```## Build
Install the required `wiringPi` library.
```bash
sudo apt install wiringpi
```You can use CMake to generate project files for your favorite C99 compiler.
```bash
git clone --recursive 'https://github.com/flobernd/raspi-fanshim.git'
cd raspi-fanshim
mkdir build && cd build
cmake ..
make
```## Service
The `RaspiFanshim` projects contains an [example service](./examples/FanshimService.c) that can be used as a replacement for the original python based Fan SHIM system service. It uses less CPU resources and provides more configuration options (in the source file).
This project is work in progress.
## License
RaspiFanshim is licensed under the MIT license.