]> code.bitgloo.com Git - clyne/msp430-temp-lcd.git/commitdiff
base code, initial commit of code
authorClyne Sullivan <tullivan99@gmail.com>
Mon, 29 Apr 2019 13:31:55 +0000 (09:31 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Mon, 29 Apr 2019 13:31:55 +0000 (09:31 -0400)
.gitignore [new file with mode: 0644]
LICENSE
Makefile [new file with mode: 0644]
board.c [new file with mode: 0644]
board.h [new file with mode: 0644]
main.c [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..aebd027
--- /dev/null
@@ -0,0 +1,4 @@
+.*.swp
+.*.swo
+*.o
+*.elf
diff --git a/LICENSE b/LICENSE
index f288702d2fa16d3cdf0035b15a9fcbc552cd88e7..0a2daba845d8055a7c2666d110e6fb9af85f34b4 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -620,55 +620,3 @@ copy of the Program in return for a fee.
 
                      END OF TERMS AND CONDITIONS
 
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<https://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..cdfb395
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+CC = msp430-gcc
+CFLAGS = -mmcu=msp430g2553 -std=gnu99 \
+        -Os
+
+CSRC = board.c \
+       main.c
+COBJ = $(patsubst %.c, %.o, $(CSRC))
+
+ELF = main.elf
+
+all: $(ELF)
+
+clean:
+       @echo "  CLEAN"
+       @rm -f $(ELF) $(COBJ)
+
+$(ELF): $(COBJ)
+       @echo "  CC    " $@
+       @$(CC) $(CFLAGS) $(COBJ) -o $(ELF)
+
+%.o: %.c
+       @echo "  CC    " $<
+       @$(CC) $(CFLAGS) -c $< -o $@
+
diff --git a/board.c b/board.c
new file mode 100644 (file)
index 0000000..26db473
--- /dev/null
+++ b/board.c
@@ -0,0 +1,47 @@
+/**
+ * @file board.c
+ * Provides board configuration and initialization.
+ *
+ * Copyright (C) 2019  Clyne Sullivan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "board.h"
+
+static void boardInitWatchdog(void);
+static void boardInitPins(void);
+
+void boardInit(void)
+{
+       boardInitWatchdog();
+       boardInitPins();
+}
+
+void boardInitWatchdog(void)
+{
+       WDTCTL = WDTHOLD | WDTPW;
+}
+
+void boardInitPins(void)
+{
+       // All pins are output
+       P1DIR = PORT1_PINS;
+       P2DIR = PORT2_PINS;
+
+       // All pins should start at a low state
+       P1OUT = 0;
+       P2OUT = 0;
+}
+
diff --git a/board.h b/board.h
new file mode 100644 (file)
index 0000000..c521e7e
--- /dev/null
+++ b/board.h
@@ -0,0 +1,47 @@
+/**
+ * @file board.h
+ * Provides board configuration and initialization.
+ *
+ * Copyright (C) 2019  Clyne Sullivan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#include <msp430.h>
+#include <stdint.h>
+
+// Port 1 pins
+#define LED      (1 << 0)
+#define TEMP_SCL (1 << 6)
+#define TEMP_SDA (1 << 7)
+
+#define PORT1_PINS (LED | TEMP_SCL | TEMP_SDA)
+
+// Port 2 pins
+#define LCD_DAT (0x0F)
+#define LCD_E   (1 << 4)
+#define LCD_RW  (1 << 5)
+#define LCD_RS  (1 << 6)
+
+#define PORT2_PINS (LCD_DAT | LCD_E | LCD_RW | LCD_RS)
+
+/**
+ * Initializes pins and core functionality.
+ */
+void boardInit(void);
+
+#endif // BOARD_H_
diff --git a/main.c b/main.c
new file mode 100644 (file)
index 0000000..ed788a5
--- /dev/null
+++ b/main.c
@@ -0,0 +1,30 @@
+/**
+ * @file main.c
+ * Main program entry point.
+ *
+ * Copyright (C) 2019  Clyne Sullivan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include "board.h"
+
+void main(void)
+{
+       // Prepare processor and IO
+       boardInit();
+
+       while (1);
+}
+