CoffeePi
Coffee machine control for Raspberry Pi
Functions | Variables
stripe.cpp File Reference
#include <wiringPiI2C.h>
#include <stdlib.h>
#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include "stripe.h"
#include "global.h"
#include "timer.h"
#include "logger.h"

Functions

void * stripeTimerHandler (void *threadid)
 This is the handler for time based stripe effects. More...
 
void * stripeThread (void *threadid)
 Thread for the stripe control. More...
 
void stripeInit (void)
 Initializes i2c communication to stripe controller. More...
 
int stripeCommand (int len, char *data)
 Sends out command data to the stripe controller via i2c. More...
 
void stripeUpdate (void)
 Updates the color data and prepares the stripe command. More...
 
void stripeUpdateDim (void)
 Updates the dimmer value of the stripe. More...
 
void stripeSetRGB (int red, int green, int blue)
 Updates the color of the stripe. More...
 
void stripeSetColor (stripe_color color)
 Updates the color of the stripe. More...
 
void stripeSetTransient (stripe_transient_t transient)
 Updates the transient time for the stripe (fading) More...
 
void stripeSetDim (int dim)
 Updates the dimmer value of the stripe. More...
 
void stripeSetWhite (int white)
 Updates the white value of the stripe (4th channel) More...
 
void stripeOn (void)
 Turns the stripe on (Sets dimmer to 100%) More...
 
void stripeOff (void)
 Turns the stripe on (Sets dimmer to 0%) More...
 
void stripeGetRGB (int *red, int *green, int *blue)
 Reads the current stripe color. More...
 
void stripeGetDim (int *dim)
 Reads the current stripe dimmer value. More...
 
void stripeGetWhite (int *white)
 Reads the current stripe white value (4th channel) More...
 
void stripeEffectDisable (void)
 Stops current running effects. More...
 
void stripeEffectHeating (int percent)
 Sets the stripe to a correspondending color to the heating status. More...
 
void stripeEffectPulse (stripe_color color)
 Enables pulsing with a given color of the stripe. More...
 

Variables

stripe_color currentColor
 
stripe_color effectColor
 
int currentWhite = 0
 
int currentDim = 0
 
stripe_transient_t currentTransient = TRANS_DIRECT
 
timer stripeTimer (stripeTimerHandler)
 
int i2cfd
 

Function Documentation

int stripeCommand ( int  len,
char *  data 
)

Sends out command data to the stripe controller via i2c.

Parameters
lenLength of the data array
*dataPointer to data array
Returns
Number of failed bytes, 0 if successful
void stripeEffectDisable ( void  )

Stops current running effects.

void stripeEffectHeating ( int  percent)

Sets the stripe to a correspondending color to the heating status.

Parameters
percentHeating level (0-100%)
void stripeEffectPulse ( stripe_color  color)

Enables pulsing with a given color of the stripe.

Parameters
colorEffect color
void stripeGetDim ( int *  dim)

Reads the current stripe dimmer value.

Parameters
*dimPointer to dimmer variable
void stripeGetRGB ( int *  red,
int *  green,
int *  blue 
)

Reads the current stripe color.

Parameters
*redPointer to red variable
*greenPointer to green variable
*bluePointer to blue variable
void stripeGetWhite ( int *  white)

Reads the current stripe white value (4th channel)

Parameters
*whitePointer to white variable
void stripeInit ( void  )

Initializes i2c communication to stripe controller.

void stripeOff ( void  )

Turns the stripe on (Sets dimmer to 0%)

void stripeOn ( void  )

Turns the stripe on (Sets dimmer to 100%)

void stripeSetColor ( stripe_color  color)

Updates the color of the stripe.

Parameters
colorColor struct
void stripeSetDim ( int  dim)

Updates the dimmer value of the stripe.

Parameters
dimDimmer value
void stripeSetRGB ( int  red,
int  green,
int  blue 
)

Updates the color of the stripe.

Parameters
redRed value (max 255)
greenGreen value (max 255)
blueBlue value (max 255)
void stripeSetTransient ( stripe_transient_t  transient)

Updates the transient time for the stripe (fading)

Parameters
transientTransient time in ticks
void stripeSetWhite ( int  white)

Updates the white value of the stripe (4th channel)

Parameters
whiteWhite value
void* stripeThread ( void *  threadid)

Thread for the stripe control.

Requests data from other threads or HAL

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

This is the handler for time based stripe effects.

Parameters
*threadidThread ID
void stripeUpdate ( void  )

Updates the color data and prepares the stripe command.

void stripeUpdateDim ( void  )

Updates the dimmer value of the stripe.

Variable Documentation

stripe_color currentColor
int currentDim = 0
stripe_transient_t currentTransient = TRANS_DIRECT
int currentWhite = 0
stripe_color effectColor
int i2cfd
timer stripeTimer(stripeTimerHandler)