Skip to content

Hardware Timers #214

Closed
Closed
@williamhemmingsen

Description

@williamhemmingsen

Are there any examples of hardware timers for Arduino IDE? I have used ESP32 hw timers a lot, but can't make since of them in the ESP32.

I need to sample the adc a a specified rate. I would like to attachinterrupt to and ISR. Here is what I'm doing in the ESP8266. How do I do this in the ESP32?

void timer_init(void) {
timer1_isr_init();
timer1_attachInterrupt(sample_isr);
timer1_enable(TIM_DIV1, TIM_EDGE, TIM_LOOP);
timer1_write(8333); //9600 samples/s
}

void ICACHE_RAM_ATTR sample_isr() {
...do some stuff
}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions