From 990bf2a16a8a2775a28263fb0f209a687971fd7d Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Tue, 29 Aug 2017 14:51:20 -0300 Subject: [PATCH] Fix delay function for F767 --- IOSTM.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/IOSTM.cpp b/IOSTM.cpp index 8082cfb..e2f9b00 100644 --- a/IOSTM.cpp +++ b/IOSTM.cpp @@ -764,9 +764,16 @@ void CIO::setP25Int(bool on) #endif } +// Simple delay function for STM32 +// Example from: http://thehackerworkshop.com/?p=1209 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--) { asm volatile //this routine waits (approximately) one millisecond