-
-
Notifications
You must be signed in to change notification settings - Fork 1
Examples
jes-core can be used for a variety of applications for and on embedded systems. Since multitasking and CLI are native, it opens up some possibilities for cool cross-platform applications.
Does your project involve user-triggered tasks with sleep time in between? Perfect for jes-core! Use interrupts to launch jobs that process your requests before going to sleep again. Since jes-core deallocates memory for jobs which are done, you can expect that your sleep-overhead is close to zero.
Many devices in the realm of media streaming or measurement require a constant stream of data but also have to react to user input during runtime. Think of a digital oscilloscope which has to adjust its trigger value according to the users input while data is being sampled. jes-core can take care of that. Define a sampler-job with a while(1) and UI-handler job which gets triggered by an interrupt, adjust some values within your trigger-job and exit.
Native CLI support enables easy cross-platform unit-testing. Using pyserial for python you can send commands to jes-core via serial. This way, you can easily test your embedded systems internal calculation processes without being physically present.
#include <Arduino.h>
#include "jescore.h"
#define LED_PIN 4
void led_init(void* p){
pinMode(LED_PIN, OUTPUT);
}
void blink(void* p){
static bool act = false;
act = !act;
while(act){
digitalWrite(LED_PIN, HIGH);
delay(1000);
digitalWrite(LED_PIN, LOW);
delay(1000);
}
}
void setup() {
jes_init();
register_and_launch_job("ledinit", 2048, 1, led_init, false);
register_and_launch_job("blink", 2048, 1, blink, true);
}
void loop() {
}