I'm using this teensy for a larger project, but one problem I noticed is that when I use elapsedMicro to create square pulses, the very first one is always longer. Can't really figure out why, this is for simple baseline so a solution like "use IntervalTimers instead" doesn't really make sense.
image documenting problem: 
minimal working example:
Code:
#include <Arduino.h>
const uint8_t _pin_out_ = 2;
void setup()
{
Serial.begin(9600);
while (!Serial) {
}
pinMode(_pin_out_, OUTPUT);
}
elapsedMicros g_rising_edge_timer;
elapsedMicros g_falling_edge_timer;
bool g_is_high{false};
uint32_t g_interval{5000};
uint32_t g_width{10};
void loop()
{
if (g_rising_edge_timer >= g_interval) {
digitalWriteFast(_pin_out_, HIGH);
g_rising_edge_timer -= g_interval;
g_falling_edge_timer = 0;
g_is_high = true;
}
if (g_is_high && (g_falling_edge_timer >= g_width)) {
digitalWriteFast(_pin_out_, LOW);
g_is_high = false;
}
}
Edit: using platformio with teensy4.1