22 lines
414 B
C++
22 lines
414 B
C++
module;
|
|
#include "CortexM4.h"
|
|
#include "system.h"
|
|
export module sys;
|
|
|
|
static volatile unsigned count = 0u;
|
|
extern "C" void SysTick_Handler () {
|
|
if (count) count -= 1u;
|
|
}
|
|
namespace sys {
|
|
export void delay (const unsigned ms = 500) {
|
|
count = ms;
|
|
while (count) {
|
|
asm volatile ("wfi");
|
|
}
|
|
}
|
|
export void init () {
|
|
EnableDebugOnSleep();
|
|
SysTick.Config (SystemCoreClock / 1000u);
|
|
}
|
|
};
|
|
|