SSD1306 OLED display driver 1.8.2 This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
NanoEngineTiler< C, W, H, B > Class Template Reference

`#include <tiler.h>`

Inheritance diagram for NanoEngineTiler< C, W, H, B >:

## Public Member Functions
const NanoPoint & | getPosition () const

## Static Public Member Functions
static void | refresh ()
static void | refresh (const NanoRect &rect)
static void | refresh (const NanoPoint &point)
static void | refresh (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
static void | refreshWorld (const NanoRect &rect)
static void | refreshWorld (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
static void | refreshWorld (const NanoPoint &point)
static void | localCoordinates ()
static void | worldCoordinates ()
static void | moveTo (const NanoPoint &position)
static void | moveToAndRefresh (const NanoPoint &position)
static void | drawCallback (TNanoEngineOnDraw callback)
static bool | collision (NanoPoint &p, NanoRect &rect)
| Returns true if point is inside the rectangle area. Returns true if point is inside the rectangle area. More...

## Static Public Attributes
static const uint8_t | NE_TILE_SIZE_BITS = B
static const lcduint_t | NE_TILE_WIDTH = W
static const lcduint_t | NE_TILE_HEIGHT = H
static const uint8_t | NE_MAX_TILES_NUM = 64 >> (B - 3)

## Protected Member Functions
| NanoEngineTiler ()
static C | canvas
static uint16_t | m_refreshFlags [NE_MAX_TILES_NUM]
static TNanoEngineOnDraw | m_onDraw = nullptr
static void | displayBuffer ()
| refreshes content on oled display. Refreshes content on oled display. Call it, if you want to update the screen. Engine will update only those areas, which are marked by refresh() methods.
static void | displayPopup (const char *msg)
| prints popup message over display content prints popup message over display content More...

## Detailed Description

### template<class C, lcduint_t W, lcduint_t H, uint8_t B>
class NanoEngineTiler< C, W, H, B >

This class template is responsible for holding and updating data about areas to be refreshed on LCD display. It accepts canvas class, tile width in pixels, tile height in pixels and number of bits in tile width as arguments for the template. For example, for 8x8 8-bit RGB tiles the reference should be NanoEngineTiler<NanoCanvas8,8,8,3>, and 3 bits means 3^2 = 8. If you need to have single big buffer, holding the whole content for monochrome display, you can specify something like this NanoEngineTiler<NanoCanvas1,128,64,7>.

Definition at line 80 of file tiler.h.

## Constructor & Destructor Documentation

## ◆ NanoEngineTiler()

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

NanoEngineTiler< C, W, H, B >::NanoEngineTiler | ( |  | ) |
| inline protected

Only child classes can initialize the engine

Definition at line 84 of file tiler.h.

## Member Function Documentation

## ◆ collision()

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static bool NanoEngineTiler< C, W, H, B >::collision | ( | NanoPoint & | p,
|  | NanoRect & | rect
| ) |  |
| inline static

Returns true if point is inside the rectangle area. Returns true if point is inside the rectangle area.

Parameters

  p | - point to check
  rect | - rectangle, describing the region to check with the point

Returns
  true if point is inside the rectangle area.

Definition at line 252 of file tiler.h.

## ◆ displayPopup()

template<class C , lcduint_t W, lcduint_t H, uint8_t B>

void NanoEngineTiler< C, W, H, B >::displayPopup | ( | const char * | msg | ) |
| static protected

prints popup message over display content prints popup message over display content

Parameters

  msg | - message to display

Definition at line 329 of file tiler.h.

## ◆ drawCallback()

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::drawCallback | ( | TNanoEngineOnDraw | callback | ) |
| inline static

Sets user-defined draw callback. This callback will be called everytime, engine needs to update display content. If callback returns false, engine will not update those area. You always have a way to find out, which area is being updated by engine via NanoEngine<>::canvas::getOffset() and NanoEngine<>::NE_TILE_SIZE.

Warning
  By default canvas in the engine is initialized with local screen coordinates. So graphics object with [0,0] coordinates will be placed at topleft position on the display. But engine supports also global coordinates, in this case actual object position depends on current engine offset. Refer to worldCoordinates() and localCoordinates().

Parameters

  callback | - user-defined draw callback.

Note
  you can change draw callback anytime you need.

See also
  worldCoordinates()
  localCoordinates()

Definition at line 240 of file tiler.h.

## ◆ getPosition()

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

const NanoPoint& NanoEngineTiler< C, W, H, B >::getPosition | ( |  | ) | const
| inline

Returns current World offset

Definition at line 220 of file tiler.h.

## ◆ localCoordinates()

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::localCoordinates | ( |  | ) |
| inline static

Switches engine canvas to local coordinates system. This method can be useful to ease up drawing of some static elements on lcd display.

Warning
  do not call twice subsequentally.

Definition at line 184 of file tiler.h.

## ◆ moveTo()

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::moveTo | ( | const NanoPoint & | position | ) |
| inline static

Moves engine coordinate to new position (this sets World coordinates offset).

Definition at line 202 of file tiler.h.

## ◆ moveToAndRefresh()

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::moveToAndRefresh | ( | const NanoPoint & | position | ) |
| inline static

Moves engine coordinate to new position and mark whole display for refresh (this sets World coordinates offset).

Definition at line 211 of file tiler.h.

## ◆ refresh() [1/4]

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::refresh | ( |  | ) |
| inline static

Marks all tiles for update. Actual update will take place in display() method.

Definition at line 105 of file tiler.h.

## ◆ refresh() [2/4]

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::refresh | ( | const NanoRect & | rect | ) |
| inline static

Mark specified area in pixels for redrawing by NanoEngine. Actual update will take place in display() method.

Note
  assumes that rect is in local screen coordinates

Definition at line 115 of file tiler.h.

## ◆ refresh() [3/4]

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::refresh | ( | const NanoPoint & | point | ) |
| inline static

Mark specified area in pixels for redrawing by NanoEngine. Actual update will take place in display() method.

Definition at line 124 of file tiler.h.

## ◆ refresh() [4/4]

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::refresh | ( | lcdint_t | x1,
|  | lcdint_t | y1,
|  | lcdint_t | x2,
|  | lcdint_t | y2
| ) |  |
| inline static

Mark specified area in pixels for redrawing by NanoEngine. Actual update will take place in display() method.

Definition at line 134 of file tiler.h.

## ◆ refreshWorld() [1/3]

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::refreshWorld | ( | const NanoRect & | rect | ) |
| inline static

Marks for refresh lcd area, which corresponds to specified rectangle in global (World) coordinates. If engine offset is (0,0), then this function refreshes the same area as refresh().

Definition at line 155 of file tiler.h.

## ◆ refreshWorld() [2/3]

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::refreshWorld | ( | lcdint_t | x1,
|  | lcdint_t | y1,
|  | lcdint_t | x2,
|  | lcdint_t | y2
| ) |  |
| inline static

Marks for refresh lcd area, which corresponds to specified rectangle in global (World) coordinates. If engine offset is (0,0), then this function refreshes the same area as refresh().

Definition at line 165 of file tiler.h.

## ◆ refreshWorld() [3/3]

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::refreshWorld | ( | const NanoPoint & | point | ) |
| inline static

Marks specified pixel area for redrawing by NanoEngine.

Parameters

  point | point in global (World) coordinates

Definition at line 174 of file tiler.h.

## ◆ worldCoordinates()

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

static void NanoEngineTiler< C, W, H, B >::worldCoordinates | ( |  | ) |
| inline static

Switches engine canvas to global (World) coordinates system. This method can be useful to create screen moving animation.

Warning
  do not call twice subsequentally.

Definition at line 194 of file tiler.h.

## Member Data Documentation

## ◆ canvas

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

C NanoEngineTiler< C, W, H, B >::canvas
| static

object, representing canvas. Use it in your draw handler

Definition at line 100 of file tiler.h.

## ◆ m_onDraw

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

TNanoEngineOnDraw NanoEngineTiler< C, W, H, B >::m_onDraw = nullptr
| static protected

Callback to call if specific tile needs to be updated

Definition at line 262 of file tiler.h.

## ◆ m_refreshFlags

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

uint16_t NanoEngineTiler< C, W, H, B >::m_refreshFlags
| static protected

Contains information on tiles to be updated. Elements of array are rows and bits are columns.

Definition at line 259 of file tiler.h.

## ◆ NE_MAX_TILES_NUM

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

const uint8_t NanoEngineTiler< C, W, H, B >::NE_MAX_TILES_NUM = 64 >> (B - 3)
| static

Max tiles supported in X

Definition at line 97 of file tiler.h.

## ◆ NE_TILE_HEIGHT

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

const lcduint_t NanoEngineTiler< C, W, H, B >::NE_TILE_HEIGHT = H
| static

Height of tile in pixels

Definition at line 95 of file tiler.h.

## ◆ NE_TILE_SIZE_BITS

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

const uint8_t NanoEngineTiler< C, W, H, B >::NE_TILE_SIZE_BITS = B
| static

Number of bits in tile size. 5 corresponds to 1<<5 = 32 tile size

Definition at line 91 of file tiler.h.

## ◆ NE_TILE_WIDTH

template<class C, lcduint_t W, lcduint_t H, uint8_t B>

const lcduint_t NanoEngineTiler< C, W, H, B >::NE_TILE_WIDTH = W
| static

Width of tile in pixels

Definition at line 93 of file tiler.h.

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

- nano_engine/tiler.h