1
0

added more code

This commit is contained in:
Andrew W
2022-08-28 16:12:16 -05:00
parent 5a2894ed1b
commit 7dabaef6f6
2345 changed files with 1343530 additions and 0 deletions

View File

@ -0,0 +1,54 @@
# FIXED
FinalProject.obj: ../FinalProject.c
FinalProject.obj: C:/ti/ccs1040/ccs/ccs_base/msp430/include/msp430.h
FinalProject.obj: C:/ti/ccs1040/ccs/ccs_base/msp430/include/msp430fg4618.h
FinalProject.obj: C:/ti/ccs1040/ccs/ccs_base/msp430/include/in430.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/intrinsics.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/intrinsics_legacy_undefs.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/string.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/_ti_config.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/linkage.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/sys/cdefs.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/xlocale/_string.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/stdio.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/stdarg.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/sys/_types.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/machine/_types.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/stdlib.h
FinalProject.obj: C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/stdbool.h
../FinalProject.c:
C:/ti/ccs1040/ccs/ccs_base/msp430/include/msp430.h:
C:/ti/ccs1040/ccs/ccs_base/msp430/include/msp430fg4618.h:
C:/ti/ccs1040/ccs/ccs_base/msp430/include/in430.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/intrinsics.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/intrinsics_legacy_undefs.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/string.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/_ti_config.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/linkage.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/sys/cdefs.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/xlocale/_string.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/stdio.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/stdarg.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/sys/_types.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/machine/_types.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/stdlib.h:
C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include/stdbool.h:

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
"./FinalProject.obj" "../lnk_msp430fg4618.cmd" -llibc.a

View File

@ -0,0 +1,166 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL = cmd.exe
CG_TOOL_ROOT := C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS
GEN_OPTS__FLAG :=
GEN_CMDS__FLAG :=
ORDERED_OBJS += \
"./FinalProject.obj" \
"../lnk_msp430fg4618.cmd" \
$(GEN_CMDS__FLAG) \
-llibc.a \
-include ../makefile.init
RM := DEL /F
RMDIR := RMDIR /S/Q
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir_vars.mk
-include subdir_rules.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C55_DEPS)),)
-include $(C55_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(S67_DEPS)),)
-include $(S67_DEPS)
endif
ifneq ($(strip $(S62_DEPS)),)
-include $(S62_DEPS)
endif
ifneq ($(strip $(S_DEPS)),)
-include $(S_DEPS)
endif
ifneq ($(strip $(OPT_DEPS)),)
-include $(OPT_DEPS)
endif
ifneq ($(strip $(C??_DEPS)),)
-include $(C??_DEPS)
endif
ifneq ($(strip $(ASM_UPPER_DEPS)),)
-include $(ASM_UPPER_DEPS)
endif
ifneq ($(strip $(S??_DEPS)),)
-include $(S??_DEPS)
endif
ifneq ($(strip $(C64_DEPS)),)
-include $(C64_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(S64_DEPS)),)
-include $(S64_DEPS)
endif
ifneq ($(strip $(INO_DEPS)),)
-include $(INO_DEPS)
endif
ifneq ($(strip $(CLA_DEPS)),)
-include $(CLA_DEPS)
endif
ifneq ($(strip $(S55_DEPS)),)
-include $(S55_DEPS)
endif
ifneq ($(strip $(SV7A_DEPS)),)
-include $(SV7A_DEPS)
endif
ifneq ($(strip $(C62_DEPS)),)
-include $(C62_DEPS)
endif
ifneq ($(strip $(C67_DEPS)),)
-include $(C67_DEPS)
endif
ifneq ($(strip $(PDE_DEPS)),)
-include $(PDE_DEPS)
endif
ifneq ($(strip $(K_DEPS)),)
-include $(K_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C43_DEPS)),)
-include $(C43_DEPS)
endif
ifneq ($(strip $(S43_DEPS)),)
-include $(S43_DEPS)
endif
ifneq ($(strip $(ASM_DEPS)),)
-include $(ASM_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(SA_DEPS)),)
-include $(SA_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
EXE_OUTPUTS += \
FinalProject.out \
EXE_OUTPUTS__QUOTED += \
"FinalProject.out" \
BIN_OUTPUTS += \
FinalProject.hex \
BIN_OUTPUTS__QUOTED += \
"FinalProject.hex" \
# All Target
all: $(OBJS) $(CMD_SRCS) $(GEN_CMDS)
@$(MAKE) --no-print-directory -Onone "FinalProject.out"
# Tool invocations
FinalProject.out: $(OBJS) $(CMD_SRCS) $(GEN_CMDS)
@echo 'Building target: "$@"'
@echo 'Invoking: MSP430 Linker'
"C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/bin/cl430" -vmspx --data_model=restricted --use_hw_mpy=16 --advice:power=all --define=__MSP430FG4618__ -g --printf_support=full --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU19 -z -m"FinalProject.map" --heap_size=80 --stack_size=80 --cinit_hold_wdt=on -i"C:/ti/ccs1040/ccs/ccs_base/msp430/include" -i"C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/lib" -i"C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="FinalProject_linkInfo.xml" --use_hw_mpy=16 --rom_model -o "FinalProject.out" $(ORDERED_OBJS)
@echo 'Finished building target: "$@"'
@echo ' '
FinalProject.hex: $(EXE_OUTPUTS)
@echo 'Building secondary target: "$@"'
@echo 'Invoking: MSP430 Hex Utility'
"C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/bin/hex430" --memwidth=8 --romwidth=8 --diag_wrap=off -o "FinalProject.hex" $(EXE_OUTPUTS__QUOTED)
@echo 'Finished building secondary target: "$@"'
@echo ' '
# Other Targets
clean:
-$(RM) $(BIN_OUTPUTS__QUOTED)$(EXE_OUTPUTS__QUOTED)
-$(RM) "FinalProject.obj"
-$(RM) "FinalProject.d"
-@echo 'Finished clean'
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets

View File

@ -0,0 +1,8 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
USER_OBJS :=
LIBS := -llibc.a

View File

@ -0,0 +1,115 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
C55_SRCS :=
A_SRCS :=
ASM_UPPER_SRCS :=
EXE_SRCS :=
LDS_UPPER_SRCS :=
CPP_SRCS :=
CMD_SRCS :=
O_SRCS :=
ELF_SRCS :=
C??_SRCS :=
C64_SRCS :=
C67_SRCS :=
SA_SRCS :=
S64_SRCS :=
OPT_SRCS :=
CXX_SRCS :=
S67_SRCS :=
S??_SRCS :=
PDE_SRCS :=
SV7A_SRCS :=
K_SRCS :=
CLA_SRCS :=
S55_SRCS :=
LD_UPPER_SRCS :=
OUT_SRCS :=
INO_SRCS :=
LIB_SRCS :=
ASM_SRCS :=
S_UPPER_SRCS :=
S43_SRCS :=
LD_SRCS :=
CMD_UPPER_SRCS :=
C_UPPER_SRCS :=
C++_SRCS :=
C43_SRCS :=
OBJ_SRCS :=
LDS_SRCS :=
S_SRCS :=
CC_SRCS :=
S62_SRCS :=
C62_SRCS :=
C_SRCS :=
C55_DEPS :=
C_UPPER_DEPS :=
S67_DEPS :=
S62_DEPS :=
S_DEPS :=
OPT_DEPS :=
C??_DEPS :=
ASM_UPPER_DEPS :=
S??_DEPS :=
C64_DEPS :=
CXX_DEPS :=
S64_DEPS :=
INO_DEPS :=
CLA_DEPS :=
S55_DEPS :=
SV7A_DEPS :=
EXE_OUTPUTS :=
C62_DEPS :=
C67_DEPS :=
PDE_DEPS :=
K_DEPS :=
C_DEPS :=
CC_DEPS :=
BIN_OUTPUTS :=
C++_DEPS :=
C43_DEPS :=
S43_DEPS :=
OBJS :=
ASM_DEPS :=
S_UPPER_DEPS :=
CPP_DEPS :=
SA_DEPS :=
C++_DEPS__QUOTED :=
OPT_DEPS__QUOTED :=
S_UPPER_DEPS__QUOTED :=
SA_DEPS__QUOTED :=
C??_DEPS__QUOTED :=
S67_DEPS__QUOTED :=
C55_DEPS__QUOTED :=
CC_DEPS__QUOTED :=
ASM_UPPER_DEPS__QUOTED :=
SV7A_DEPS__QUOTED :=
S??_DEPS__QUOTED :=
OBJS__QUOTED :=
C67_DEPS__QUOTED :=
K_DEPS__QUOTED :=
S55_DEPS__QUOTED :=
INO_DEPS__QUOTED :=
C62_DEPS__QUOTED :=
C_DEPS__QUOTED :=
C_UPPER_DEPS__QUOTED :=
C43_DEPS__QUOTED :=
CPP_DEPS__QUOTED :=
BIN_OUTPUTS__QUOTED :=
C64_DEPS__QUOTED :=
CXX_DEPS__QUOTED :=
CLA_DEPS__QUOTED :=
S_DEPS__QUOTED :=
ASM_DEPS__QUOTED :=
S43_DEPS__QUOTED :=
EXE_OUTPUTS__QUOTED :=
S64_DEPS__QUOTED :=
S62_DEPS__QUOTED :=
PDE_DEPS__QUOTED :=
# Every subdirectory with source files must be described here
SUBDIRS := \
. \

View File

@ -0,0 +1,15 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL = cmd.exe
# Each subdirectory must supply rules for building sources it contributes
%.obj: ../%.c $(GEN_OPTS) | $(GEN_FILES) $(GEN_MISC_FILES)
@echo 'Building file: "$<"'
@echo 'Invoking: MSP430 Compiler'
"C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/bin/cl430" -vmspx --data_model=restricted --use_hw_mpy=16 --include_path="C:/ti/ccs1040/ccs/ccs_base/msp430/include" --include_path="C:/CPE325_Workspace/FinalProject" --include_path="C:/ti/ccs1040/ccs/tools/compiler/ti-cgt-msp430_20.2.5.LTS/include" --advice:power=all --define=__MSP430FG4618__ -g --printf_support=full --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU19 --preproc_with_compile --preproc_dependency="$(basename $(<F)).d_raw" $(GEN_OPTS__FLAG) "$<"
@echo 'Finished building: "$<"'
@echo ' '

View File

@ -0,0 +1,29 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
SHELL = cmd.exe
# Add inputs and outputs from these tool invocations to the build variables
CMD_SRCS += \
../lnk_msp430fg4618.cmd
C_SRCS += \
../FinalProject.c
C_DEPS += \
./FinalProject.d
OBJS += \
./FinalProject.obj
OBJS__QUOTED += \
"FinalProject.obj"
C_DEPS__QUOTED += \
"FinalProject.d"
C_SRCS__QUOTED += \
"../FinalProject.c"

View File

@ -0,0 +1,587 @@
#include <msp430.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define SW1_PRESSED ((BIT0&P1IFG)==0) // SW1 Status
#define SW2_PRESSED ((BIT1&P1IFG)==0) // SW2 Status
#define checkTime() (clockCheck=true)
#define GREENLED() (P2OUT|=BIT2)
#define REDLED() (P5OUT|=BIT1)
#define GREENLEDOFF() (P2OUT&=~BIT2)
#define REDLEDOFF() (P5OUT&=~BIT1)
// Struct used to define users
struct user
{
char *name;
char *password;
int admin;
};
struct user andrew;
struct user joe;
struct user bill;
struct user jeff;
struct user andrew = {.name = "Andrew", .admin = 1, .password = "an"};
struct user joe = { .name = "Joe", .admin = 1, .password = "jo" };
struct user bill = { .name = "Bill", .admin = 0, .password = "bi" };
struct user jeff = { .name = "Jeff", .admin = 0, .password = "je" };
char user[];
char cpu[];
char askReset[];
char password[];
char command[];
//int admin;
int timeout=0;
int timer=0;
int Up=1;
bool clockCheck = false;
char SystemTime[];
//int diskspace = rand();
char time[];
bool test = false;
int update=0, timeCheck=0, upgrade=0, clock=0, timerCheck=0, data=0, logout=0;
bool admin = false;
bool nonadmin = false;
// Characters for clock
//#define RTC_STATE_SECONDS 0
//#define RTC_STATE_MINUTES 1
//#define RTC_STATE_HOURS 2
//
//volatile uint8_t timerCount = 0;
//volatile uint8_t rtcState[3] = {0, 0, 0};
unsigned int s, m, h;
int timerCount =0;
int diskspace;
// user tries to update and gets a buzzer and light
void clockFunc();
//upgrade the packages
void upgradeFunc();
// set a timer
void setTimer();
//void buzzer();
void resetBuzzer();
void setBuzzer();
void timerAInit(void){
// Enable Timer Interrupts
TACCTL0 = CCIE;
// SMCLK, Count to CCR0 Value, Divide by 8
TA0CTL = TASSEL_2 + MC_1 + ID_3;
// 1,000,000 / 8 / 25 = 5000
TACCR0 = 5000;
}
// checks string to see if correct,
// returns true if one of the users, false if not
bool stringCheck(char* string);
void updateFunc(); //update code when "update" is entered
void setup();
void promptOutput(); // Outputs prompt
void commandCheck(char* command);
void UART_setup(); // Configures UCI to work in the UART mode
// at the baud rate of 115200.
void UART_Send_Character(char my_char); // Sends a character via UART
void UARTsendString(char* string); // Sends a string via UART using
// send_Character(char c)
void UARTgetWord(char* buffer, int limit);
/* Receives characters via UART until it finds
the new line character or until the limit of
characters is exceeded. Writes that string
(excluding the new line character) to the
buffer allocated outside of the function.
Terminates the string with the null
character */
int stringLength(char *str); // String length
int main(void)
{
// WDTCTL = WDT_ADLY_1000; // 1 s interval
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
UART_setup();
setup();
//timerAInit();
UCA0TXBUF = 0x0D; // Carriage Return
clockFunc();
while(1){
//timeout =0;
UCA0TXBUF = 0x0D; // Carriage Return
UCA0TXBUF = 0x0D; // Carriage Return
clockFunc();
UARTsendString("\nPlease enter a username: "); // Output
UCA0RXBUF = 0x0D; // Carriage Return
clockFunc();
UARTgetWord(user, 30);
//clockFunc();
bool usercheck = stringCheck(user);
clockFunc();
UCA0TXBUF = 0x0D; // Carriage Return
clockFunc();
UARTsendString("\nPlease enter the password: ");
clockFunc();
//timeout = 1;
UARTgetWord(password, 30);
clockFunc();
bool passcheck = stringCheck(password);
clockFunc();
UCA0TXBUF = 0x0D; // Carriage Return
clockFunc();
if(usercheck && passcheck && admin) // If user and password match
{
clockFunc();
while(1){
clockFunc();
UCA0TXBUF = 0x0D; // Carriage Return
promptOutput();
clockFunc();
// char* commandEq;
UARTgetWord(command, 50);
//commandCheck(command);
//if(update==1)
if(strcmp(command, "update")==0)
{
GREENLED();
__delay_cycles(500000); // second
GREENLEDOFF();
clockFunc();
updateFunc();
//for(i=0; i ==stringLength(command); i++) command[i]=0x00;
}
else if(strcmp(command, "upgrade")==0)
{
GREENLED();
__delay_cycles(500000); // second
GREENLEDOFF();
clockFunc();
upgradeFunc();
}
else if(strcmp(command, "date")==0)
{
GREENLED();
__delay_cycles(500000); // second
GREENLEDOFF();
clockFunc();
clockFunc();
UARTsendString("The date is 1980, November 1. The time is ");
UARTsendString(SystemTime);
}
else if(strcmp(command, "timer")==0) // timer to reboot
{
GREENLED();
__delay_cycles(500000); // half-second
GREENLEDOFF();
clockFunc();
setTimer();
}
else if(strcmp(command, "data")==0)
{
GREENLED();
__delay_cycles(500000); // half-second
GREENLEDOFF();
clockFunc();
clockFunc();
setTimer();
}
else if(strcmp(command, "logout")==0)
{
GREENLED();
__delay_cycles(500000); // half-second
GREENLEDOFF();
clockFunc();
clockFunc();
break;
}
else
{
clockFunc();
REDLED();
setBuzzer();
__delay_cycles(500000); // half-second
resetBuzzer();
REDLEDOFF();
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("Unknown command.");
}
}
}
else if(usercheck && passcheck && admin==false)
{
while(1){
clockFunc();
UCA0TXBUF = 0x0D; // Carriage Return
promptOutput();
UARTgetWord(command, 50);
commandCheck(command);
if(strcmp(command, "upgrade")==0 || strcmp(command, "update")==0)
{
clockFunc();
REDLED();
setBuzzer();
__delay_cycles(500000); // half-second
resetBuzzer();
REDLEDOFF();
clockFunc();
}
else if(strcmp(command, "date")==0)
{
clockFunc();
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("The date is 1980, November 1. The time is ");
UARTsendString(SystemTime);
clockFunc();
}
else if(strcmp(command, "timer")==0)
{
GREENLED();
__delay_cycles(500000); // half-second
GREENLEDOFF();
clockFunc();
clockFunc();
setTimer();
}
else if(strcmp(command, "logout")==0)
{
GREENLED();
__delay_cycles(500000); // half-second
GREENLEDOFF();
clockFunc();
clockFunc();
break;
}
else
{
REDLED();
setBuzzer();
__delay_cycles(500000); // half-second
resetBuzzer();
REDLEDOFF();
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("Unknown command.");
}
}
}
else {
clockFunc();
UCA0TXBUF = '\n'; // Newline
UCA0TXBUF = 0x0D; // Carriage Return
REDLED();
setBuzzer();
__delay_cycles(500000); // half-second
resetBuzzer();
REDLEDOFF();
UARTsendString("\nInvalid username or password! Please try again.");
}
}
}
void promptOutput()
{
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\nWelcome!! Enter a command: \n");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\n1. Set timer: timer");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\n2. Check for system updates: update");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\n3. Update system: upgrade");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\n4. Check system time: date");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\n5. Logout: logout");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\nCommand: ");
}
void UART_setup()
{
P2SEL |= BIT4 + BIT5; // Set USCI_A0 RXD/TXD to receive/transmit data
UCA0CTL1 |= UCSWRST; // Set software reset during initialization
UCA0CTL0 = 0; // USCI_A0 control register
UCA0CTL1 |= UCSSEL_2; // Clock source SMCLK
UCA0BR0 = 0x09; // 1048576 Hz / 115200 lower byte
UCA0BR1 = 0x00; // upper byte
UCA0MCTL = 0x02; // Modulation (UCBRS0=0x01, UCOS16=0)
UCA0CTL1 &= ~UCSWRST; // Clear software reset to initialize USCI state machine
}
void setBuzzer()
{
TBCCR0 = 250;
TBCCR4 = 125;
}
void resetBuzzer()
{
TBCCR0 = 3500;
TBCCR4 = 3600;
}
void UART_Send_Character(char my_char)
{
while (!(IFG2 & UCA0TXIFG)); // Wait for previous character to transmit
UCA0TXBUF = my_char; // Put character into tx buffer
}
void UARTsendString(char* string)
{
int i=0;
int len = stringLength(string);
for(i =0; i<=len; i++) //loops over word
{
UART_Send_Character(string[i]);
}
}
void UARTgetWord(char* buffer, int limit)
{
int i;
for(i =0; i < limit; i++){
while(!(IFG2&UCA0RXIFG)); // Wait for a new character
buffer[i] = UCA0RXBUF;
if(buffer[i] == '\r' || buffer[i] == '\n' || buffer[i] == '\0'){
buffer[i] = '\0'; // end is here in UCA0RXBUF
return;
}
while(!(IFG2&UCA0TXIFG)); // Wait until TXBUF is free
UCA0TXBUF = UCA0RXBUF; // TXBUF <= RXBUF (echo)
}
}
int stringLength(char *str) // gets string length for word
{
int i=0;
while(str[i] != '\0') i++;
return i;
}
// Port 1 interrupt service routine
#pragma vector = PORT1_VECTOR
__interrupt void Port1_ISR (void) {
if(SW1_PRESSED)
{
main();
}
P1IES |= BIT0; // P1.0 hi/low edge
P1IFG &= ~BIT0; // P1.0 IFG cleared
P1IES |= BIT1; // P1.1 hi/low edge
P1IFG &= ~BIT1; // P1.1 IFG cleared
}
bool stringCheck(char* string)
{
if(strcmp(string,andrew.name) == 0
|| strcmp(string,joe.name) == 0
|| strcmp(string,andrew.password)== 0
|| strcmp(string,joe.password)== 0)
{
admin = true;
return true;
}
else if(strcmp(string,bill.name) == 0
|| strcmp(string,jeff.password)== 0
|| strcmp(string,jeff.name) == 0
|| strcmp(string,bill.password)== 0)
{
admin = false;
return true;
}
else
{
// UARTsendString("False ");
return false;
}
}
void setTimer()
{
UARTsendString("The system will reboot in 30 seconds.");
//UARTgetWord(time,5);
WDTCTL = WDT_ADLY_1000;
timerCheck=1;
}
void commandCheck(char* command)
{
if(strcmp(command, "update")==0)
{
update = 1;
return;
}
else if(strcmp(command, "upgrade")==0)
{
upgrade = 1;
return;
}
else if(strcmp(command, "time")==0)
{
timerCheck = 1;
return;
}
else if(strcmp(command, "clock")==0)
{
clock = 1;
return;
}
else if(strcmp(command, "logout")==0)
{
logout = 1;
return;
}
}
// Timer Interrupt
//#pragma vector = TIMER0_A0_VECTOR
//__interrupt void Timer_A(void){
// // static int timerCount =0;
// static int m =0;
// static int h =0;
// static int s =0;
// s++;
// if (s >= 60){
// s = 0;
// m++;
// if (m >= 60){
// m = 0;
// h++;
// if (h >= 24) {
// h = 0;
// }
// }
// }
// sprintf(cpu, "%d", s);
// sprintf(SystemTime, "%d%d%d",h,m,s);
// //TA0CCTL0 &=~ TAIFG;
//}
void setup()
{
_EINT(); // Enable interrupts
IE1 |= WDTIE; // Enable WDT interrupt
P2DIR |= (BIT1 + BIT2); // P2.1 and P2.2 set up as output
P5DIR |= BIT1; // REDLED set up as output
P2OUT &= ~BIT1; // Turn on LED2
P2OUT &= ~BIT2; // Turn Off LED1
P1IE |= BIT0; // P1.0 interrupt enabled
P1IE |= BIT1; // P1.1 interrupt enabled
P1IES |= BIT0; // P1.0 hi/low edge
P1IFG &= ~BIT0; // P1.0 IFG cleared
P1IES |= BIT1; // P1.1 hi/low edge
P1IFG &= ~BIT1; // P1.1 IFG cleared
P2OUT &= ~(BIT1+BIT2); // Turn Off LED1
GREENLEDOFF();
REDLEDOFF();
TB0CTL = TBSSEL_2 + MC_1; // SMCLK Clock source Upmode
TB0CCR0 = 32765; // Set TB4 count value
TB0CCR4 = 32767; // Set TB4 count value
P3SEL |= 0x20; // P3.5 as special function
P3DIR |= 0x20; // P3.5 as digital output
TB0CCTL4 = OUTMOD_3; // Set/Rest mode
}
void updateFunc()
{
UCA0TXBUF = 0x0D; // Carriage Return
// P2OUT |= BIT2;
UARTsendString("\nUpdating packages.");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\nHit:1 https://brave-browser-apt-release.s3.brave.com trusty InRelease");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\nHit:2 https://deb.debian.org/debian bullseye InRelease");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\nHit:3 https://repo.steampowered.com/steam stable InRelease");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\nHit:4 https://typora.io/linux ./ InRelease [793 B]");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\nReading package lists... Done");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\n9 packages can be upgraded. Run 'apt list --upgradable' to see them.");
UCA0TXBUF = 0x0D; // Carriage Return
}
void clockFunc()
{
static int timerCount =0;
static int h=0,m=0,s=0;
timerCount++;
timerCount = 0;
s++;
if (s >= 60){
s = 0;
m++;
if (m >= 60){
m = 0;
h++;
if (h >= 24) {
h = 0;
}
}
}
sprintf(cpu, "%d", s);
sprintf(SystemTime, "%d%d%d",h,m,s);
}
void upgradeFunc()
{
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\nThe following packages will be upgraded: ");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\n brave-browser steam:i386 steam-launcher steam-libs-amd64 steam-libs-i386:i386 typora");
UCA0TXBUF = 0x0D; // Carriage Return
UARTsendString("\n Preparing to unpack .../0-brave-browser_1.32.113_amd64.deb ...");
}
// Watchdog Timer interrupt service routine
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
{
static int i =0;
//static int c =0;
i++;
if(i==30 && timerCheck==1){
setBuzzer();
UCA0TXBUF = 0x0D; // Carriage Return
timerCheck=0;
IFG2=1;
resetBuzzer();
// systemTime();
main();
}
// systemTime();
//IFG2=1;
}

View File

@ -0,0 +1,184 @@
/* ============================================================================ */
/* Copyright (c) 2020, Texas Instruments Incorporated */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following conditions */
/* are met: */
/* */
/* * Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* */
/* * Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in the */
/* documentation and/or other materials provided with the distribution. */
/* */
/* * Neither the name of Texas Instruments Incorporated nor the names of */
/* its contributors may be used to endorse or promote products derived */
/* from this software without specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */
/* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */
/* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */
/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */
/* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */
/* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */
/* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* ============================================================================ */
/******************************************************************************/
/* lnk_msp430fg4618.cmd - LINKER COMMAND FILE FOR LINKING MSP430FG4618 PROGRAMS */
/* */
/* Usage: lnk430 <obj files...> -o <out file> -m <map file> lnk.cmd */
/* cl430 <src files...> -z -o <out file> -m <map file> lnk.cmd */
/* */
/*----------------------------------------------------------------------------*/
/* These linker options are for command line linking only. For IDE linking, */
/* you should set your linker options in Project Properties */
/* -c LINK USING C CONVENTIONS */
/* -stack 0x0100 SOFTWARE STACK SIZE */
/* -heap 0x0100 HEAP AREA SIZE */
/* */
/*----------------------------------------------------------------------------*/
/* Version: 1.211 */
/*----------------------------------------------------------------------------*/
/****************************************************************************/
/* Specify the system memory map */
/****************************************************************************/
MEMORY
{
SFR : origin = 0x0000, length = 0x0010
PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100
RAM : origin = 0x1100, length = 0x2000
INFOA : origin = 0x1080, length = 0x0080
INFOB : origin = 0x1000, length = 0x0080
FLASH : origin = 0x3100, length = 0xCEBE
FLASH2 : origin = 0x10000,length = 0x10000
BSLSIGNATURE : origin = 0xFFBE, length = 0x0002, fill = 0xFFFF
INT00 : origin = 0xFFC0, length = 0x0002
INT01 : origin = 0xFFC2, length = 0x0002
INT02 : origin = 0xFFC4, length = 0x0002
INT03 : origin = 0xFFC6, length = 0x0002
INT04 : origin = 0xFFC8, length = 0x0002
INT05 : origin = 0xFFCA, length = 0x0002
INT06 : origin = 0xFFCC, length = 0x0002
INT07 : origin = 0xFFCE, length = 0x0002
INT08 : origin = 0xFFD0, length = 0x0002
INT09 : origin = 0xFFD2, length = 0x0002
INT10 : origin = 0xFFD4, length = 0x0002
INT11 : origin = 0xFFD6, length = 0x0002
INT12 : origin = 0xFFD8, length = 0x0002
INT13 : origin = 0xFFDA, length = 0x0002
INT14 : origin = 0xFFDC, length = 0x0002
INT15 : origin = 0xFFDE, length = 0x0002
INT16 : origin = 0xFFE0, length = 0x0002
INT17 : origin = 0xFFE2, length = 0x0002
INT18 : origin = 0xFFE4, length = 0x0002
INT19 : origin = 0xFFE6, length = 0x0002
INT20 : origin = 0xFFE8, length = 0x0002
INT21 : origin = 0xFFEA, length = 0x0002
INT22 : origin = 0xFFEC, length = 0x0002
INT23 : origin = 0xFFEE, length = 0x0002
INT24 : origin = 0xFFF0, length = 0x0002
INT25 : origin = 0xFFF2, length = 0x0002
INT26 : origin = 0xFFF4, length = 0x0002
INT27 : origin = 0xFFF6, length = 0x0002
INT28 : origin = 0xFFF8, length = 0x0002
INT29 : origin = 0xFFFA, length = 0x0002
INT30 : origin = 0xFFFC, length = 0x0002
RESET : origin = 0xFFFE, length = 0x0002
}
/****************************************************************************/
/* Specify the sections allocation into memory */
/****************************************************************************/
SECTIONS
{
.bss : {} > RAM /* Global & static vars */
.data : {} > RAM /* Global & static vars */
.TI.noinit : {} > RAM /* For #pragma noinit */
.sysmem : {} > RAM /* Dynamic memory allocation area */
.stack : {} > RAM (HIGH) /* Software system stack */
#ifndef __LARGE_CODE_MODEL__
.text : {} > FLASH /* Code */
#else
.text : {} >> FLASH2 | FLASH /* Code */
#endif
.text:_isr : {} > FLASH /* ISR Code space */
.cinit : {} > FLASH /* Initialization tables */
#ifndef __LARGE_DATA_MODEL__
.const : {} > FLASH /* Constant data */
#else
.const : {} >> FLASH | FLASH2 /* Constant data */
#endif
.bslsignature : {} > BSLSIGNATURE /* BSL Signature */
.cio : {} > RAM /* C I/O Buffer */
.pinit : {} > FLASH /* C++ Constructor tables */
.binit : {} > FLASH /* Boot-time Initialization tables */
.init_array : {} > FLASH /* C++ Constructor tables */
.mspabi.exidx : {} > FLASH /* C++ Constructor tables */
.mspabi.extab : {} > FLASH /* C++ Constructor tables */
#ifdef __TI_COMPILER_VERSION__
#if __TI_COMPILER_VERSION__ >= 15009000
#ifndef __LARGE_CODE_MODEL__
.TI.ramfunc : {} load=FLASH, run=RAM, table(BINIT)
#else
.TI.ramfunc : {} load=FLASH | FLASH2, run=RAM, table(BINIT)
#endif
#endif
#endif
.infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */
.infoB : {} > INFOB
/* MSP430 Interrupt vectors */
.int00 : {} > INT00
.int01 : {} > INT01
.int02 : {} > INT02
.int03 : {} > INT03
.int04 : {} > INT04
.int05 : {} > INT05
.int06 : {} > INT06
.int07 : {} > INT07
.int08 : {} > INT08
.int09 : {} > INT09
.int10 : {} > INT10
.int11 : {} > INT11
.int12 : {} > INT12
.int13 : {} > INT13
DAC12 : { * ( .int14 ) } > INT14 type = VECT_INIT
DMA : { * ( .int15 ) } > INT15 type = VECT_INIT
BASICTIMER : { * ( .int16 ) } > INT16 type = VECT_INIT
PORT2 : { * ( .int17 ) } > INT17 type = VECT_INIT
USART1TX : { * ( .int18 ) } > INT18 type = VECT_INIT
USART1RX : { * ( .int19 ) } > INT19 type = VECT_INIT
PORT1 : { * ( .int20 ) } > INT20 type = VECT_INIT
TIMERA1 : { * ( .int21 ) } > INT21 type = VECT_INIT
TIMERA0 : { * ( .int22 ) } > INT22 type = VECT_INIT
ADC12 : { * ( .int23 ) } > INT23 type = VECT_INIT
USCIAB0TX : { * ( .int24 ) } > INT24 type = VECT_INIT
USCIAB0RX : { * ( .int25 ) } > INT25 type = VECT_INIT
WDT : { * ( .int26 ) } > INT26 type = VECT_INIT
COMPARATORA : { * ( .int27 ) } > INT27 type = VECT_INIT
TIMERB1 : { * ( .int28 ) } > INT28 type = VECT_INIT
TIMERB0 : { * ( .int29 ) } > INT29 type = VECT_INIT
NMI : { * ( .int30 ) } > INT30 type = VECT_INIT
.reset : {} > RESET /* MSP430 Reset vector */
}
/****************************************************************************/
/* Include peripherals memory map */
/****************************************************************************/
-l msp430fg4618.cmd

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="configuration_0">
<instance XML_version="1.2" desc="TI MSP430 USB1" href="connections/TIMSP430-USB.xml" id="TI MSP430 USB1" xml="TIMSP430-USB.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="TI MSP430 USB1">
<instance XML_version="1.2" href="drivers/msp430_emu.xml" id="drivers" xml="msp430_emu.xml" xmlpath="drivers"/>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="MSP430FG4618" href="devices/MSP430FG4618.xml" id="MSP430FG4618" xml="MSP430FG4618.xml" xmlpath="devices"/>
</platform>
</connection>
</configuration>
</configurations>

View File

@ -0,0 +1,9 @@
The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
on the device and connection settings specified in your project on the Properties > General page.
Please note that in automatic target-configuration management, changes to the project's device and/or
connection settings will either modify an existing or generate a new target-configuration file. Thus,
if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
you may create your own target-configuration file for this project and manage it manually. You can
always switch back to automatic target-configuration management by checking the "Manage the project's
target-configuration automatically" checkbox on the project's Properties > General page.