School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
Diff: main_functions.h
- Revision:
- 16:296d68305630
- Parent:
- 15:638e65c37d58
--- a/main_functions.h Tue Jan 19 10:05:13 2021 +0000 +++ b/main_functions.h Wed Jan 20 08:11:46 2021 +0000 @@ -2,14 +2,14 @@ @file main_functions.h @author Tu Tri Huynh @date January 18, 2021 -@brief Functions to be envoked in main funtion. Uses global variables. +@brief Functions to be envoked in main function. Uses global variables. */ /** This function will update the sensor readings. 1/18/2021 */ -void update_readings() +void main_update_readings() { light_sensor_reading = light_sensor.read(); light_intensity = helper_get_sensor_read_in_percent(light_sensor_reading); @@ -22,7 +22,7 @@ and updates the lcd display accordingly 1/19/2021 */ -void check_light_control() +void main_check_light_control() { if (rotary_is_on(rotary)) { @@ -40,7 +40,7 @@ Reads the temperature and updates the display if temperature has changed. 1/19/2021 */ -void update_temperature(bool switch_temp) +void main_update_temperature(bool switch_temp) { int new_temp = (int)temp.getTemperature(); /// Update if change in temperature @@ -49,9 +49,46 @@ current_temp = new_temp; lcd_update_lower_right(temp.getTemperature(), is_fahrenheit); } - /// Change temperature unit + /// Check if change temperature unit wanted else if (switch_temp == true) { lcd_update_lower_right(temp.getTemperature(), is_fahrenheit); } } + +/** +Runs a while loop that checks for button presses +1/19/2021 +*/ +void main_run_button_check() +{ + while(1) + { + switch_temp = button_switch_temp_unit(button, is_fahrenheit); + main_update_temperature(switch_temp); + switch_temp = false; + wait_us(250000); + } +} + +/** +Runs the setup menu +1/19/2021 +*/ +void main_run_setup() +{ + lcd_initialize(); + lcd_show_setup_screen(); + setup_run_setup(); +} + +/** +Starts the main screen on LCD display +1/19/2021 +*/ +void main_run_main_screen() +{ + lcd_show_main_screen(); + lcd_update_lower_left(building, room); +} +