Convert Timer IO

This commit is contained in:
2023-03-18 16:04:05 +01:00
parent 47484a8056
commit 33b5d4d3b7
4 changed files with 97 additions and 68 deletions

View File

@@ -18,7 +18,7 @@
void setup() {
using namespace Timer_IO;
static constexpr auto Mode = CounterMode::with(CounterMode::FreeRun, Counter2::SyncMode::Freerun, CounterMode::ResetAfterTarget, CounterMode::IRQAtTarget, CounterMode::IRQEveryTime, CounterMode::IRQPulse, Counter2::Source::System_Clock_Div_8);
static constexpr auto Mode = CounterMode_t::from(CounterMode_t::FreeRun, Counter2_v::SyncMode::FreeRun, CounterMode_t::ResetAfterTarget, CounterMode_t::IRQAtTarget, CounterMode_t::IRQEveryTime, CounterMode_t::IRQPulse, Counter2_v::Source::System_Clock_Div_8);
Interrupt::disable_irq(Interrupt::Timer2);
@@ -26,8 +26,8 @@
__syscall_SysEnqIntRP(Timer2Irq, &IRQCallback);
__syscall_ExitCriticalSection();
Counter2.target.write(CounterTarget::CounterTargetValue.with(HighResTime::TicksFor10ms));
Counter2.mode.write({Mode});
Counter2.set_target_value(HighResTime::TicksFor10ms);
Counter2.set_mode(Mode);
Interrupt::enable_irq(Interrupt::Timer2);
}