Skip to content
Snippets Groups Projects
Commit 3e884d67 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

msp430: Fix delay_us/delay_ms for F_CPU≠16MHz

parent 8692f49b
No related branches found
No related tags found
No related merge requests found
...@@ -105,13 +105,13 @@ volatile char run_loop = 0; ...@@ -105,13 +105,13 @@ volatile char run_loop = 0;
void Arch::delay_us(unsigned int const us) void Arch::delay_us(unsigned int const us)
{ {
for (unsigned int i = 0; i < us/10; i++) { 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) void Arch::delay_ms(unsigned int const ms)
{ {
for (unsigned int i = 0; i < ms; i++) { for (unsigned int i = 0; i < ms; i++) {
__delay_cycles(16000); __delay_cycles(F_CPU / 1000UL);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment