Skip to content

Cannot acknowledge timer interrupt flag #156

@mcbridejc

Description

@mcbridejc

I'm attempting to use a periodic timer using the HAL Timer driver, on an stm32f031, and have hit a limitation.

I can instantiate it and use the driver to setup the desired overflow rate, and then turn on the interrrupt -- so that's easy enough:

let timer = hal::timers::Timer::<pac::TIM16>::tim16(cx.device.TIM16, 1.khz(), &mut rcc);
timer.listen(hal::timers::Event::TimeOut);

I can then create a handler for the TIM16 vector... but now I need to clear the UIF flag, and the only way I can come up with to do it is to steal another copy of the TIM16 register block. One solution is that probably the driver should provide a way to clear the interrupt flags, but it seems to me that a more general solution is to make the tim field (the reg block) public so that if I have a mutable Timer I can manipulate it's registers as well -- this allows for more general extensions of the driver as well as simply clearing the interrupt flag.

Perhaps I am missing something about the intended use here. I'm fairly new to Rust still -- still trying to adapt from C++.

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