Improve struct and namespace usage

This commit is contained in:
Jaby
2023-01-08 21:08:23 +01:00
committed by Jaby
parent 274b3dc243
commit 068eb48557
14 changed files with 169 additions and 177 deletions

View File

@@ -28,6 +28,8 @@ namespace JabyEngine {
}
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 uint16_t Target = MS_Per_Tick<uint16_t>(CPU_Frequncey_Hz_Div8)*10;
@@ -37,8 +39,8 @@ namespace JabyEngine {
__syscall_SysEnqIntRP(Timer2Irq, &IRQCallback);
__syscall_ExitCriticalSection();
Counter2::Timer.target.write(CounterTarget::CounterTargetValue.with(Target));
Counter2::Timer.mode.write(Mode);
Counter2.target.write(CounterTarget::CounterTargetValue.with(Target));
Counter2.mode.write(Mode);
Interrupt::enable_irq(Interrupt::Timer2);
}