kopia lustrzana https://github.com/OpenRTX/OpenRTX
Calibrated delayMs and delayUs on MK22FN512xx MCU
rodzic
efb235ae4e
commit
5581276ec5
|
@ -25,7 +25,7 @@ void delayUs(unsigned int useconds)
|
||||||
{
|
{
|
||||||
// This delay has been calibrated to take x microseconds
|
// This delay has been calibrated to take x microseconds
|
||||||
// It is written in assembler to be independent on compiler optimization
|
// It is written in assembler to be independent on compiler optimization
|
||||||
asm volatile(" mov r1, #42 \n"
|
asm volatile(" mov r1, #24 \n"
|
||||||
" mul r2, %0, r1 \n"
|
" mul r2, %0, r1 \n"
|
||||||
" mov r1, #0 \n"
|
" mov r1, #0 \n"
|
||||||
"___loop_u: cmp r1, r2 \n"
|
"___loop_u: cmp r1, r2 \n"
|
||||||
|
@ -36,7 +36,7 @@ void delayUs(unsigned int useconds)
|
||||||
|
|
||||||
void delayMs(unsigned int mseconds)
|
void delayMs(unsigned int mseconds)
|
||||||
{
|
{
|
||||||
register const unsigned int count=42000;
|
register const unsigned int count=30000;
|
||||||
|
|
||||||
for(unsigned int i=0;i<mseconds;i++)
|
for(unsigned int i=0;i<mseconds;i++)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue