Timer Interrupt in QMK with Teensy2.0++

Status
Not open for further replies.

leon_t

New member
Hi guys, I'm making my own keyboard with QMK on Teensy 2.0++, and I want to use the teeny's timer interrupt (should shorter than 1 microsecond) to do my own stuff. How can I do that in QMK's source code like my keymap.c?

I use ISR(TIMER3_COMPA_vect) for now, but the frequency is only 300mHz whick is not fast enough for me
Is there more faster timer interrupt?

The code is above:

Code:
#include <avr/io.h>
#include <avr/interrupt.h>

ISR(TIMER3_COMPA_vect)
{
    PORTB ^= 1 << PORTB0;
}

void begin_timeout(void)
{
    cli();

    OCR3A=0;
    TCCR3B |= (1 << WGM32);
    TCCR3B |= ((1 << CS30) | (0 << CS31) | (0 << CS32));
    TIMSK3 = (1 << OCIE3A);

    sei();
}
 
Status
Not open for further replies.
Back
Top