Microprocessor and peripheral 2 assignments for AUTH
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

66 lines
1.2 KiB

  1. /*
  2. * thermostat.h
  3. *
  4. * Created on: Jun 27, 2020
  5. * Author: hoo2
  6. */
  7. #ifndef THERMOSTAT_H_
  8. #define THERMOSTAT_H_
  9. #define MEAS_WINDOW (120) // [sec]
  10. #define MEAS_INTERVAL (5) // [sec]
  11. #define MEASUREMENTS (MEAS_WINDOW / MEAS_INTERVAL) // keep this integer
  12. #define UI_AVERAGE_TIME (10) // [sec]
  13. //#define UI_USER_TIME (10)
  14. typedef float float_t;
  15. typedef int int_t;
  16. typedef enum {
  17. HEATING =0,
  18. COOLING
  19. } mode_en;
  20. typedef struct {
  21. float_t T[MEASUREMENTS];
  22. float_t Tav;
  23. uint32_t cur;
  24. uint8_t flag_output;
  25. uint8_t flag_init;
  26. uint8_t flag_proximity;
  27. uint8_t signal_cycle;
  28. } app_data_t;
  29. typedef struct {
  30. mode_en mode;
  31. float_t Tset;
  32. float_t Thyst;
  33. float_t Pset;
  34. float_t Physt;
  35. } settings_t;
  36. typedef enum {
  37. ST_INIT =0,
  38. ST_COUNT,
  39. ST_AVERAGE,
  40. ST_USER
  41. } state_en;
  42. /*
  43. * globals
  44. */
  45. extern app_data_t app_data;
  46. extern state_en state;
  47. extern settings_t settings;
  48. #define _Init_settings(s) s = { \
  49. .mode = HEATING, \
  50. .Tset = 21.0, \
  51. .Thyst = 2.0, \
  52. .Pset = 75.0, \
  53. .Physt = 10.0 \
  54. }
  55. #endif /* THERMOSTAT_H_ */