CoffeePi
Coffee machine control for Raspberry Pi
|
#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 |
int stripeCommand | ( | int | len, |
char * | data | ||
) |
Sends out command data to the stripe controller via i2c.
len | Length of the data array |
*data | Pointer to data array |
void stripeEffectDisable | ( | void | ) |
Stops current running effects.
void stripeEffectHeating | ( | int | percent | ) |
Sets the stripe to a correspondending color to the heating status.
percent | Heating level (0-100%) |
void stripeEffectPulse | ( | stripe_color | color | ) |
Enables pulsing with a given color of the stripe.
color | Effect color |
void stripeGetDim | ( | int * | dim | ) |
Reads the current stripe dimmer value.
*dim | Pointer to dimmer variable |
void stripeGetRGB | ( | int * | red, |
int * | green, | ||
int * | blue | ||
) |
Reads the current stripe color.
*red | Pointer to red variable |
*green | Pointer to green variable |
*blue | Pointer to blue variable |
void stripeGetWhite | ( | int * | white | ) |
Reads the current stripe white value (4th channel)
*white | Pointer 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.
color | Color struct |
void stripeSetDim | ( | int | dim | ) |
Updates the dimmer value of the stripe.
dim | Dimmer value |
void stripeSetRGB | ( | int | red, |
int | green, | ||
int | blue | ||
) |
Updates the color of the stripe.
red | Red value (max 255) |
green | Green value (max 255) |
blue | Blue value (max 255) |
void stripeSetTransient | ( | stripe_transient_t | transient | ) |
Updates the transient time for the stripe (fading)
transient | Transient time in ticks |
void stripeSetWhite | ( | int | white | ) |
Updates the white value of the stripe (4th channel)
white | White value |
void* stripeThread | ( | void * | threadid | ) |
Thread for the stripe control.
Requests data from other threads or HAL
*threadid | Thread ID |
void* stripeTimerHandler | ( | void * | threadid | ) |
This is the handler for time based stripe effects.
*threadid | Thread ID |
void stripeUpdate | ( | void | ) |
Updates the color data and prepares the stripe command.
void stripeUpdateDim | ( | void | ) |
Updates the dimmer value of the stripe.
stripe_color currentColor |
int currentDim = 0 |
stripe_transient_t currentTransient = TRANS_DIRECT |
int currentWhite = 0 |
stripe_color effectColor |
int i2cfd |
timer stripeTimer(stripeTimerHandler) |