mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-15 13:08:21 +01:00
basic getting started guide and concepts
This commit is contained in:
55
README.md
55
README.md
@@ -1,13 +1,64 @@
|
||||
# Sprocket-Core
|
||||
A lightweight Arduino framework for event driven programming.
|
||||
|
||||
|
||||
## Getting Started
|
||||
Install sprocket-lib on your favorite dev environment.
|
||||
Either by cloning this repository into the Arduino library path or by adding it as a dependency to your platformio.ini file.
|
||||
In addition, following dependencies need to be installed as well:
|
||||
```
|
||||
Hash
|
||||
TaskScheduler
|
||||
SPIFFS
|
||||
ArduinoJson
|
||||
```
|
||||
|
||||
Example platformio.ini:
|
||||
```
|
||||
[env:build]
|
||||
framework = arduino
|
||||
platform = espressif8266
|
||||
board = esp12e
|
||||
upload_speed = 921600
|
||||
monitor_baud = 115200
|
||||
lib_deps =
|
||||
Hash
|
||||
TaskScheduler
|
||||
SPIFFS
|
||||
ArduinoJson
|
||||
https://gitlab.com/wirelos/sprocket-lib.git#develop
|
||||
```
|
||||
|
||||
Example main.cpp:
|
||||
```cpp
|
||||
Sprocket *sprocket;
|
||||
|
||||
void setup()
|
||||
{
|
||||
sprocket = new Sprocket({STARTUP_DELAY, SERIAL_BAUD_RATE});
|
||||
sprocket->addPlugin(new SomePlugin());
|
||||
sprocket->activate();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
sprocket->loop();
|
||||
yield();
|
||||
}
|
||||
```
|
||||
|
||||
## Concepts
|
||||
... topic based event channel / pubsub-pattern
|
||||
... plugin system
|
||||
|
||||
### Lifecycle
|
||||
In most cases a Sprocket is bootstraped in the setup() method. Addidional plugins are hooked into the Sprocket after initialisation.
|
||||
During loop, the internal Scheduler needs to be updated by calling the corresponding method.
|
||||
See the "Getting Started" section for an example of skeleton Sprocket.
|
||||
|
||||
### Plugins
|
||||
To extend the functionality of a Sprocket, plugins can be hooked into the activation lifecycle.
|
||||
|
||||
## Sprocket Lifecycle
|
||||
TODO
|
||||
|
||||
# Useful commands
|
||||
```sh
|
||||
|
||||
Reference in New Issue
Block a user