diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2019-04-29 09:31:55 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2019-04-29 09:31:55 -0400 |
commit | 249fa2dd7bcd8ed0be64a1a1b36da499d6bbaca1 (patch) | |
tree | 615eb7d8249e25d86c5ab65fa5ae6ad06e7810c3 | |
parent | 569dbb6c2d5eb852d2032774061f84a8f16b5666 (diff) |
base code, initial commit of code
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | LICENSE | 52 | ||||
-rw-r--r-- | Makefile | 24 | ||||
-rw-r--r-- | board.c | 47 | ||||
-rw-r--r-- | board.h | 47 | ||||
-rw-r--r-- | main.c | 30 |
6 files changed, 152 insertions, 52 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aebd027 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.*.swp +.*.swo +*.o +*.elf @@ -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 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 $@ + @@ -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; +} + @@ -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_ @@ -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); +} + |