All Projects → Zuph → Avrqueue

Zuph / Avrqueue

Licence: mit
Queueing Library for AVR and Arduino

Labels

Projects that are alternatives of or similar to Avrqueue

Kakwafont
Kakwafont, a 12px monospace bitmap font based on Terminus
Stars: ✭ 76 (-6.17%)
Mutual labels:  makefile
Cloudformation Templates
Common tasks automated by CloudFormation
Stars: ✭ 79 (-2.47%)
Mutual labels:  makefile
Learn machine learning
Road to Machine Learning
Stars: ✭ 81 (+0%)
Mutual labels:  makefile
Kbd
for building keyboard libraries
Stars: ✭ 77 (-4.94%)
Mutual labels:  makefile
Do more with twitter data
Tutorials for getting the most out of Twitter data.
Stars: ✭ 78 (-3.7%)
Mutual labels:  makefile
Freedom Tools
Tools for SiFive's Freedom Platform
Stars: ✭ 80 (-1.23%)
Mutual labels:  makefile
Hornbill Examples
Stars: ✭ 76 (-6.17%)
Mutual labels:  makefile
Docker Trino Cluster
Multiple node presto cluster on docker container
Stars: ✭ 81 (+0%)
Mutual labels:  makefile
Pragmaticai
[Book-2019] Pragmatic AI: An Introduction to Cloud-based Machine Learning
Stars: ✭ 79 (-2.47%)
Mutual labels:  makefile
K8s Mediaserver Operator
Repository for k8s Mediaserver Operator project
Stars: ✭ 81 (+0%)
Mutual labels:  makefile
Handbook
The Niteo Handbook
Stars: ✭ 77 (-4.94%)
Mutual labels:  makefile
Stm32cube Gcc
A developement environment for projects based on the STM32Cube firmware.
Stars: ✭ 78 (-3.7%)
Mutual labels:  makefile
Openwrt Kcptun
kcptun for OpenWrt
Stars: ✭ 80 (-1.23%)
Mutual labels:  makefile
Rusted Switch
Nintendo Switch Homebrew with Rust 🦀
Stars: ✭ 75 (-7.41%)
Mutual labels:  makefile
Corteza Docs
Documentation, manual, instructions
Stars: ✭ 81 (+0%)
Mutual labels:  makefile
Homeland Docker
🚀 Deployment Homeland with Docker
Stars: ✭ 76 (-6.17%)
Mutual labels:  makefile
Docker Tinycore
Tiny Core Linux Docker image building scripts and Dockerfile
Stars: ✭ 79 (-2.47%)
Mutual labels:  makefile
Openwrt Vlmcsd
a package for vlmcsd
Stars: ✭ 81 (+0%)
Mutual labels:  makefile
Openwrt Simple Obfs
Simple-obfs for OpenWrt/LEDE
Stars: ✭ 81 (+0%)
Mutual labels:  makefile
Awesome Blogdown
An awesome curated list of blogs built using blogdown
Stars: ✭ 80 (-1.23%)
Mutual labels:  makefile

AVRQueue

AVRQueue is a task queuing library for AVR and Arduino processors. Included here are two different branches, AVR and Arduino.

This is a simple queuing library. Add functions to the queue, along with a unique identifier, an initial run time, and a recurrence time. If your time scale is in seconds, an item with an initial run time of 1, and a recurrence of 5 will run after time 1 second, and every 5 seconds thereafter.

Functions are not guaranteed to execute deterministic when they're scheduled. This is a very primitive library. The run function simply waits for a function in the queue to reach its run time, runs the function, then continues through the queue. If queued functions take a very long time to execute, then functions may not execute precisely when desired. For this reason, a "now" variable is passed into every function in order to let it know when it actually runs.

AVR

The AVR library is oriented towards enthusiasts. Compile queue.c with your project, and include queue.h in any files that need to add, modify, remove, or execute functions from the queue.

All settings are in queue.h:

  • QUEUE_DEPTH: The number of functions that you can store in the queue. More functions = more RAM required. (Default: 10)

  • NAME_LIMIT: The number of characters used to store unique IDs for tasks. (Default: 8)

  • queue_time_t: Typedef for the storage of timing data. Use the native type for whatever time system you're using. (If you're using AVR timers, change this to uint_16t). (Default: uint_32t)

Usage

  • Queued Functions: All queued functions must have the following C signature:

int queued_function(queue_time_t now)
The now variable will contain the time the function was called.

  • int scheduleFunction(queuedFunction pFunction, const char pId, queue_time_t pInitialRun, queue_time_t pRecur)

Add a function to the queue.
***Return Values:***

0 if successful.
-1 if unsuccessful (queue is full).

  • pFunction: Function to put in the queue.

  • pId: Up to 8 character unique identifier. (Unless you change the length).

  • pInitialRun: Initial run time, in whatever time units you feed into run.

  • pRecur: Recurrence period, in whatever time units you feed into run.

  • int scheduleRemoveFunction(const char pId)

Remove a function with given unique ID from the queue.
***Return Values:***

0 if successful.
-1 if unsuccessful.

  • pId: Unique id

  • int scheduleChangeFunction(const char pId, queue_time_t pNewNext, queue_time_t pNewRecur)

Change function in the queue.
***Return Values:***

0 if successful.
-1 if unsuccessful.

  • pId: Unique identifier.

  • pNewNext: Next time to run the function.

  • pNewRecur: New recurrence time.

  • int scheduleRun(queue_time_t pNow)

Run all the queued items. Run this in a loop to execute the queue.
***Return Values:***

-1 if unsuccessful. Number of queue items successfully ran otherwise.

  • pNow: the current time.

Arduino

The Arduino library is much easier to use. Extract to /Libraries/Queue/, restart the IDE, and start using.

  • Maximum of 10 items in the queue.
  • Unique IDs are up to 8 characters, no more.
  • Use with millis();

Usage

  • Queued Functions: All queued functions must have a C signature (either not class-members, or static class-members) of:

int queued_function(unsigned long now)
The now variable will contain the time the function was called.

  • Creating a Queue: Create a queue like this: Queue myQueue;

  • int Queue::scheduleFunction(queuedFunction pFunction, const char pId, unsigned long pInitialRun, unsigned long pRecur)

Add a function to the queue.
***Return Values:***

0 if successful.
-1 if unsuccessful (queue is full).

  • pFunction: Function to put in the queue.

  • pId: Up to 8 character unique identifier. (Unless you change the length).

  • pInitialRun: Initial run time, in milliseconds.

  • pRecur: Recurrence period, in milliseconds.

  • int Queue::scheduleRemoveFunction(const char pId)

Remove a function with given unique ID from the queue.
***Return Values:***

0 if successful.
-1 if unsuccessful.

  • pId: Unique id

  • int Queue::scheduleChangeFunction(const char pId, unsigned long pNewNext, unsigned long pNewRecur)

Change function in the queue.
***Return Values:***

0 if successful.
-1 if unsuccessful.

  • pId: Unique identifier.

  • pNewNext: Next time to run the function.

  • pNewRecur: New recurrence time.

  • int Queue::scheduleRun(unsigned long pNow)

Run all the queued items. Run this in a loop to execute the queue.
***Return Values:***

-1 if unsuccessful. Number of queue items successfully ran otherwise.

  • pNow: the current time, in Milliseconds.

License

Copyright (c) 2012 Brad Luyster

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].