School project.
Dependencies: Timezone NTPClient BSP_DISCO_F746NG Grove_temperature
button_functions.h@13:41debc0b9063, 2021-01-18 (annotated)
- Committer:
- tuxx0046
- Date:
- Mon Jan 18 13:39:58 2021 +0000
- Revision:
- 13:41debc0b9063
- Child:
- 14:3ac7c08dbc52
Temperature reading functionality added.; Button functionality added, so a button press will change temperature from celsius to fahrenheit.; Comments fixed and added.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tuxx0046 | 13:41debc0b9063 | 1 | /** |
tuxx0046 | 13:41debc0b9063 | 2 | @file helper_functions.h |
tuxx0046 | 13:41debc0b9063 | 3 | @author Tu Tri Huynh |
tuxx0046 | 13:41debc0b9063 | 4 | @date January 18, 2021 |
tuxx0046 | 13:41debc0b9063 | 5 | @brief Functions related to Grove Button. |
tuxx0046 | 13:41debc0b9063 | 6 | */ |
tuxx0046 | 13:41debc0b9063 | 7 | |
tuxx0046 | 13:41debc0b9063 | 8 | /** |
tuxx0046 | 13:41debc0b9063 | 9 | This function reverses the bool value inputted if button press is registered. |
tuxx0046 | 13:41debc0b9063 | 10 | @is_fahrenheit Bool value to reverse. |
tuxx0046 | 13:41debc0b9063 | 11 | 1/18/2021 |
tuxx0046 | 13:41debc0b9063 | 12 | */ |
tuxx0046 | 13:41debc0b9063 | 13 | void button_switch_temp_unit(DigitalIn& button, bool& is_fahrenheit) |
tuxx0046 | 13:41debc0b9063 | 14 | { |
tuxx0046 | 13:41debc0b9063 | 15 | if (button.read() == 1 ) |
tuxx0046 | 13:41debc0b9063 | 16 | { |
tuxx0046 | 13:41debc0b9063 | 17 | is_fahrenheit = helper_reverse_bool(is_fahrenheit); |
tuxx0046 | 13:41debc0b9063 | 18 | } |
tuxx0046 | 13:41debc0b9063 | 19 | } |