CoffeePi
Coffee machine control for Raspberry Pi
Macros | Enumerations | Functions
hal.h File Reference

Go to the source code of this file.

Macros

#define RELAIS_HEAT   29
 
#define RELAIS_PUMP   25
 
#define RELAIS_POWER   28
 
#define PIN_PRESSURE_CTRL   7
 
#define PIN_PROXIMITY_SENSOR   6
 
#define PIN_INT0   2
 
#define PIN_INT1   0
 
#define PIN_FLOW   3
 
#define FLOW_ML_PULSE   (1000.0/990)
 
#define TIME_BUTTONLONGPRESS   3
 

Enumerations

enum  HalSig {
  SigInt0Psh = 1, SigInt0Rls = 2, SigInt0RlsLong = 3, SigInt1Psh = 4,
  SigInt1Rls = 5, SigInt1RlsLong = 6, SigPressCls = 7, SigPressOpn = 8,
  SigProxOpn = 9, SigProxCvrd = 10, SigBrewOn = 11, SigBrewOff = 12
}
 

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 halInt1 (void)
 Interrupt routine for Int1 (Bottom button) More...
 
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 value)
 send Signal to coffee thread More...
 
void halMachineOn (void)
 Turn machine on. More...
 
void halMachineOff (void)
 Turn machine off. More...
 
void halInt0TimerHandler (void)
 
void halInt1TimerHandler (void)
 

Macro Definition Documentation

#define FLOW_ML_PULSE   (1000.0/990)
#define PIN_FLOW   3
#define PIN_INT0   2
#define PIN_INT1   0
#define PIN_PRESSURE_CTRL   7
#define PIN_PROXIMITY_SENSOR   6
#define RELAIS_HEAT   29
#define RELAIS_POWER   28
#define RELAIS_PUMP   25
#define TIME_BUTTONLONGPRESS   3

Enumeration Type Documentation

enum HalSig
Enumerator
SigInt0Psh 
SigInt0Rls 
SigInt0RlsLong 
SigInt1Psh 
SigInt1Rls 
SigInt1RlsLong 
SigPressCls 
SigPressOpn 
SigProxOpn 
SigProxCvrd 
SigBrewOn 
SigBrewOff 

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
relaisRelais 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
relaisRelais ID
void halRelaisOn ( int  relais)

Switches relais on.

Parameters
relaisRelais ID
void halRelaisSet ( int  relais,
int  state 
)

Switches relais to state.

Parameters
relaisRelais ID
stateLOW(0) or HIGH(1)
void halResetFlow ( void  )

Resets the Flow counter.

void halSendSignal ( int  val)

send Signal to coffee thread

Parameters
valInteger value assigned to signal