stripe.h
Go to the documentation of this file.
/*
* stripe.h
*
* Created on: Sep 25, 2017
* Author: Philipp Hinz
*/
#ifndef STRIPE_H_
#define STRIPE_H_
// i2c
#define I2C_ADDRESS_STRIPE 0x69
#define STRIPE_CMD_SETR 0x01
#define STRIPE_CMD_SETG 0x02
#define STRIPE_CMD_SETB 0x03
#define STRIPE_CMD_SETW 0x04
#define STRIPE_CMD_SETDIM 0x05
#define STRIPE_CMD_SET 0x06 // Bytes: DIM R G B W
#define STRIPE_CMD_SET2 0x07 // Bytes: DIM R G B
#define STRIPE_CMD_RESET 0x09
#define STRIPE_CMD_FADEOUT 0x0A // Bytes: TIMEH TIMEL
#define STRIPE_CMD_FADETO 0x0B // Bytes: R G B W TIMEH TIMEL
#define STRIPE_CMD_FADESTOP 0x0C
// Color transient (fading) parameters
typedef enum {
TRANS_DIRECT = 0,
TRANS_FAST = 6,
TRANS_MEDIUM = 35,
TRANS_SLOW = 200
} stripe_transient_t;
struct stripe_color {
int red = 0;
int green = 0;
int blue = 0;
};
void *stripeThread(void *threadid);
void *stripeTimerHandler(void *threadid);
void stripeInit(void);
int stripeCommand(int len, char* data);
void stripeUpdate(void);
void stripeUpdateDim(void);
void stripeSetRGB(int red, int green, int blue);
void stripeSetColor(stripe_color color);
void stripeSetTransient(stripe_transient_t transient);
void stripeSetDim(int dim);
void stripeSetWhite(int white);
void stripeOn(void);
void stripeOff(void);
void stripeGetRGB(int* red, int* green, int* blue);
void stripeGetDim(int* dim);
void stripeGetWhite(int* white);
void stripeEffectDisable(void);
void stripeEffectHeating(int percent);
void stripeEffectPulse(stripe_color color);
#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