diff options
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/msp430fr5969lp/Makefile.inc | 1 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/driver/spi_b.cc | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/arch/msp430fr5969lp/Makefile.inc b/src/arch/msp430fr5969lp/Makefile.inc index 5512cb9..28c1cef 100644 --- a/src/arch/msp430fr5969lp/Makefile.inc +++ b/src/arch/msp430fr5969lp/Makefile.inc @@ -5,6 +5,7 @@ MCU = msp430fr5969 INCLUDES += -I/opt/msp430/ti/gcc/include COMMON_FLAGS += -mcpu=${CPU} -mmcu=${MCU} -DMULTIPASS_ARCH_msp430fr5969lp +COMMON_FLAGS += -DF_CPU=16000000UL COMMON_FLAGS += -DMULTIPASS_ARCH_HAS_I2C CC = /opt/msp430/ti/gcc/bin/msp430-elf-gcc diff --git a/src/arch/msp430fr5969lp/driver/spi_b.cc b/src/arch/msp430fr5969lp/driver/spi_b.cc index 2eb3a79..0fa71da 100644 --- a/src/arch/msp430fr5969lp/driver/spi_b.cc +++ b/src/arch/msp430fr5969lp/driver/spi_b.cc @@ -1,6 +1,10 @@ #include "driver/spi_b.h" #include <msp430.h> +#ifndef F_I2C +#define F_I2C 1000000UL +#endif + void SPI::setup() { UCB0CTLW0 |= UCSWRST; @@ -22,7 +26,8 @@ void SPI::setup() //P1REN |= BIT6; UCB0CTLW0 = UCCKPH | UCMSB | UCMST | UCSYNC | UCMODE_0 | UCSSEL__SMCLK | UCSWRST; - UCB0BRW = 15; // /16 -> 1MHz + UCB0BRW = (F_CPU/F_I2C)-1; // /16 -> 1MHz + // UCB0BRW = (F_CPU / F_I2C) - 1 UCB0CTLW0 &= ~UCSWRST; } |