Adding LEDs selftest at start-up

This commit is contained in:
Andy CA6JAU 2017-08-28 00:43:24 -03:00
parent cce2cc3cfc
commit 70e1fd4264
5 changed files with 66 additions and 1 deletions

View file

@ -764,4 +764,23 @@ void CIO::setP25Int(bool on)
#endif
}
void CIO::delayInt(unsigned int dly)
{
unsigned int loopsPerMillisecond = (SystemCoreClock/1000) / 3; //3 clock cycles per loop
for (; dly > 0; dly--)
{
asm volatile //this routine waits (approximately) one millisecond
(
"mov r3, %[loopsPerMillisecond] \n\t" //load the initial loop counter
"loop: \n\t"
"subs r3, #1 \n\t"
"bne loop \n\t"
: //empty output list
: [loopsPerMillisecond] "r" (loopsPerMillisecond) //input to the asm routine
: "r3", "cc" //clobber list
);
}
}
#endif