Fix delay function for F767

boxcar
Andy CA6JAU 2017-08-29 14:51:20 -03:00
parent ea37f67b91
commit 990bf2a16a
1 changed files with 8 additions and 1 deletions

View File

@ -764,9 +764,16 @@ void CIO::setP25Int(bool on)
#endif #endif
} }
// Simple delay function for STM32
// Example from: http://thehackerworkshop.com/?p=1209
void CIO::delayInt(unsigned int dly) void CIO::delayInt(unsigned int dly)
{ {
unsigned int loopsPerMillisecond = (SystemCoreClock/1000) / 3; //3 clock cycles per loop #if defined(STM32F7_NUCLEO)
unsigned int loopsPerMillisecond = (SystemCoreClock/1000);
#else
unsigned int loopsPerMillisecond = (SystemCoreClock/1000) / 3;
#endif
for (; dly > 0; dly--) for (; dly > 0; dly--)
{ {
asm volatile //this routine waits (approximately) one millisecond asm volatile //this routine waits (approximately) one millisecond