CoffeePi
Coffee machine control for Raspberry Pi
Functions | Variables
display.cpp File Reference
#include <stdlib.h>
#include <pthread.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
#include "global.h"
#include "display.h"
#include "logger.h"
#include "database.h"
#include "timer.h"
#include "lcd.h"
#include "coffee.h"
#include "hal.h"

Functions

void displayPrintTime (int line)
 Prints out the current time in a centered position. More...
 
void displayPrintFlow (int line)
 Prints out the total volume flow. More...
 
void displayPrintLn (int line, const char *str, bool centered)
 Prints a string to a specific line, optionally centered. More...
 
void * displayThread (void *threadid)
 Main thread to handle display data. More...
 
void * displayTimerHandler (void *threadid)
 Timer handler for display update. More...
 
void displayInit (void)
 Initializes display. More...
 
void displayTerminate (void)
 Handles cleanup before program termination. More...
 
void displaySetLang (display_lang_t lang)
 Sets the language of the display text. More...
 
void displayRefresh (void)
 Refreshed the display content and outputs it. More...
 
const char * displayGetString (display_strings_t string)
 Returns the matching translation of a string. More...
 
void displayPushState (int state)
 Updates the display state to the matching coffee state. More...
 

Variables

display_lang_t displayLang
 
timer displayTimer (displayTimerHandler)
 
int lcd = 0
 
volatile int timerScaler = 0
 
volatile int elapsedCnt = 0
 
int coffeeState = STATE_OFF
 

Function Documentation

const char* displayGetString ( display_strings_t  string)

Returns the matching translation of a string.

Parameters
stringRequested string
Returns
Translated string
void displayInit ( void  )

Initializes display.

void displayPrintFlow ( int  line)

Prints out the total volume flow.

Parameters
lineTarget line in display
void displayPrintLn ( int  line,
const char *  str,
bool  centered 
)

Prints a string to a specific line, optionally centered.

This function also fills out the remaining row of the display with spaces, to ensure there is no old data left.

Parameters
lineTarget line in display
*strString to print
centeredPrint centered or not
void displayPrintTime ( int  line)

Prints out the current time in a centered position.

Parameters
lineTarget line in display
void displayPushState ( int  state)

Updates the display state to the matching coffee state.

Parameters
stateNew state
void displayRefresh ( void  )

Refreshed the display content and outputs it.

void displaySetLang ( display_lang_t  lang)

Sets the language of the display text.

Parameters
langNew language
void displayTerminate ( void  )

Handles cleanup before program termination.

void* displayThread ( void *  threadid)

Main thread to handle display data.

Parameters
*threadidThread ID
void* displayTimerHandler ( void *  threadid)

Timer handler for display update.

Parameters
*threadidThread ID

Variable Documentation

int coffeeState = STATE_OFF
display_lang_t displayLang
timer displayTimer(displayTimerHandler)
volatile int elapsedCnt = 0
int lcd = 0
volatile int timerScaler = 0