Coder Social home page Coder Social logo

arduinoprocessscheduler's Introduction

ArduinoProcessScheduler

A cooperative Arduino object oriented, cooperative process scheduler to replace them all.

What is this?

As your Arduino projects get more complicated, you will begin to see the need for multitasking, or at least appear to multitask. Perhaps you want to check if a button was pressed as often as you can, but you only want to update a display once every second. Trying to do this on your own can quickly turn into overwhelming spagetti code involving millis(). ArduinoProcessScheduler seeks to simplify this. Simply create your custom Process that needs to be serviced at certain times, and let the scheduler handle the rest.

Why this one?

Here are some similar popular libraries that inspired this one:

What is wrong with them?

  1. They all treat processes/tasks as just callback functions.
  2. Forces you to use ugly global and/or static function variables to track process state.
  3. Limits you to one instance of a process, or lots of copy & paste.
  4. Impossible to truly dynamically create new processes, you are really just enabling/disabling a callback function.
  5. Preemptive schedulers must split stack between all processes
  6. With 2K or RAM and 8 processes, preemptive scheduler could at most equally give each Process 2k/8 = 256 Bytes of RAM.
  7. No concurrency protection (not interrupt safe)
  8. What if an interrupt fires an tries to disable a process while it is running?

Features

Basic

  • Control over how often a process runs (periodically, iterations, or as often as possible)
  • Process priority levels (easily make custom levels as well)
  • Dynamically add/remove and enable/disable processes
  • Interrupt safe (add, disable, destroy, etc.. processes from interrupt routines)
  • Process concurrency protection (Process will always be in a valid state)

Advanced

  • Spawn new processes from within running processes
  • Automatic process monitoring statistics (calculates % CPU time for process)
  • Truly object oriented (a Process is its own object)
  • Exception handling (wait what?!)
  • Scheduler can automatically interrupt stuck processes

Supported Platfroms

  • AVR
  • ESP8266 (No exception handling or process timeouts)

Install & Usage

See Wiki

NOTE: Don't forget to install this RingBuf library dependency!

Contributing

I welcome any contributions! Here are some ideas:

  • Built in logging
  • Built in timers
  • Built in process ownership (Library tracks who owns a Process)
  • More advanced Process statistics monitoring
  • Adding support for additional platforms
  • Any Examples!

License

MIT.

arduinoprocessscheduler's People

Contributors

frozendroid avatar per1234 avatar thijstriemstra avatar wizard97 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.