Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markuspi/cppfreertos
A FreeRTOS C++ wrapper for ESP32
https://github.com/markuspi/cppfreertos
cpp esp32 freertos platformio
Last synced: 6 days ago
JSON representation
A FreeRTOS C++ wrapper for ESP32
- Host: GitHub
- URL: https://github.com/markuspi/cppfreertos
- Owner: markuspi
- License: mit
- Created: 2024-09-22T17:34:56.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-30T21:13:45.000Z (4 months ago)
- Last Synced: 2025-01-20T22:07:38.745Z (15 days ago)
- Topics: cpp, esp32, freertos, platformio
- Language: C++
- Homepage:
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# cppfreertos
A FreeRTOS C++ wrapper for ESP32. Compatible with PlatformIO and ESP-IDF.
## Installation
### PlatformIO
In your platformio.ini file, add this repository to `lib_deps`:
```ini
[env:some_env]
platform = espressif32
framework = ...
board = ...
lib_deps =
https://github.com/markuspi/cppfreertos.git#v0.1.3
```### ESP-IDF
[![Component Registry](https://components.espressif.com/components/markuspi/cppfreertos/badge.svg)](https://components.espressif.com/components/markuspi/cppfreertos)
In your component directory (either `main` or any other component in `components/`), edit or create the `idf_component.yml` manifest file and add `markuspi/cppfreertos` as a dependency:
```yaml
dependencies:
markuspi/cppfreertos: "^0.1.3"
```Or use the following command to add it to your project:
```bash
idf.py add-dependency "markuspi/cppfreertos^0.1.3"
```## Usage Example
```cpp
#include
#include// define a queue of integers with a capacity of 5 items
cppfreertos::StaticQueue myQueue;// define a task with 4096 bytes of stack size in static memory
cppfreertos::StaticTask<4096> myTask([](){
int item;
while (true) {
if (myQueue.Receive(item, portMAX_DELAY)) {
std::printf("Received: %d\n", item);
}
}
});// can also use void setup() { ... } for Arduino
extern "C" void app_main() {
// initialize queue
myQueue.Init();// initialize the task and start it right away
myTask.Init("MyTask");// add an item to the queue
myQueue.Send(123);
}
```