-
-
Notifications
You must be signed in to change notification settings - Fork 1
Examples
jescore 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 jescore! Use interrupts to launch jobs that process your requests before going to sleep again. Since jescore 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. jescore 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 jescore 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 MAX_JOB_ARGS_LEN_BYTE 64
#define LED_PIN 4
void blink(void* p){
static uint8_t act = 0;
act = !act;
while(act){
digitalWrite(LED_PIN, HIGH);
delay(1000);
digitalWrite(LED_PIN, LOW);
delay(1000);
}
}
void setup() {
jes_init();
pinMode(LED_PIN, OUTPUT);
register_and_launch_job("blink", 2048, 1, blink, 1);
}
void loop() {
}