Cleanup code

This commit is contained in:
2023-01-08 16:39:26 +01:00
parent 7b1cefac0a
commit 297526e4d0
4 changed files with 17 additions and 10 deletions

View File

@@ -31,16 +31,14 @@ namespace JabyEngine {
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;
printf("Timer2 Target: %i\n", Target);
Interrupt::disable_irq(Interrupt::Timer2);
__syscall_EnterCriticalSection();
__syscall_SysEnqIntRP(Timer2Irq, &IRQCallback);
__syscall_ExitCriticalSection();
Counter[2].target.write(CounterTarget::CounterTargetValue.with(Target));
Counter[2].mode.write(Mode);
Counter2::Timer.target.write(CounterTarget::CounterTargetValue.with(Target));
Counter2::Timer.mode.write(Mode);
Interrupt::enable_irq(Interrupt::Timer2);
}

View File

@@ -20,10 +20,12 @@ namespace JabyEngine {
}
uint32_t interrupt_handler(uint32_t) {
GlobalTime::global_counter++;
GlobalTime::global_counter = GlobalTime::global_counter + 1;
Interrupt::ack_irg(Interrupt::Timer2);
__syscall_ReturnFromException();
// v to make GCC happy
return 0;
}
InterrupCallback IRQCallback = {