hal.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * hal.h
  3. *
  4. * Created on: Aug 3, 2016
  5. * Author: sebastian
  6. */
  7. #ifndef HAL_H_
  8. #define HAL_H_
  9. #define RELAIS_HEAT 29
  10. #define RELAIS_PUMP 25
  11. #define RELAIS_POWER 28
  12. #define PIN_PRESSURE_CTRL 7
  13. #define PIN_PROXIMITY_SENSOR 6
  14. #define PIN_INT0 0 // bottom button
  15. #define PIN_INT1 2 // top button
  16. #define PIN_FLOW 3 // flow sensor
  17. #define FLOW_ML_PULSE (1000.0/990) // Flow sensor: volume (ml) per pulse
  18. /*
  19. * Explanation for the signal levels
  20. * SigInt_Psh Button is pushed
  21. * SigInt_Rls Button is released
  22. * SigPressCls Pressure control is closed, System is heating
  23. * SigPressOpn Pressure control is open, heating is off
  24. * SigProxOpn Proximity Sensor is uncovered
  25. * SigProxCvrd Proximity Sensor is covered
  26. */
  27. enum HalSig {
  28. SigInt0Psh = 1,
  29. SigInt0Rls = 2,
  30. SigInt1Psh = 3,
  31. SigInt1Rls = 4,
  32. SigPressCls = 5,
  33. SigPressOpn = 6,
  34. SigProxOpn = 7,
  35. SigProxCvrd = 8,
  36. SigBrewOn = 9,
  37. SigBrewOff = 10
  38. };
  39. void halInit(void);
  40. void halRelaisOn(int relais);
  41. void halRelaisOff(int relais);
  42. void halRelaisSet(int relais, int state);
  43. int halGetRelaisState(int relais);
  44. void halInt0(void);
  45. void halInt1(void);
  46. void halIntFlow(void);
  47. void halIntPressure(void);
  48. void halIntProximity(void);
  49. float halGetFlow(void);
  50. void halResetFlow(void);
  51. bool halIsHeating(void);
  52. bool halProxSensorCovered(void);
  53. int halGetInt0(void);
  54. int halGetInt1(void);
  55. void halSendSignal(int value);
  56. #endif /* HAL_H_ */