Question
Implement a game where you care for your Tamagotchi by playing with it and feeding it. Your Tamagotchi and its Age, Energy level, and the
Implement a game where you care for your Tamagotchi by playing with it and feeding it. Your Tamagotchi and its Age, Energy level, and the Happy level will be displayed on the BoostXL board. You can interact with your Tamagotchi by sending it commands from your laptop through a UART connection to the MSP432P4. Baseline requirements are summarized in next paragraph. Using the MSP432P4 Graphics Library, your application displays:
o Your own unique Tamagotchi through its phases of life: egg, child, adult, and death.
o Its Age, Energy level, and happy level (on a scale of 0-5 for Energy and happy).
o The Baud Rate state, BR.
o A unique border decoration.
STARTING CODE:
#include
// This function initializes all the peripherals except graphics void initialize();
// This function initializes the graphics part void InitGraphics(Graphics_Context *g_sContext_p);
int main(void) {
Graphics_Context g_sContext;
initialize(); InitGraphics(&g_sContext);
while (1) {
} }
void InitFonts() { Crystalfontz128x128_Init(); Crystalfontz128x128_SetOrientation(LCD_ORIENTATION_UP); }
void InitGraphics(Graphics_Context *g_sContext_p) {
Graphics_initContext(g_sContext_p, &g_sCrystalfontz128x128, &g_sCrystalfontz128x128_funcs); Graphics_setForegroundColor(g_sContext_p, GRAPHICS_COLOR_YELLOW); Graphics_setBackgroundColor(g_sContext_p, GRAPHICS_COLOR_BLUE); Graphics_setFont(g_sContext_p, &g_sFontCmtt12);
InitFonts();
Graphics_clearDisplay(g_sContext_p); }
void initialize() { // stop the watchdog timer WDT_A_hold(WDT_A_BASE);
// initialize the boosterPack LEDs and turn them off except for red LED initialize_BoosterpackLED_red(); initialize_BoosterpackLED_green(); initialize_BoosterpackLED_blue(); turnOn_BoosterpackLED_red(); turnOff_BoosterpackLED_green(); turnOff_BoosterpackLED_blue();
// initialize the Launchpad buttons initialize_LaunchpadLeftButton(); initialize_LaunchpadRightButton();
// Initialize the timers needed for debouncing Timer32_initModule(TIMER32_0_BASE, // There are two timers, we are using the one with the index 0 TIMER32_PRESCALER_1, // The prescaler value is 1; The clock is not divided before feeding the counter TIMER32_32BIT, // The counter is used in 32-bit mode; the alternative is 16-bit mode TIMER32_PERIODIC_MODE); //This options is irrelevant for a one-shot timer
Timer32_initModule(TIMER32_1_BASE, // There are two timers, we are using the one with the index 1 TIMER32_PRESCALER_1, // The prescaler value is 1; The clock is not divided before feeding the counter TIMER32_32BIT, // The counter is used in 32-bit mode; the alternative is 16-bit mode TIMER32_PERIODIC_MODE); //This options is irrelevant for a one-shot timer
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started