Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otWS2812 Class Reference
[WS2812 LED - Procedures for led matrix based on WS2812WS2812 LED - Procedures for led matrix based on WS2812]

Class that allows to use led panels based on the WS2812.

#include <otWS2812.h>


Public Member Functions

 otWS2812 (int bit, int xsize, int ysize)
 otWS2812 ()
 Create the otWS2812 object.
void mirror (bool x, bool y)
void setOffset (int val)
void show ()
 Copy the display buffer to the display itself All available graphic functions work on memory buffers. In order for the operations carried out to be made visible, this function must be called.
void clear ()
void setPixel (int x, int y, U8 r, U8 g, U8 b)
void line (int x0, int y0, int x1, int y1, U8 r, U8 g, U8 b)
void rect (int x0, int y0, int x1, int y1, U8 r, U8 g, U8 b)
void rectFill (int x0, int y0, int x1, int y1, U8 r, U8 g, U8 b)
void circle (int x0, int y0, int ray, U8 r, U8 g, U8 b)
void circleFill (int x0, int y0, int ray, U8 r, U8 g, U8 b)
void rectRound (int x, int y, int w, int h, int ray, U8 r, U8 g, U8 b)
void rectRoundFill (int x, int y, int w, int h, int ray, U8 r, U8 g, U8 b)
void triangle (int x0, int y0, int x1, int y1, int x2, int y2, U8 r, U8 g, U8 b)
void digit (char dig, int x0, int y0, U8 r, U8 g, U8 b)
 Draw a colored character. Draw a character form these: 01234567890 :-+. Used character matrix is 3x5 (WxH).
int string (const char *txt, int x0, int y0, U8 r, U8 g, U8 b)
 Draw a string. Not all characters are displayed see digit.
void setBitmap (const U8 *bitMap, U8 div)
 Copy a bitmap into display area Bitmap must be a sequence of R,G,B,0xFF.


Constructor & Destructor Documentation

otWS2812.otWS2812 int  bit,
int  xsize,
int  ysize
 

Create the object and initialize the requested hardware.

Parameters:
bit Number of bit of the serial data output.
xsize Number of horizontal pixels.
ysize Number of vertical pixels.

otWS2812.otWS2812  ) 
 


Member Function Documentation

void otWS2812.circle int  x0,
int  y0,
int  ray,
U8  r,
U8  g,
U8  b
 

Draw a colored circle.

Parameters:
x0 Horizontal start position
y0 Vertical start position
ray Circle ray
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.circleFill int  x0,
int  y0,
int  ray,
U8  r,
U8  g,
U8  b
 

Draw a colored filled circle.

Parameters:
x0 Horizontal start position
y0 Vertical start position
ray Circle ray
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.clear  ) 
 

Clear the display buffer contents

void otWS2812.digit char  dig,
int  x0,
int  y0,
U8  r,
U8  g,
U8  b
 

Parameters:
dig Character to draw
x0 Horizontal start position of the character
y0 Vertical start position of the character
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.line int  x0,
int  y0,
int  x1,
int  y1,
U8  r,
U8  g,
U8  b
 

Draw a colored line.

Parameters:
x0 Horizontal start position
y0 Vertical start position
x1 Horizontal end position
y1 Vertical end position
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.mirror bool  x,
bool  y
 

Invert axys

Parameters:
x If true invert horizontal axys
y If true invert vertical axys

void otWS2812.rect int  x0,
int  y0,
int  x1,
int  y1,
U8  r,
U8  g,
U8  b
 

Draw a colored rectangle frame.

Parameters:
x0 Horizontal start position
y0 Vertical start position
x1 Horizontal end position
y1 Vertical end position
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.rectFill int  x0,
int  y0,
int  x1,
int  y1,
U8  r,
U8  g,
U8  b
 

Draw a colored filled rectangle.

Parameters:
x0 Horizontal start position
y0 Vertical start position
x1 Horizontal end position
y1 Vertical end position
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.rectRound int  x,
int  y,
int  w,
int  h,
int  ray,
U8  r,
U8  g,
U8  b
 

Draw a rectangle with rounded corners.

Parameters:
x Horizontal start position
y Vertical start position
w Horizontal width
h Vertical height
ray Corner ray
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.rectRoundFill int  x,
int  y,
int  w,
int  h,
int  ray,
U8  r,
U8  g,
U8  b
 

Draw a filled rectangle with rounded corners.

Parameters:
x Horizontal start position
y Vertical start position
w Horizontal width
h Vertical height
ray Corner ray
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.setBitmap const U8 bitMap,
U8  div
 

Parameters:
bitMap Pointer to bitmap
div Divider, 1 = Divide by 2, 2 divide by 4. Used to adjust image range.

void otWS2812.setOffset int  val  ) 
 

Specify an offset, as number of pixel, for character spacing

Parameters:
val Number of pixel used as spacing.

void otWS2812.setPixel int  x,
int  y,
U8  r,
U8  g,
U8  b
 

Set a pixel at specified address with a color.

Parameters:
x Horizontal position
y Vertical position
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.show  ) 
 

int otWS2812.string const char *  txt,
int  x0,
int  y0,
U8  r,
U8  g,
U8  b
 

Parameters:
txt String to be draw
x0 Horizontal start position of the string
y0 Vertical start position of the string
r Red value 0:255
g Green value 0:255
b Blue value 0:255

void otWS2812.triangle int  x0,
int  y0,
int  x1,
int  y1,
int  x2,
int  y2,
U8  r,
U8  g,
U8  b
 

Draw a colored triangle.

Parameters:
x0 Horizontal start of base
y0 Vertical start of base
x1 Horizontal end of base
y1 Vertical end of base
x2 Horizontal coordinate of top vertex
y2 vertical coordinate of top vertex
r Red value 0:255
g Green value 0:255
b Blue value 0:255


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0