School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
Diff: lcd_functions.h
- Revision:
- 15:638e65c37d58
- Parent:
- 13:41debc0b9063
- Child:
- 16:296d68305630
--- a/lcd_functions.h Mon Jan 18 16:13:13 2021 +0000 +++ b/lcd_functions.h Tue Jan 19 10:05:13 2021 +0000 @@ -70,8 +70,10 @@ */ void lcd_update_upper_left() { - BSP_LCD_SetTextColor(LCD_COLOR_ORANGE); - BSP_LCD_FillRect(0, 0, 240, 136); + BSP_LCD_SetBackColor(LCD_COLOR_ORANGE); + BSP_LCD_SetTextColor(LCD_COLOR_BLUE); + BSP_LCD_SetFont(&Font24); + BSP_LCD_DisplayStringAt(50, 55, (uint8_t *)"TIME HERE", LEFT_MODE); } /** @@ -83,19 +85,29 @@ BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_FillRect(240, 0, 240, 136); + BSP_LCD_SetBackColor(LCD_COLOR_WHITE); + BSP_LCD_SetTextColor(LCD_COLOR_DARKYELLOW); + BSP_LCD_SetFont(&Font20); + BSP_LCD_DisplayStringAt(5, 16, (uint8_t *)"Light settings", RIGHT_MODE); } /** Update the content of the upper right part of display. -@light_reading The intensity level of registered light in percentage -@rotary_reading The current position of rotary sensor in percentage +@param light_reading The intensity level of registered light in percentage +@param rotary_reading The current position of rotary sensor in percentage 1/18/2021 */ void lcd_update_upper_right(int light_reading, int rotary_reading) { - BSP_LCD_SetBackColor(LCD_COLOR_BLUE); - BSP_LCD_SetTextColor(LCD_COLOR_WHITE); + BSP_LCD_SetBackColor(LCD_COLOR_WHITE); + BSP_LCD_SetTextColor(LCD_COLOR_DARKYELLOW); BSP_LCD_SetFont(&Font16); - BSP_LCD_DisplayStringAt(35, 200, (uint8_t *)"TIME HERE", LEFT_MODE); + char light_to_lcd[30]; + char rotary_to_lcd[30]; + sprintf(light_to_lcd, "Light intensity: %3i%%", light_reading); + sprintf(rotary_to_lcd, "Rotary turned: %3i%%", rotary_reading); + + BSP_LCD_DisplayStringAt(0, 46, (uint8_t *)light_to_lcd, RIGHT_MODE); + BSP_LCD_DisplayStringAt(0, 70, (uint8_t *)rotary_to_lcd, RIGHT_MODE); } /** @@ -142,7 +154,8 @@ } /** Update the content of the lower right part of display. -@temp The temperature reading from the thermal sensor +@param temp The temperature reading from the thermal sensor +@param is_fahrenheit The bool value to determine if temperature unit should switch to fahrenheit or not 1/18/2021 */ void lcd_update_lower_right(float temp, bool is_fahrenheit) @@ -169,30 +182,9 @@ { BSP_LCD_Clear(LCD_COLOR_DARKBLUE); // Clear with color lcd_upper_left(); - //lcd_lower_left(); - //lcd_upper_right(); + lcd_lower_left(); + lcd_upper_right(); lcd_lower_right(); - - - /******** DEMO CODE EXAMPLE *****/ - /* - BSP_LCD_Clear(LCD_COLOR_DARKBLUE); // Clear and set color - BSP_LCD_SetTextColor(LCD_COLOR_BLUE); - BSP_LCD_DrawRect(10, 20, 50, 50); - BSP_LCD_SetTextColor(LCD_COLOR_BROWN); - BSP_LCD_FillCircle(80, 80, 50); - BSP_LCD_SetTextColor(LCD_COLOR_YELLOW); - BSP_LCD_DrawEllipse(150, 150, 50, 100); - BSP_LCD_SetTextColor(LCD_COLOR_RED); - BSP_LCD_FillCircle(200, 200, 40); - HAL_Delay(2000); - - - BSP_LCD_SetBackColor(LCD_COLOR_DARKBLUE); - BSP_LCD_SetTextColor(LCD_COLOR_ORANGE); - //BSP_LCD_DisplayStringAt(0, 6, (uint8_t *)output, RIGHT_MODE); - //HAL_Delay(2000); - */ } /**