All Projects → ivanseidel → Duetimer

ivanseidel / Duetimer

Licence: mit
⏳ Timer Library fully implemented for Arduino DUE

Projects that are alternatives of or similar to Duetimer

Arduino Timer
Non-blocking library for delaying function calls
Stars: ✭ 133 (-27.72%)
Mutual labels:  timer, arduino, arduino-library
Arduino Fsm
Arduino library for implementing a finite state machine.
Stars: ✭ 142 (-22.83%)
Mutual labels:  arduino, arduino-library
Arduino Applemidi Library
Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)
Stars: ✭ 177 (-3.8%)
Mutual labels:  arduino, arduino-library
Arduino Menusystem
Arduino library for implementing a menu system
Stars: ✭ 161 (-12.5%)
Mutual labels:  arduino, arduino-library
M5stack Sd Updater
💾 Customizable menu system for M5Stack and ESP32-Chimera-Core - loads apps from the Micro SD card. Easily add you own apps
Stars: ✭ 175 (-4.89%)
Mutual labels:  arduino, arduino-library
Liquidmenu
Menu creation Arduino library for LCDs, wraps LiquidCrystal.
Stars: ✭ 141 (-23.37%)
Mutual labels:  arduino, arduino-library
Bh1750
An Arduino library for the digital light sensor breakout boards containing the BH1750FVI IC
Stars: ✭ 173 (-5.98%)
Mutual labels:  arduino, arduino-library
Rotaryencoder
RotaryEncoder Arduino Library
Stars: ✭ 134 (-27.17%)
Mutual labels:  arduino, arduino-library
Espmqttclient
Wifi and MQTT handling for ESP8266 and ESP32
Stars: ✭ 169 (-8.15%)
Mutual labels:  arduino, arduino-library
Esp32 Ble Mouse
Bluetooth LE Mouse library for the ESP32 (Arduino IDE compatible)
Stars: ✭ 180 (-2.17%)
Mutual labels:  arduino, arduino-library
Packetserial
An Arduino Library that facilitates packet-based serial communication using COBS or SLIP encoding.
Stars: ✭ 177 (-3.8%)
Mutual labels:  arduino, arduino-library
Tmc2130stepper
Arduino library for Trinamic TMC2130 Stepper driver
Stars: ✭ 141 (-23.37%)
Mutual labels:  arduino, arduino-library
Rf24
OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
Stars: ✭ 1,813 (+885.33%)
Mutual labels:  arduino, arduino-library
Si5351arduino
Library for the Si5351 clock generator IC in the Arduino environment
Stars: ✭ 141 (-23.37%)
Mutual labels:  arduino, arduino-library
Irremoteesp8266
Infrared remote library for ESP8266/ESP32: send and receive infrared signals with multiple protocols. Based on: https://github.com/shirriff/Arduino-IRremote/
Stars: ✭ 1,964 (+967.39%)
Mutual labels:  arduino, arduino-library
Arduino Device Lib
Arduino Library for TTN Devices
Stars: ✭ 155 (-15.76%)
Mutual labels:  arduino, arduino-library
Tinyspi
Arduino hardware SPI library for ATtiny44/84, 45/85, 461/861, 2313/4313.
Stars: ✭ 134 (-27.17%)
Mutual labels:  arduino, arduino-library
Corsairlightingprotocol
Control LEDs connected to an Arduino with iCUE, create an unofficial Corsair iCUE compatible Arduino LED controller.
Stars: ✭ 182 (-1.09%)
Mutual labels:  arduino, arduino-library
Pzem004t
Arduino communication library for Peacefair PZEM-004T Energy monitor
Stars: ✭ 165 (-10.33%)
Mutual labels:  arduino, arduino-library
Socket.io Client
A socket.io-client implementation for ESP8266 and Arduino
Stars: ✭ 170 (-7.61%)
Mutual labels:  arduino, arduino-library

DueTimer

Timer Library to work with Arduino DUE

Installation

  1. Download the Latest release from GitHub.
  2. Unzip and modify the Folder name to "DueTimer" (Remove the '-version')
  3. Paste the modified folder on your Library folder (On your Libraries folder inside Sketchbooks or Arduino software).
  4. Re-open Arduino Software

Getting Started

To call a function handler every 1000 microseconds:

Timer3.attachInterrupt(handler).start(1000);
// or:
Timer3.attachInterrupt(handler).setPeriod(1000).start();
// or, to select whichever available timer:
Timer.getAvailable().attachInterrupt(handler).start(1000);

To call a function handler 10 times a second:

Timer3.attachInterrupt(handler).setFrequency(10).start();

In case you need to stop a timer, just do like this:

Timer3.stop();

And to continue running:

Timer3.start();

There are 9 Timer objects already instantiated for you: Timer0, Timer1, Timer2, Timer3, Timer4, Timer5, Timer6, Timer7 and Timer8.

TIPs and Warnings

Timer4.attachInterrupt(handler).setFrequency(10).start();
// Is the same as:
Timer4.attachInterrupt(handler);
Timer4.setFrequency(10);
Timer4.start();

// To create a custom timer, refer to:
DueTimer myTimer = DueTimer(0); // Creates a Timer 0 object.
DueTimer myTimer = DueTimer(3); // Creates a Timer 3 object.
DueTimer myTimer = DueTimer(t); // Creates a Timer t object.
// Note: Maximum t allowed is 8, as there is only 9 timers [0..8];

Timer1.attachInterrupt(handler1).start(10);
Timer1.attachInterrupt(handler2).start(10);
DueTimer myTimer = DueTimer(1);
myTimer.attachInterrupt(handler3).start(20);
// Will run only handle3, on Timer 1 (You are just overriding the callback)

Timer.getAvailable().attachInterrupt(callback1).start(10);
// Start timer on first available timer
DueTimer::getAvailable().attachInterrupt(callback2).start(10);
// Start timer on second available timer
// And so on...

DueTimer myTimer = Timer.getAvailable();
if (myTimer != DueTimer(0))
// Now we know that the timer returned is actually available
// Can compare timers using == or !=

Compatibility with Servo.h

Because Servo Library uses the same callbacks of DueTimer, we provides a custom solution for working with both of them. However, Timers 0,2,3,4 and 5 will not Work anymore.

You will need uncommend the line in DueTimer.h in DueTimer folder inside the Libraries folder. Uncomment the following line in DueTimer.h:

#define USING_SERVO_LIB	true

Library Reference

You should know:

  • getAvailable() - Get the first available Timer.

  • attachInterrupt(void (*isr)()) - Attach a interrupt (callback function) for the timer of the object.

  • detachInterrupt() - Detach current callback of timer.

  • start(long microseconds = -1) - Start the timer with an optional period parameter.

  • stop() - Stop the timer

  • setFrequency(long frequency) - Set the timer frequency

  • long getFrequency() - Get the timer frequency

  • setPeriod(long microseconds) - Set the timer period (in microseconds)

  • long getPeriod() - Get the timer period (in microseconds)

You don't need to know:

<<<<<<< HEAD

  • int timer - Stores the object timer id (to access Timers struct array).

  • DueTimer(unsigned short _timer) - Instantiate a new DueTimer object for Timer _timer (NOTE: All objects are already instantiated!).

  • static const Timer Timers[] - Stores all timers information

  • static void (*callbacks[])() - Stores all callbacks for all timers

Hardware Information

More information on the Timer Counter module of the µC on the Arduino Due can be found in the documentation file TimerCounter.

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].