ESR-2025/main.c

49 lines
1.1 KiB
C
Executable File

/**
* @file main.c
* @brief Entrypoint for the program.
*
* @date 2025-07-02
*/
#include <msp430.h>
#include <driverlib.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include "src/keypad.h"
#include "src/morse.h"
#include "src/i2c.h"
#include "src/lcd.h"
#include "src/Board.h"
#include "src/timer.h"
#include "src/state_machine.h"
/** On-board LED port and pin (used by Morse module) */
#define LED_PORT GPIO_PORT_P1 /**< On-board LED port */
#define LED_PIN GPIO_PIN0 /**< On-board LED pin */
/**
* @brief Main application entry point.
*
* Sets up GPIO, UART, keypad interrupts, and enters low-power loop.
* On keypress, echoes key over UART.
*
* @return Never returns
*/
int main(void)
{
/* Stop watchdog and unlock GPIO pins */
WDT_A_hold(WDT_A_BASE);
PMM_unlockLPM5();
/* Initialize on-board LED (used by Morse blinking) */
GPIO_setAsOutputPin(LED_PORT, LED_PIN);
GPIO_setOutputLowOnPin(LED_PORT, LED_PIN);
init_timer();
i2c_init();
lcd_init();
sm_init();
sm_loop();
}