10 #ifndef pixie_chroma_h
11 #define pixie_chroma_h
32 void begin(
const uint8_t data_pin, uint8_t pixies_x, uint8_t pixies_y );
33 void begin_quad( uint8_t pixies_per_pin, uint8_t pixies_x, uint8_t pixies_y );
47 void write(
const uint8_t* icon, uint8_t x_pos = 0, uint8_t y_pos = 0 );
48 void write( uint8_t icon_col_1, uint8_t icon_col_2, uint8_t icon_col_3, uint8_t icon_col_4, uint8_t icon_col_5, uint8_t x_pos = 0, uint8_t y_pos = 0 );
49 void write(
char* message, uint8_t x_pos = 0, uint8_t y_pos = 0 );
50 void write( int16_t input, uint8_t x_pos = 0, uint8_t y_pos = 0 );
51 void write( uint16_t input, uint8_t x_pos = 0, uint8_t y_pos = 0 );
52 void write( int32_t input, uint8_t x_pos = 0, uint8_t y_pos = 0 );
53 void write( uint32_t input, uint8_t x_pos = 0, uint8_t y_pos = 0 );
54 void write(
long unsigned int input, uint8_t x_pos = 0, uint8_t y_pos = 0 );
55 void write(
float input, uint8_t places = 2, uint8_t x_pos = 0, uint8_t y_pos = 0 );
56 void write(
double input, uint8_t places = 2, uint8_t x_pos = 0, uint8_t y_pos = 0 );
58 void write_pix(
char* message, int16_t x_offset = 0, int16_t y_offset = 0 );
59 void write_pix(
const uint8_t* icon, int16_t x_offset = 0, int16_t y_offset = 0 );
61 void add_char(
char c, int16_t x_pos, int16_t y_pos );
62 void add_char(
const uint8_t* icon, int16_t x_pos, int16_t y_pos );
66 void print(
const uint8_t* icon );
67 void print( uint8_t icon_col_1, uint8_t icon_col_2, uint8_t icon_col_3, uint8_t icon_col_4, uint8_t icon_col_5 );
68 void print(
char* message );
69 void print( int16_t input );
70 void print( uint16_t input );
71 void print( int32_t input );
72 void print( uint32_t input );
73 void print(
long unsigned int input );
74 void print(
float input, uint8_t places = 2 );
75 void print(
double input, uint8_t places = 2 );
79 void println(
const uint8_t* icon );
80 void println( uint8_t icon_col_1, uint8_t icon_col_2, uint8_t icon_col_3, uint8_t icon_col_4, uint8_t icon_col_5 );
86 void println(
long unsigned int input );
87 void println(
float input, uint8_t places = 2 );
88 void println(
double input, uint8_t places = 2 );
92 void set_cursor( uint8_t x_position, uint8_t y_position = 0 );
107 void color( CRGB col );
108 void color( CRGB col, uint8_t x, uint8_t y );
109 void color( CRGB col, uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2 );
114 void dim( uint8_t amount,
bool reset_cursor =
false );
115 void blur( fract8 blur_amount );
116 void blur_x( fract8 blur_amount );
117 void blur_y( fract8 blur_amount );
128 uint16_t
xy( int32_t x, int32_t y,
bool wrap =
false );
129 uint16_t
uv(
float x,
float y,
bool wrap =
false );
132 void draw_line( int16_t x1, int16_t y1, int16_t x2, int16_t y2 );
238 void build_controller(
const uint8_t pin );
244 const uint8_t display_width = 7;
245 const uint8_t display_height = 11;
246 const uint8_t display_padding_x = 1;
247 const uint8_t display_padding_y = 2;
248 const uint8_t leds_per_pixie = 70;
249 const uint8_t bit_table[2] = {0,255};
251 volatile int16_t cursor_x;
252 volatile int16_t cursor_y;
253 volatile int16_t cursor_x_temp;
254 volatile int16_t cursor_y_temp;
262 uint16_t max_mA = 500;
263 uint8_t brightness_level = 255;
265 bool correct_gamma =
false;
266 bool line_wrap =
true;
269 bool ticker_running =
false;
270 float fps_target = 60;
This is the software documentation for using Pixie Chroma functions on Arduino! For full example usag...
uint16_t NUM_PIXELS
Stores the total number of pixels, including invisible pixels.
void color_blur(fract8 blur_amount)
Blurs the color buffer in both axes by blur_amount.
void draw_line(int16_t x1, int16_t y1, int16_t x2, int16_t y2)
Draws a line in the mask buffer using Bresenham's line algorithm.
void color(CRGB col)
Sets the entire color buffer to a CRGB value.
void println(const uint8_t *icon)
Prints an Icon to the displays at the current cursor position, then jumps to the next row in the Pixi...
float animation_speed
Used by animation functions to scale the apparent speed of animation.
void write_pix(char *message, int16_t x_offset=0, int16_t y_offset=0)
Internal function for rendering char* strings to the mask buffer.
void set_brightness(uint8_t level)
Takes an 8-bit brightness value and passes it to FastLED internally, to provide global brightness con...
PixieChroma()
Construct a Pixie Chroma class object.
float delta
Used by animation functions as a way of self-regulating speed if performance drops,...
float get_uv_y(int32_t y_pixel)
Returns the Y-axis UV coordinate for a given Y-axis pixel position.
CRGB * color_map
Contains the entire color map, including "invisible" areas.
void set_line_wrap(bool enabled)
Sets the line wrapping behavior.
void add_char(char c, int16_t x_pos, int16_t y_pos)
Internal function for rendering a single char to the mask buffer.
void print_xy_table()
Prints the index table for the calculated XY map. Requires Serial.begin() first to function.
uint8_t * mask
Contains the entire mask, including "invisible" areas.
void begin(const uint8_t data_pin, uint8_t pixies_x, uint8_t pixies_y)
Initializes the display buffer, populates the XY coordinate table, defaults the display colors to gre...
void print(const uint8_t *icon)
Prints an Icon to the displays, at the current cursor position.
void free()
Unfreezes the current mask buffer in memory to allow showing updated text the next time show() is cal...
void blur(fract8 blur_amount)
Blurs the mask buffer in both axes by blur_amount.
void set_animation(void(*action)(PixieChroma *, float))
Accepts a preset or custom function to use for the animation ISR.
void clear()
Clears (blackens) the current mask buffer and resets the cursor to 0,0.
uint16_t NUM_LEDS
Stores the total number of physical LEDs, not including invisible pixels. This is calculated for you ...
uint16_t matrix_width
Stores the final width of the matrix, including invisible pixels.
CRGBPalette16 current_palette
The current FastLED CRGBPalette16 used for animations.
void show()
Processes 1D image data into truncated versions, sending them to the Pixie Chroma displays.
uint16_t uv(float x, float y, bool wrap=false)
This wrapper function returns the 1D color_map / mask index of a given OpenGL-style UV coordinate in ...
uint8_t get_cursor_y()
Returns the cursor's Y position.
void blur_x(fract8 blur_amount)
Blurs the mask buffer in the X axis by blur_amount.
void write(const uint8_t *icon, uint8_t x_pos=0, uint8_t y_pos=0)
Writes an icon* to a specified X and Y cursor position.
int16_t get_cursor_x_exact()
Returns the cursor's X position in exact pixel coordinates.
uint16_t xy(int32_t x, int32_t y, bool wrap=false)
This function returns the 1D color_map / mask index of a given 2D coordinate in the display matrix.
float get_uv_x(int32_t x_pixel)
Returns the X-axis UV coordinate for a given X-axis pixel position.
void color_blur_y(fract8 blur_amount)
Blurs the color buffer in the Y axis by blur_amount.
void color_blur_x(fract8 blur_amount)
Blurs the color buffer in the X axis by blur_amount.
void set_animation_speed(float speed)
Used to scale the animation speed of animation ISRs that can use pix.animation_speed() to scale their...
void color_dim(uint8_t amount)
Darkens the color buffer by an 8-bit amount.
void set_max_power(float volts, uint16_t milliamps)
Sets the maximum power budget in volts and milliamps.
uint16_t matrix_height
Stores the final height of the matrix, including invisible pixels.
int16_t get_cursor_y_exact()
Returns the cursor's Y position in exact pixel coordinates.
float frame_rate
Allows the user to access a live frame rate calculation (1 frame latency)
void set_frame_rate_target(uint16_t target)
Sets the target frame rate for animation. This target frame rate is only used to calculate delta in c...
void set_palette(const uint8_t *pal)
Accepts a const uint8_t (8-bit) array to generate a FastLED Gradient Palette at runtime:
void dim(uint8_t amount, bool reset_cursor=false)
Darkens the mask buffer by an 8-bit amount. Optionally resets the cursor position.
void set_update_mode(t_update_mode mode, uint16_t FPS=60)
Allows for automatic show() calls at a specified frames per second if AUTOMATIC is used....
void set_cursor(uint8_t x_position, uint8_t y_position=0)
Sets the cursor position in a 2D context, in whole displays.
void set_gamma_correction(bool enabled)
Allows you to enable built-in automatic gamma correction, using a fast LUT in pixie_utility....
CRGB kelvin_to_rgb(uint16_t temperature)
Approximates the conversion of a blackbody radiation temperature (i.e. 3500K) to a CRGB color object.
void begin_quad(uint8_t pixies_per_pin, uint8_t pixies_x, uint8_t pixies_y)
Initializes the display buffer, populates the XY coordinate table, defaults the display colors to gre...
uint8_t get_cursor_x()
Returns the cursor's X position.
void blur_y(fract8 blur_amount)
Blurs the mask buffer in the Y axis by blur_amount.
void hold()
Freezes the current mask buffer in memory to prevent showing unfinished text if show() automaticall f...