School project.

Dependencies:   Timezone NTPClient BSP_DISCO_F746NG Grove_temperature

Revision:
4:1a12157689a7
Parent:
3:02e7aac23ff9
Child:
6:aecab8e3acad
--- a/lcd_functions.h	Wed Jan 13 12:11:54 2021 +0000
+++ b/lcd_functions.h	Wed Jan 13 13:53:02 2021 +0000
@@ -11,18 +11,48 @@
 */
 #include "stm32746g_discovery_lcd.h"
 
-// Initializes the LCD for use
+/**
+This function will initialize the LCD for use
+@date 1/13/2021
+*/
 void lcd_initialize()
 {
     BSP_LCD_Init();
-    BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); // Initialize LCD layers
-    BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); // Select the LCD Layer
+    BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
+    BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
+}
+
+/**
+This function will print LCD size in console terminal
+*/
+void lcd_get_screen_size()
+{
+    printf("LCD X size : %zu\n\r",BSP_LCD_GetXSize()); //result: 480
+    printf("LCD Y size : %zu\n\r",BSP_LCD_GetYSize()); //result: 272
 }
 
-// Runs the startup screen with name and project name
+/**
+This function will run a screen that tells user to input building and room for the unit
+@date 1/13/2021
+*/
+void lcd_show_setup_screen()
+{    
+    /// Clears the LCD with specified color
+    BSP_LCD_Clear(LCD_COLOR_BLACK);
+    BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
+    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
+    BSP_LCD_SetFont(&Font24);
+    BSP_LCD_DisplayStringAt(0, 50, (uint8_t *)"SETUP", CENTER_MODE);
+    BSP_LCD_SetFont(&Font16);
+    BSP_LCD_DisplayStringAt(0, 200, (uint8_t *)"Please set the building and room", CENTER_MODE);
+}
+
+/**
+This function will runs the startup screen with project- and developer-name
+@date 1/13/2021
+*/
 void lcd_show_startup_screen()
 {    
-    // Startup screen
     BSP_LCD_Clear(LCD_COLOR_BLACK);
     BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
     BSP_LCD_SetTextColor(LCD_COLOR_ORANGE);
@@ -32,35 +62,15 @@
     HAL_Delay(3000);
 }
 
-/*
-Screen is divided into four parts equal in size
+/**
+Sets up the upper left part of screen
 */
-
-// Sets up the upper left part of screen
-
 void lcd_upper_left()
 {
     BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
     BSP_LCD_FillRect(0, 0, 240, 136);
 }
 
-void lcd_upper_left_smiley()
-{
-    BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
-    BSP_LCD_FillRect(0, 0, 240, 136);
-    BSP_LCD_SetTextColor(LCD_COLOR_YELLOW);
-    // Create yellow circle in the middle of field
-    BSP_LCD_FillCircle(120, 68, 50);
-    BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
-    BSP_LCD_FillCircle(120, 90, 15);
-    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
-    BSP_LCD_FillCircle(100, 58, 10);
-    BSP_LCD_FillCircle(140, 58, 10);
-    BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
-    BSP_LCD_FillCircle(100, 58, 3);
-    BSP_LCD_FillCircle(140, 58, 3);    
-}
-
 // Sets up the upper right part of screen
 void lcd_upper_right()
 {
@@ -70,16 +80,19 @@
 }
 
 // Sets up the lower left part of screen
-void lcd_lower_left()
+void lcd_lower_left(char building[], char room[])
 {
+    BSP_LCD_Clear(LCD_COLOR_DARKBLUE);
+    
     BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
     BSP_LCD_FillRect(0, 136, 240, 136);
     BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
-    // Set font to be smaller for this part
+    BSP_LCD_SetFont(&Font16);
+    BSP_LCD_DisplayStringAt(5, 160, (uint8_t *)"Current location", LEFT_MODE);
     BSP_LCD_SetFont(&Font12);
-    BSP_LCD_DisplayStringAt(5, 160, (uint8_t *)"Tu Tri Huynh", LEFT_MODE);
-    BSP_LCD_DisplayStringAt(5, 180, (uint8_t *)"Embedded Programming", LEFT_MODE);
-    BSP_LCD_DisplayStringAt(5, 200, (uint8_t *)"Light Control System", LEFT_MODE);
+    BSP_LCD_DisplayStringAt(5, 200, (uint8_t *)building, LEFT_MODE);
+    BSP_LCD_DisplayStringAt(5, 210, (uint8_t *)room, LEFT_MODE);
+    //BSP_LCD_DisplayStringAt(5, 200, (uint8_t *)"Light Control System", LEFT_MODE);
     // Reset fontsize
     BSP_LCD_SetFont(&Font16);
 }
@@ -96,7 +109,7 @@
 {
     BSP_LCD_Clear(LCD_COLOR_DARKBLUE); // Clear with color
     lcd_upper_left();
-    lcd_lower_left();
+    //lcd_lower_left();
     lcd_upper_right();
     lcd_lower_right();