summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-08-07 10:18:25 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-08-07 10:18:25 +0200
commitf6a842b1b064c83d42dfd626e888f79e4c1633e8 (patch)
tree5fb6088e10bd7fec2855a4c2a4914812e33a1be3 /src/arch
parent353aa77910b3a9eeb8282539b17c76c7c7ec0dc7 (diff)
Support optional SoftI2C pullups on MSP430
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/msp430fr5969lp/arch.cc7
-rw-r--r--src/arch/msp430fr5969lp/driver/i2c.cc2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/arch/msp430fr5969lp/arch.cc b/src/arch/msp430fr5969lp/arch.cc
index 9ea49b7..ddb84a4 100644
--- a/src/arch/msp430fr5969lp/arch.cc
+++ b/src/arch/msp430fr5969lp/arch.cc
@@ -72,6 +72,13 @@ extern void loop();
volatile char run_loop = 0;
#endif
+void Arch::delay_us(unsigned char const us)
+{
+ for (int i = 0; i < us/10; i++) {
+ __delay_cycles(160);
+ }
+}
+
void Arch::idle_loop(void)
{
while (1) {
diff --git a/src/arch/msp430fr5969lp/driver/i2c.cc b/src/arch/msp430fr5969lp/driver/i2c.cc
index fffc28c..55f8591 100644
--- a/src/arch/msp430fr5969lp/driver/i2c.cc
+++ b/src/arch/msp430fr5969lp/driver/i2c.cc
@@ -16,7 +16,7 @@ signed char I2C::setup()
UCB0CTL1 &= ~UCSWRST;
UCB0I2CSA = 0;
- __delay_cycles(1600);
+ arch.delay_us(100);
if (UCB0STAT & UCBBUSY)
return -1;