summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-12 10:47:37 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-12 10:47:37 +0200
commita6627709f7348dcfdcb7cd87a24ba7a80730487b (patch)
treef34d208cece85eeabcbfcac4688dead17804af87
parent69c6db98f12f1fe103a1177ec37444bc3024645f (diff)
MSP430 I2C: Configurable I2C frequency
-rw-r--r--src/arch/msp430fr5969lp/driver/i2c.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/arch/msp430fr5969lp/driver/i2c.cc b/src/arch/msp430fr5969lp/driver/i2c.cc
index 55f8591..be41a50 100644
--- a/src/arch/msp430fr5969lp/driver/i2c.cc
+++ b/src/arch/msp430fr5969lp/driver/i2c.cc
@@ -8,7 +8,7 @@ signed char I2C::setup()
{
UCB0CTL1 = UCSWRST;
UCB0CTLW0 = UCMODE_3 | UCMST | UCSYNC | UCSSEL_2 | UCSWRST | UCCLTO_1;
- UCB0BRW = 0xf00;
+ UCB0BRW = (F_CPU / F_I2C) - 1;
P1DIR &= ~(BIT6 | BIT7);
P1SEL0 &= ~(BIT6 | BIT7);
P1SEL1 |= BIT6 | BIT7;