hal.cpp File Reference
`#include <wiringPi.h>`
`#include <stdlib.h>`
`#include <errno.h>`
`#include <string.h>`
`#include <signal.h>`
`#include "hal.h"`
`#include "global.h"`
`#include "logger.h"`
`#include "timer.h"`

## Functions

void | halInit (void)
| Initializes HAL. More...
void | halRelaisOn (int relais)
| Switches relais on. More...
void | halRelaisOff (int relais)
| Switches relais off. More...
void | halRelaisSet (int relais, int state)
| Switches relais to state. More...
int | halGetRelaisState (int relais)
| Returns the state of the relais relais Returns HIGH when Relais is ON. More...
void | halInt0 (void)
| Interrupt routine for Int0 (Top button) More...
void | halInt0TimerHandler (void)
void | halInt1 (void)
| Interrupt routine for Int1 (Bottom button) More...
void | halInt1TimerHandler (void)
void | halIntFlow (void)
| Interrupt routine for the flow sensor It counts the edgdes and stores the value in flowcnt. More...
void | halIntPressure (void)
| Interrupt routine for the pressure control. More...
void | halIntProximity (void)
| Method to handle toggle of the proximity sensor. More...
float | halGetFlow (void)
| Returns total flow trough sensor in ml. More...
void | halResetFlow (void)
| Resets the Flow counter. More...
bool | halIsHeating (void)
| Reads the status of the Pressure Control. More...
bool | halProxSensorCovered (void)
| Returns status of the proximity switch. More...
int | halGetInt0 (void)
| Returns the value of the top button Int0 (low active) More...
int | halGetInt1 (void)
| Returns the value of the bottom button Int1 (low active) More...
void | halSendSignal (int val)
| send Signal to coffee thread More...
void | halMachineOn (void)
| Turn machine on. More...
void | halMachineOff (void)
| Turn machine off. More...

## Variables

int | flowcnt = 0
int | Int0Time
int | Int1Time
bool | flagIgnoreRlsInt0
bool | flagIgnoreRlsInt1
timer Int0Timer & | halInt0TimerHandler
timer Int1Timer & | halInt1TimerHandler

## Function Documentation

float halGetFlow | ( | void |  | ) |

Returns total flow trough sensor in ml.

int halGetInt0 | ( | void |  | ) |

Returns the value of the top button Int0 (low active)

Returns
  LOW or HIGH

int halGetInt1 | ( | void |  | ) |

Returns the value of the bottom button Int1 (low active)

Returns
  LOW or HIGH

int halGetRelaisState | ( | int | relais | ) |

Returns the state of the relais relais Returns HIGH when Relais is ON.

Parameters

  relais | Relais ID

void halInit | ( | void |  | ) |

Initializes HAL.

void halInt0 | ( | void |  | ) |

Interrupt routine for Int0 (Top button)

void halInt0TimerHandler | ( | void |  | ) |

void halInt1 | ( | void |  | ) |

Interrupt routine for Int1 (Bottom button)

void halInt1TimerHandler | ( | void |  | ) |

void halIntFlow | ( | void |  | ) |

Interrupt routine for the flow sensor It counts the edgdes and stores the value in flowcnt.

void halIntPressure | ( | void |  | ) |

Interrupt routine for the pressure control.

void halIntProximity | ( | void |  | ) |

Method to handle toggle of the proximity sensor.

bool halIsHeating | ( | void |  | ) |

Reads the status of the Pressure Control.

Returns
  0 for closed Pressure Control(heating) and 1 for open

void halMachineOff | ( | void |  | ) |

Turn machine off.

void halMachineOn | ( | void |  | ) |

Turn machine on.

bool halProxSensorCovered | ( | void |  | ) |

Returns status of the proximity switch.

Returns
  1 if the proximity switch is covered and 0 if uncovered

void halRelaisOff | ( | int | relais | ) |

Switches relais off.

Parameters

  relais | Relais ID

void halRelaisOn | ( | int | relais | ) |

Switches relais on.

Parameters

  relais | Relais ID

void halRelaisSet | ( | int | relais,
|  | int | state
| ) |  |

Switches relais to state.

Parameters

  relais | Relais ID
  state | LOW(0) or HIGH(1)

void halResetFlow | ( | void |  | ) |

Resets the Flow counter.

void halSendSignal | ( | int | val | ) |

send Signal to coffee thread

Parameters

  val | Integer value assigned to signal

## Variable Documentation

bool flagIgnoreRlsInt0

bool flagIgnoreRlsInt1

int flowcnt = 0

timer Int0Timer& halInt0TimerHandler

timer Int1Timer& halInt1TimerHandler

int Int0Time

int Int1Time