School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
main_functions.h
- Committer:
- tuxx0046
- Date:
- 2021-01-19
- Revision:
- 15:638e65c37d58
- Parent:
- 14:3ac7c08dbc52
- Child:
- 16:296d68305630
File content as of revision 15:638e65c37d58:
/** @file main_functions.h @author Tu Tri Huynh @date January 18, 2021 @brief Functions to be envoked in main funtion. Uses global variables. */ /** This function will update the sensor readings. 1/18/2021 */ void update_readings() { light_sensor_reading = light_sensor.read(); light_intensity = helper_get_sensor_read_in_percent(light_sensor_reading); rotary_reading = rotary.read(); rotary_setting = helper_get_sensor_read_in_percent(rotary_reading); } /** This function will check which sensor controls the light, allowing the rotary or the light sensor to determine blink rate, and updates the lcd display accordingly 1/19/2021 */ void check_light_control() { if (rotary_is_on(rotary)) { led_set_blink_rate(rotary_reverse_read(rotary_reading)); } else { led_set_blink_rate(light_sensor_reading); } lcd_update_upper_right(light_intensity, rotary_setting); } /** Reads the temperature and updates the display if temperature has changed. 1/19/2021 */ void update_temperature(bool switch_temp) { int new_temp = (int)temp.getTemperature(); /// Update if change in temperature if (current_temp != new_temp) { current_temp = new_temp; lcd_update_lower_right(temp.getTemperature(), is_fahrenheit); } /// Change temperature unit else if (switch_temp == true) { lcd_update_lower_right(temp.getTemperature(), is_fahrenheit); } }