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

msp430: Add preprocessor macro for CPU speed

parent 29414b30
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
#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;
}
......
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