From 20525cbef39125a2050504a7bd421407111991f7 Mon Sep 17 00:00:00 2001 From: hpwit Date: Mon, 6 Jul 2020 01:34:08 +0200 Subject: [PATCH] v1.0 --- ArtnetESP32.h | 2 +- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/ArtnetESP32.h b/ArtnetESP32.h index 91571e0..0d7f142 100755 --- a/ArtnetESP32.h +++ b/ArtnetESP32.h @@ -57,7 +57,7 @@ THE SOFTWARE. #include "freertos/queue.h" #include "soc/timer_group_struct.h" #include "soc/timer_group_reg.h" - +#include "esp_task_wdt.h" #include "FS.h" //static QueueHandle_t _artnet_queue; diff --git a/README.md b/README.md index ed1d384..bbaf708 100755 --- a/README.md +++ b/README.md @@ -53,9 +53,57 @@ When using artnet streaming, You need to take into account the timing issues : * Do not hesitate to buy a good SD card to have a good write/read speed ## Library usage - +### The artnet object ```C - +#include "ArnetESP32.h" +ArtnetESP32 artnet; ``` +### Main functions +#### `begin` function +This function starts the artnet objects. +usage : `begin(NUM_LEDS,UNIVERSE_SIZE)` +* `NUM_LEDS` is the total number of leds of your setup +* `UNIVERSE_SIZE` is the size of you universes in pixels +Based on these two numbers the program will calculate the number of needed universes + +#### `setLedsBuffer(uint_8t*) buffer)` +This function will set the buffer that will store the frame retrieve from `readFrame()` `readNextFrameAndWait()` and `readFrameRecord()` + +#### `readFrame()` +This function will receive one frame or all the needed universes. +* Will exit with "Time out" after 1s of inactivity +* Will return `1` if a frame has been received otherwise `0` when timeouting + +#### `startArtnetrecord(File File)` +This function sets up and starts what is needed to record the frames onto the file. + +#### `readFrameRecord()` +This function receives a frame a store it in the file. It also store the delay between frames +* Will exit with "Time out" after 1s of inactivity +* Will return `1` if a frame has been received otherwise `0` when timeouting + +#### `stopArtnetRecord()` +This function is mandatory to call to end the recording it will also close the file + +#### `readNextFrameAndWait(File file)` +This function reads a frame from the file and wait the necessary time. +it returns `true` if the file has not be entirely read else it will returns `false` + + +### The callback functions +When uploading a frame, recording a frame or reading a frame from SD a callback function can be setup + +#### `setFrameCallback` +This function set the function that will be called when a frame will be received using the `readFrame()` function + +#### `setframeRecordCallback` +This function set the function that will be called when a frame will be received using the `readFrameRecord()` function + +#### `setreadFromSDCallback` +This function set the function that will be called when a frame will be received using the `readNextFrameAndWait(File file)` function + +## Examples +Each example shows how to uses these functions +