From 3e884d678b5bd2871452bdfb81be3d9ea4fa4431 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 25 Oct 2018 14:23:44 +0200 Subject: msp430: Fix delay_us/delay_ms for F_CPU≠16MHz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/arch/msp430fr5969lp/arch.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/arch/msp430fr5969lp') diff --git a/src/arch/msp430fr5969lp/arch.cc b/src/arch/msp430fr5969lp/arch.cc index b3cfbf6..cde0503 100644 --- a/src/arch/msp430fr5969lp/arch.cc +++ b/src/arch/msp430fr5969lp/arch.cc @@ -105,13 +105,13 @@ volatile char run_loop = 0; void Arch::delay_us(unsigned int const us) { for (unsigned int i = 0; i < us/10; i++) { - __delay_cycles(160); + __delay_cycles(F_CPU / 100000UL); } } void Arch::delay_ms(unsigned int const ms) { for (unsigned int i = 0; i < ms; i++) { - __delay_cycles(16000); + __delay_cycles(F_CPU / 1000UL); } } -- cgit v1.2.3