summaryrefslogtreecommitdiff
path: root/src/arch/msp430fr5969lp
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-26 08:58:18 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-26 08:58:18 +0200
commit63cbb8facd9d9dc016f902bb312283f0b5f8d055 (patch)
tree2471edebf2eedade22ad8062169765204ec48630 /src/arch/msp430fr5969lp
parent6c5fc03b3e00d93d87511ad50396808913ef17f9 (diff)
Merge SoftI2C timer={0,1} code paths, adjust timing according to I2C spec
It's occasionally slower than specified, but should never be too fast
Diffstat (limited to 'src/arch/msp430fr5969lp')
-rw-r--r--src/arch/msp430fr5969lp/arch.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/arch/msp430fr5969lp/arch.cc b/src/arch/msp430fr5969lp/arch.cc
index cde0503..1eb34b5 100644
--- a/src/arch/msp430fr5969lp/arch.cc
+++ b/src/arch/msp430fr5969lp/arch.cc
@@ -104,8 +104,14 @@ volatile char run_loop = 0;
void Arch::delay_us(unsigned int const us)
{
- for (unsigned int i = 0; i < us/10; i++) {
- __delay_cycles(F_CPU / 100000UL);
+ if (us < 10) {
+ for (unsigned int i = 0; i < us; i++) {
+ __delay_cycles(F_CPU / 1000000UL);
+ }
+ } else {
+ for (unsigned int i = 0; i < us/10; i++) {
+ __delay_cycles(F_CPU / 100000UL);
+ }
}
}
void Arch::delay_ms(unsigned int const ms)