aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2023-11-02 21:37:34 -0400
committerClyne Sullivan <clyne@bitgloo.com>2023-11-02 21:37:34 -0400
commit4a1ec245925b007f02396c30a67d726a1fceb0bb (patch)
treef541a2e127157256e8c1ad12682f19f601b936ce
parentea026f8d67c411fc4a0d8b255a2653753258175e (diff)
msp430: include core-ext and tools
-rw-r--r--Makefile2
-rw-r--r--forth/msp430.fth1
-rw-r--r--forth/tools.fth11
-rw-r--r--msp430/alee-msp430.cpp20
4 files changed, 22 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index c0c818a..af43bf3 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ msp430: CXXFLAGS += -DMEMDICTSIZE=1024 -flto -fno-asynchronous-unwind-tables -fn
msp430: LDFLAGS += -L/usr/msp430-elf/usr/include -Tmsp430/msp430fr2476.ld -Wl,-gc-sections
msp430: msp430/alee-msp430
-msp430-prep: STANDALONE += forth/msp430.fth
+msp430-prep: STANDALONE += forth/core-ext.fth forth/tools.fth forth/msp430.fth
msp430-prep: core.fth.h
msp430-prep: clean-lib
diff --git a/forth/msp430.fth b/forth/msp430.fth
index 9ba88bf..9fb041f 100644
--- a/forth/msp430.fth
+++ b/forth/msp430.fth
@@ -840,3 +840,4 @@
: UCB1IV_H 05AF ;
decimal
+
diff --git a/forth/tools.fth b/forth/tools.fth
index 8992d48..b27955d 100644
--- a/forth/tools.fth
+++ b/forth/tools.fth
@@ -11,14 +11,3 @@
>r cell+ rot drop r> @ then
-rot swap type space \ lt adv
over _begin <> while - repeat 2drop ;
-
-( xt -- caddr u )
-: _nameof _latest @ begin \ xt lt
- 2dup < while \ xt lt
- dup @ \ xt lt l
- dup 6 >> 1023 < if \ xt lt l
- 6 >> - else
- drop dup cell+ @ - then \ xt lt
- repeat nip \ lt
- dup @ swap cell+ over 31 & \ l lt len
- rot 6 >> 1023 = if swap cell+ swap then ; \ lt len
diff --git a/msp430/alee-msp430.cpp b/msp430/alee-msp430.cpp
index 92f3aa5..1d8d157 100644
--- a/msp430/alee-msp430.cpp
+++ b/msp430/alee-msp430.cpp
@@ -178,6 +178,13 @@ void initGPIO()
P5DIR |= BIT5 | BIT6 | BIT7;
P5OUT |= BIT5 | BIT6 | BIT7;
+ // Setup buttons w/ pullups
+ P3DIR &= ~BIT4; P3REN |= BIT4; P3OUT |= BIT4;
+ P2DIR &= ~BIT3; P2REN |= BIT3; P2OUT |= BIT3;
+
+ // XT1 pins (P2.0 and P2.1)
+ //P2SEL1 |= BIT0 | BIT1;
+
// Allow GPIO configurations to be applied
PM5CTL0 &= ~LOCKLPM5;
@@ -198,6 +205,19 @@ void initClock()
CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz
// default DCODIV as MCLK and SMCLK source
+
+// // ACLK to XT1
+// do
+// {
+// CSCTL7 &= ~(XT1OFFG | DCOFFG); // Clear XT1 and DCO fault flag
+// SFRIFG1 &= ~OFIFG;
+// }while (SFRIFG1 & OFIFG); // Test oscillator fault flag
+//
+// CSCTL4 = SELMS__DCOCLKDIV | SELA__XT1CLK; // set ACLK = XT1CLK = 32768Hz
+// // DCOCLK = MCLK and SMCLK source
+//
+// // Now that osc is running enable fault interrupt
+// SFRIE1 |= OFIE;
}
void initUART()