hal.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 PRESSURE_CTRL 7
  13. #define PROXIMITY_SENSOR 6
  14. #define INT0 0 // bottom button
  15. #define INT1 2 // top button
  16. #define FLOW 3 // flow sensor
  17. #define PROX_COVERED 1 //proximity sensor
  18. #define FLOW_ML_PULSE (1000.0/990) // Flow sensor: volume (ml) per pulse
  19. /*
  20. * Explanation for the signal levels
  21. * SigInt_Psh Button is pushed
  22. * SigInt_Rls Button is released
  23. * SigPressCls Pressure control is closed, System is heating
  24. * SigPressOpn Pressure control is open, heating is off
  25. * SigProxOpn Proximity Sensor is uncovered
  26. * SigProxCvrd Proximity Sensor is covered
  27. */
  28. enum HalSig {
  29. SigInt0Psh = 1,
  30. SigInt0Rls = 2,
  31. SigInt1Psh = 3,
  32. SigInt1Rls = 4,
  33. SigPressCls = 5,
  34. SigPressOpn = 6,
  35. SigProxOpn = 7,
  36. SigProxCvrd = 8,
  37. SigBrewOn = 9,
  38. SigBrewOff = 10
  39. };
  40. void halInit(void);
  41. void halRelaisOn(int relais);
  42. void halRelaisOff(int relais);
  43. void halRelaisSet(int relais, int state);
  44. int halGetRelaisState(int relais);
  45. void halInt0(void);
  46. void halInt1(void);
  47. void halIntFlow(void);
  48. void halIntPressure(void);
  49. void halIntProximity(void);
  50. float halGetFlow(void);
  51. void halResetFlow(void);
  52. bool halIsHeating(void);
  53. bool halProxSensorCovered(void);
  54. int halGetInt0(void);
  55. int halGetInt1(void);
  56. void halSendSignal(int value);
  57. #endif /* HAL_H_ */