You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
574 B
36 lines
574 B
3 years ago
|
#include "TeensyTimerTool.h"
|
||
|
using namespace TeensyTimerTool;
|
||
|
|
||
|
PeriodicTimer t1(TCK);
|
||
|
PeriodicTimer t2(TCK);
|
||
|
|
||
|
void isr1()
|
||
|
{
|
||
|
Serial.printf("called @: %u ms\n", millis());
|
||
|
}
|
||
|
|
||
|
void isr2()
|
||
|
{
|
||
|
digitalToggleFast(LED_BUILTIN);
|
||
|
}
|
||
|
|
||
|
void isr3()
|
||
|
{
|
||
|
digitalWriteFast(0,HIGH);
|
||
|
delayMicroseconds(10);
|
||
|
digitalWriteFast(0, LOW);
|
||
|
}
|
||
|
|
||
|
void setup()
|
||
|
{
|
||
|
pinMode(LED_BUILTIN, OUTPUT);
|
||
|
|
||
|
t1.begin(isr1, 5.02s); // instead of 5020000 (µs)
|
||
|
t2.begin(isr2, 25ms); // instead of 25000 (µs)
|
||
|
t2.begin(isr3, 100_kHz); // instead of 10 (µs)
|
||
|
}
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
}
|