There isn't much information online about the internal TCBn interrupts on the WiFi Rev2. In the code below the problem is trying to create a viable attachInterrupt statement. The info I found so far is for interrupts from a pin and the attachInterrupt statement has 3 arguments, pin, ISR, and mode (Change, High etc.) How should it be constructed for the TCB0 timer/counter interrupt in the Periodic Interrupt Timer mode? The one commented out is my latest failed attempt.
void setup()
{
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT); // init built-in led
cli();
TCB0.CCMP = 0x11111111;
TCB0.CTRLA = 0x00000001;
TCB0.CTRLB = 0x00000000;
// TCB0.attachInterrupt(0, ISR_PIT, 0);
sei();
}
void loop()
{
}
void ISR_PIT()
{
Blink();
}
void Blink()
{
digitalWrite(LED_BUILTIN, digitalRead(LED_BUILTIN) ^ 1);
}