School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
Diff: setup_functions.h
- Revision:
- 3:02e7aac23ff9
- Child:
- 5:9a9cc43f3c2c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup_functions.h Wed Jan 13 12:11:54 2021 +0000 @@ -0,0 +1,76 @@ +/** +@file setup_unit.h +@brief Contains functions used for initial setup of the unit, specifically to set the building and room where unit installation is planned. + +@author Tu Tri Huynh + +@date 1/13/2021 +*/ + + +/** +Declaration of the function (prototype) to allow other functions to call it +@date 1/13/2021 +*/ +void setup_set_room_and_building(); + +/** +Prompt user for confirmation if happy with inputted information +@date 1/13/2021 +*/ +void setup_confirm() +{ + char answer; + printf("Type y for Yes, n for no: "); + scanf("%1s",&answer); + if (answer == 'y' || answer == 'Y') + { + printf("Setup successfully completed.\n"); + } + else + { + setup_set_room_and_building(); + } + /* + printf("setup_confirm function end\n"); + */ +} + +/** +Show inputted information, and call setup_confirm to ask for confirmation. +@date 1/13/2021 +*/ +void setup_show_settings() +{ + printf("Is this correct?\n"); + printf("\n----------------------------\n"); + printf("Building: %s\n", building); + printf("Room: %s\n", room); + printf("----------------------------\n"); + setup_confirm(); +} + +/** +Function to set building and room. Will call setup_show_settings to show what has been inputted. +@date 1/13/2021 +*/ +void setup_set_room_and_building() +{ + printf("Please set the building (maximum 30 characters): "); + scanf("%30s", building); + printf("Please set the room (maximum 30 characters): "); + scanf("%30s", room); + setup_show_settings(); +} + +/** +Function to run the initial setup process. +@date 1/13/2021 +*/ +void setup_run_setup() +{ + printf("\n*********************************************************\n"); + printf("Welcome to the Light Control System initial setup process\n"); + printf("Please set the units' location...\n\n"); + setup_set_room_and_building(); +} \ No newline at end of file