CoffeePi Coffee machine control for Raspberry Pi

- Main Page
- Data Structures
- Files

- File List
- Globals

stripe.h
Go to the documentation of this file.
1 /*
2 * stripe.h
3 *
4 * Created on: Sep 25, 2017
5 * Author: Philipp Hinz
6 */
7
8 #ifndef STRIPE_H_
9 #define STRIPE_H_
10
11 // i2c
12 #define I2C_ADDRESS_STRIPE 0x69
13 #define STRIPE_CMD_SETR 0x01
14 #define STRIPE_CMD_SETG 0x02
15 #define STRIPE_CMD_SETB 0x03
16 #define STRIPE_CMD_SETW 0x04
17 #define STRIPE_CMD_SETDIM 0x05
18 #define STRIPE_CMD_SET 0x06 // Bytes: DIM R G B W
19 #define STRIPE_CMD_SET2 0x07 // Bytes: DIM R G B
20 #define STRIPE_CMD_RESET 0x09
21 #define STRIPE_CMD_FADEOUT 0x0A // Bytes: TIMEH TIMEL
22 #define STRIPE_CMD_FADETO 0x0B // Bytes: R G B W TIMEH TIMEL
23 #define STRIPE_CMD_FADESTOP 0x0C
24
25 // Color transient (fading) parameters
26 typedef enum {
27 TRANS_DIRECT = 0,
28 TRANS_FAST = 6,
29 TRANS_MEDIUM = 35,
30 TRANS_SLOW = 200
31 } stripe_transient_t;
32
33 struct stripe_color {
34 int red = 0;
35 int green = 0;
36 int blue = 0;
37 };
38
39 void *stripeThread(void *threadid);
40 void *stripeTimerHandler(void *threadid);
41 void stripeInit(void);
42 int stripeCommand(int len, char* data);
43 void stripeUpdate(void);
44 void stripeUpdateDim(void);
45 void stripeSetRGB(int red, int green, int blue);
46 void stripeSetColor(stripe_color color);
47 void stripeSetTransient(stripe_transient_t transient);
48 void stripeSetDim(int dim);
49 void stripeSetWhite(int white);
50 void stripeOn(void);
51 void stripeOff(void);
52 void stripeGetRGB(int* red, int* green, int* blue);
53 void stripeGetDim(int* dim);
54 void stripeGetWhite(int* white);
55 void stripeEffectDisable(void);
56 void stripeEffectHeating(int percent);
57 void stripeEffectPulse(stripe_color color);
58
59 #endif /* STRIPE_H_ */
stripe_transient_t
stripe_transient_t
Definition: stripe.h:26
TRANS_FAST
Definition: stripe.h:28
stripeTimerHandler
void * stripeTimerHandler(void *threadid)
This is the handler for time based stripe effects.
Definition: stripe.cpp:30
stripeSetWhite
void stripeSetWhite(int white)
Updates the white value of the stripe (4th channel)
Definition: stripe.cpp:198
stripeGetDim
void stripeGetDim(int *dim)
Reads the current stripe dimmer value.
Definition: stripe.cpp:236
stripeGetWhite
void stripeGetWhite(int *white)
Reads the current stripe white value (4th channel)
Definition: stripe.cpp:244
stripeEffectDisable
void stripeEffectDisable(void)
Stops current running effects.
Definition: stripe.cpp:251
TRANS_MEDIUM
Definition: stripe.h:29
stripeOn
void stripeOn(void)
Turns the stripe on (Sets dimmer to 100%)
Definition: stripe.cpp:205
stripeThread
void * stripeThread(void *threadid)
Thread for the stripe control.
Definition: stripe.cpp:45
stripe_color
Definition: stripe.h:33
TRANS_SLOW
Definition: stripe.h:30
stripe_color::red
int red
Definition: stripe.h:34
stripe_color::blue
int blue
Definition: stripe.h:36
stripeUpdate
void stripeUpdate(void)
Updates the color data and prepares the stripe command.
Definition: stripe.cpp:119
stripeEffectPulse
void stripeEffectPulse(stripe_color color)
Enables pulsing with a given color of the stripe.
Definition: stripe.cpp:276
stripeInit
void stripeInit(void)
Initializes i2c communication to stripe controller.
Definition: stripe.cpp:78
TRANS_DIRECT
Definition: stripe.h:27
stripeOff
void stripeOff(void)
Turns the stripe on (Sets dimmer to 0%)
Definition: stripe.cpp:215
stripeEffectHeating
void stripeEffectHeating(int percent)
Sets the stripe to a correspondending color to the heating status.
Definition: stripe.cpp:259
stripeCommand
int stripeCommand(int len, char *data)
Sends out command data to the stripe controller via i2c.
Definition: stripe.cpp:101
stripeSetTransient
void stripeSetTransient(stripe_transient_t transient)
Updates the transient time for the stripe (fading)
Definition: stripe.cpp:182
stripe_color::green
int green
Definition: stripe.h:35
stripeSetRGB
void stripeSetRGB(int red, int green, int blue)
Updates the color of the stripe.
Definition: stripe.cpp:163
stripeGetRGB
void stripeGetRGB(int *red, int *green, int *blue)
Reads the current stripe color.
Definition: stripe.cpp:226
stripeSetColor
void stripeSetColor(stripe_color color)
Updates the color of the stripe.
Definition: stripe.cpp:174
stripeUpdateDim
void stripeUpdateDim(void)
Updates the dimmer value of the stripe.
Definition: stripe.cpp:147
stripeSetDim
void stripeSetDim(int dim)
Updates the dimmer value of the stripe.
Definition: stripe.cpp:190