Smart Matrix
matrix Class Reference

Led matrix implementation for the abstract class Screen. More...

#include <matrix.hpp>

Inheritance diagram for matrix:
Screen

Public Member Functions

 matrix (int width, int height, bool double_buffer)
 Matrix constructor with default wiring. More...
 
 matrix (int width, int height, bool double_buffer, target::pin_out _lat, target::pin_out _oe, target::pin_out _clk, target::pin_out _selA, target::pin_out _selB, target::pin_out _selC, target::pin_out _selD, target::pin_out _b1, target::pin_out _g1, target::pin_out _r1, target::pin_out _b2, target::pin_out _g2, target::pin_out _r2)
 Matrix constructor with custom wiring. More...
 
void drawPixel (int x, int y, uint8_t rc, uint8_t gc, uint8_t bc) override
 Draw a given pixel with a color R G B. More...
 
void drawPixel (int x, int y, uint32_t color)
 Draw a pixel with a hexadecimale color. More...
 
void fillScreen (uint8_t r, uint8_t g, uint8_t b) override
 Fill the entire screen with r g b colors. More...
 
void fillScreen (uint32_t color)
 Fill the entire screen with a hexa or decimal color. More...
 
void clear () override
 Clear the entire screen. More...
 
void start () override
 Start the auto update of the screen. More...
 
void stop () override
 Stop the auto update of the screen. More...
 
void swap_buffer (bool copy) override
 Swap the front buffer with the back buffer. More...
 
void update () override
 Update the screen. More...
 
void update2 ()
 
bool is_using_default_pins ()
 
- Public Member Functions inherited from Screen
 Screen (int w, int h)
 Specify the width and height of the screen. More...
 
int getWidth ()
 
int getHeight ()
 Return the height of the screen in pixel.
 

Additional Inherited Members

- Protected Attributes inherited from Screen
int width
 width and height of the screen.
 
int height
 

Detailed Description

Led matrix implementation for the abstract class Screen.

This class contains an implementation for the led matrix 32x64 but also for other led matrixes like 32x32 and 16x32.

Constructor & Destructor Documentation

matrix::matrix ( int  width,
int  height,
bool  double_buffer 
)

Matrix constructor with default wiring.

matrix constructor with given width, height and the posibility to choose a double buffer. if you chose to use a double buffer you always write into the back buffer. So you can't see the result unless you swap the buffers with swap_buffer methode.

matrix::matrix ( int  width,
int  height,
bool  double_buffer,
target::pin_out  _lat,
target::pin_out  _oe,
target::pin_out  _clk,
target::pin_out  _selA,
target::pin_out  _selB,
target::pin_out  _selC,
target::pin_out  _selD,
target::pin_out  _b1,
target::pin_out  _g1,
target::pin_out  _r1,
target::pin_out  _b2,
target::pin_out  _g2,
target::pin_out  _r2 
)

Matrix constructor with custom wiring.

matrix constructor with given width, height and the posibility to choose a double buffer. if you chose to use a double buffer you always write into the back buffer. So you can't see the result unless you swap the buffers with swap_buffer methode.

Member Function Documentation

void matrix::clear ( )
overridevirtual

Clear the entire screen.

This function clears the back buffer if double buffer is enabled otherwise clears the front buffer.

Implements Screen.

void matrix::drawPixel ( int  x,
int  y,
uint8_t  rc,
uint8_t  gc,
uint8_t  bc 
)
overridevirtual

Draw a given pixel with a color R G B.

the first int argument is the width position and the second int argument is the height position of a pixel. rgb colors are between 0 and 255. This function writes always into the back buffer if double buffer is enabled, otherwise writes into the front buffer.

Implements Screen.

void matrix::drawPixel ( int  x,
int  y,
uint32_t  color 
)
virtual

Draw a pixel with a hexadecimale color.

the first int argument is the width position and the second is the height position of a pixel. color is rgb is hexa or decimale. This function writes always into the back buffer if double buffer is enabled, otherwise writes into the front buffer.

Implements Screen.

void matrix::fillScreen ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
overridevirtual

Fill the entire screen with r g b colors.

This function fills the back buffer if double buffer is enabled otherwise clears the front buffer.

Reimplemented from Screen.

void matrix::fillScreen ( uint32_t  color)
virtual

Fill the entire screen with a hexa or decimal color.

This function fills the back buffer if double buffer is enabled otherwise clears the front buffer.

Reimplemented from Screen.

void matrix::start ( )
overridevirtual

Start the auto update of the screen.

The led matrix needs to be updated constantly. This function does the job of updating the screen with a frequenty of 200 HZ.

Reimplemented from Screen.

void matrix::stop ( )
overridevirtual

Stop the auto update of the screen.

If you stop the auto update of the screen the current picture on the screen will be removed and maybe only one row or twoo rows of the led matrix remains light.

Reimplemented from Screen.

void matrix::swap_buffer ( bool  copy)
overridevirtual

Swap the front buffer with the back buffer.

If double buffer is enabled, you can swap the front buffer and the back buffer with this function. If you need to copy the values of the updated buffer into the new back buffer you need to pass true to the copy varianle. But if you only need to swap the front buffer with the back buffer and you don't care about the old buffer (maybe because you clear the screen afterwards) the pass false to the copy variable. To avoid "tearing" swapping of buffers takes place at the end of a complete screen refresh cycle. NOTE: This function doesn't have any effect if you didn't enable the double buffer in the constructor.

Reimplemented from Screen.

void matrix::update ( void  )
overridevirtual

Update the screen.

You do not probably need to use this function. This function is used by the interrupt handler to update the screen at specefiec time intervals.

Reimplemented from Screen.


The documentation for this class was generated from the following files: