Longan Nano
Longan Nano Demo
|
Longan Nano Screen Class. More...
#include <longan_nano_screen.hpp>
Classes | |
struct | _Format_number |
number format to be printed by the print number method More... | |
struct | _Frame_buffer_sprite |
Structure that describes a sprite in the sprite frame buffer. More... | |
struct | _Fsm_status |
Status of the update FSM. More... | |
Public Types | |
enum | _Config { PEDANTIC_CHECKS = true, SPRITE_WIDTH = 8, SPRITE_HEIGHT = FONT_HEIGHT, SPRITE_PIXEL_COUNT = SPRITE_HEIGHT *SPRITE_WIDTH, SPRITE_SCAN_LIMIT = 5, NUM_SPECIAL_SPRITES = 5, SPRITE_TRANSPARENT = 0, SPRITE_BLACK = 1, SPRITE_WHITE = 2, SPRITE_BACKGROUND = 3, SPRITE_FOREGROUND = 4, ASCII_START = ' ', ASCII_STOP = '~', PALETTE_SIZE = 16, PALETTE_SIZE_BIT = 4, FRAME_BUFFER_WIDTH = Longan_nano::Display::Config::WIDTH /SPRITE_WIDTH, FRAME_BUFFER_HEIGHT = Longan_nano::Display::Config::HEIGHT /SPRITE_HEIGHT, FRAME_BUFFER_SIZE = FRAME_BUFFER_WIDTH *FRAME_BUFFER_HEIGHT, SPRITE_SIZE = 128, SPRITE_SIZE_BIT = 7 } |
Configuration parameters for the logical screen. More... | |
enum | _Color { BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LGRAY, DGRAY, LBLUE, LGREEN, LCYAN, LRED, LMAGENTA, YELLOW, WHITE } |
Use the default Color palette. Short hand indexes for user. User can change the palette at will. More... | |
enum | _Format_format { NUM, ENG } |
Possible number configurations. More... | |
enum | _Format_align { ADJ_LEFT, ADJ_RIGHT } |
Left or Right alignment for a number. More... | |
enum | _Error { OK, PENDING_OVERFLOW, PENDING_UNDERFLOW, REGISTER_SPRITE_FAIL, BAD_ERROR_CODE, NUM_ERROR_CODES } |
Enumerate possible error of the Screen class. More... | |
typedef enum Longan_nano::Screen::_Config | Config |
Configuration parameters for the logical screen. More... | |
typedef enum Longan_nano::Screen::_Color | Color |
Use the default Color palette. Short hand indexes for user. User can change the palette at will. More... | |
typedef enum Longan_nano::Screen::_Format_format | Format_format |
Possible number configurations. More... | |
typedef enum Longan_nano::Screen::_Format_align | Format_align |
Left or Right alignment for a number. More... | |
typedef enum Longan_nano::Screen::_Error | Error |
Enumerate possible error of the Screen class. More... | |
Public Member Functions | |
Screen (void) | |
empty constructor Screen | void More... | |
~Screen (void) | |
empty destructor ~Screen | void | More... | |
bool | init (void) |
public init init | void More... | |
bool | reset_colors (void) |
public init reset_colors | More... | |
int | set_color (int origin_h, int origin_w, Color background, Color foreground) |
public setter set_color | int | int | Color | Color More... | |
int | set_default_colors (Color new_background, Color new_foreground) |
public setter set_default_colors | Color | Color More... | |
int | set_palette_color (Color palette_index, uint8_t r, uint8_t g, uint8_t b) |
public setter set_palette_color | Color | uint8_t | uint8_t | uint8_t | More... | |
bool | set_format (int number_size, Format_align align, Format_format format) |
public setter set_format | int | Format_align | Format_format | More... | |
bool | set_format (int number_size, Format_align align, Format_format format, int exp) |
public setter set_format | int | Format_align | Format_format | int | More... | |
int | get_pending (void) |
public getter get_pending | void | More... | |
Error | get_error (void) |
public getter get_pending | void | More... | |
bool | update (void) |
public method update | void More... | |
int | change_color (Color source, Color dest) |
public method change_color | Color | Color | More... | |
int | clear (void) |
public method clear | void | More... | |
int | clear (Color color_tmp) |
public method clear | Color | More... | |
int | print (int origin_h, int origin_w, char c, Color background, Color foreground) |
public method print | int | int | char | Color | Color More... | |
int | print (int origin_h, int origin_w, char c, Color foreground) |
public method print | int | int | char | Color More... | |
int | print (int origin_h, int origin_w, char c) |
public method print | int | int | char | More... | |
int | print (int origin_h, int origin_w, const char *str, Color background, Color foreground) |
public method print | int | int | const char * | Color | Color | More... | |
int | print (int origin_h, int origin_w, const char *str, Color foreground) |
public method print | int | int | const char* | Color | More... | |
int | print (int origin_h, int origin_w, const char *str) |
public method print | int | int | const char* | More... | |
int | print (int origin_h, int origin_w, int num, Color background, Color foreground) |
public method print | int | int | int | Color | Color | More... | |
int | print (int origin_h, int origin_w, int num, Color foreground) |
public method print | int | int | int | Color | More... | |
int | print (int origin_h, int origin_w, int num) |
public method print | int | int | int | More... | |
int | paint (int origin_h, int origin_w, Color color) |
public method paint | int | int | Color | More... | |
int | print_err (int origin_h, int origin_w) |
public method print_err | int | int | More... | |
Static Public Member Functions | |
static uint16_t | color (uint8_t r, uint8_t g, uint8_t b) |
Public Method color | uint8_t | uint8_t | uint8_t |. More... | |
Private Types | |
enum | _Fsm_state { SCAN_SPRITE, SEND_SPRITE } |
States of the Screen side FSM. Display driver also has its own FSM states More... | |
typedef enum Longan_nano::Screen::_Fsm_state | Fsm_state |
States of the Screen side FSM. Display driver also has its own FSM states More... | |
typedef struct Longan_nano::Screen::_Frame_buffer_sprite | Frame_buffer_sprite |
Structure that describes a sprite in the sprite frame buffer. More... | |
typedef struct Longan_nano::Screen::_Fsm_status | Fsm_status |
Status of the update FSM. More... | |
typedef struct Longan_nano::Screen::_Format_number | Format_number |
number format to be printed by the print number method More... | |
Private Types inherited from Longan_nano::Display | |
enum | _Config { WIDTH = 160, HEIGHT = 80, PIXEL_COUNT = WIDTH *HEIGHT, COLOR_DEPTH = 16, ROW_ADDRESS_OFFSET = 1, COL_ADDRESS_OFFSET = 26, RS_GPIO = GPIOB, RS_PIN = GPIO_PIN_0, RST_GPIO = GPIOB, RST_PIN = GPIO_PIN_1, RESET_DELAY = 1, SPI_CH = SPI0, SPI_CS_GPIO = GPIOB, SPI_CS_PIN = GPIO_PIN_2, SPI_CLK_GPIO = GPIOA, SPI_CLK_PIN = GPIO_PIN_5, SPI_MISO_GPIO = GPIOA, SPI_MISO_PIN = GPIO_PIN_6, SPI_MOSI_GPIO = GPIOA, SPI_MOSI_PIN = GPIO_PIN_7, USE_DMA = true, DMA_SPI_TX = DMA0, DMA_SPI_TX_CH = (dma_channel_enum)DMA_CH2 } |
Configuration parameters of the LCD Display class. More... | |
typedef enum Longan_nano::Display::_Config | Config |
Configuration parameters of the LCD Display class. More... | |
Private Member Functions | |
bool | init_class_vars (void) |
private init init_class_vars | void | More... | |
bool | init_frame_buffer (void) |
private init init_frame_buffer | void More... | |
bool | init_default_colors (void) |
private init init_default_colors | void | More... | |
bool | init_palette (void) |
private init init_palette | void More... | |
bool | init_fsm (void) |
private init init_fsm | void | More... | |
bool | is_valid_char (char c) |
private tester is_valid_char | char | More... | |
bool | is_using_background (uint8_t sprite) |
private tester is_using_background | uint8_t | More... | |
bool | is_using_foreground (uint8_t sprite) |
private tester is_using_foreground | uint8_t | More... | |
bool | is_same_sprite (Frame_buffer_sprite sprite_a, Frame_buffer_sprite sprite_b) |
private tester is_same_sprite | Frame_buffer_sprite | Frame_buffer_sprite | More... | |
int8_t | register_sprite (uint16_t index_h, uint16_t index_w) |
private method register_sprite | uint16_t | uint16_t | More... | |
int8_t | update_sprite (uint16_t index_h, uint16_t index_w, Frame_buffer_sprite new_sprite) |
private tester update_sprite | uint16_t | uint16_t | Frame_buffer_sprite | More... | |
void | report_error (Error error_code) |
private setter report_error | Error | More... | |
Private Member Functions inherited from Longan_nano::Display | |
Display (void) | |
constructor Display | void | More... | |
~Display (void) | |
destructor ~Display | void | More... | |
bool | init (void) |
Public init init | void |. More... | |
int | register_sprite (int origin_h, int origin_w, int size_h, int size_w, uint16_t *sprite_ptr) |
public method register_sprite | int | int | int | int | uint16_t * | More... | |
int | register_sprite (int origin_h, int origin_w, int size_h, int size_w, uint16_t sprite_color) |
public method register_sprite | int | int | int | int | uint16_t | More... | |
bool | update_sprite (void) |
public method update_sprite | void | More... | |
int | draw_sprite (int origin_h, int origin_w, int size_h, int size_w, uint16_t *sprite_ptr) |
public method draw_sprite | int | int | int | int | uint16_t * | More... | |
int | draw_sprite (int origin_h, int origin_w, int size_h, int size_w, uint16_t sprite_color) |
public method draw_sprite | int | int | int | int | uint16_t | More... | |
int | clear (void) |
public method clear | void | More... | |
int | clear (uint16_t color) |
public method clear | void | More... | |
Private Attributes | |
Error | g_error_code |
Error code of the library. Default is Error::OK. More... | |
Color | g_default_background_color |
Default background and foreground colors to be used. More... | |
Color | g_default_foreground_color |
uint16_t | g_palette [Config::PALETTE_SIZE] |
Color Palette. One special code for transparent. Two special indexes store global background and foreground. More... | |
Frame_buffer_sprite | g_frame_buffer [Config::FRAME_BUFFER_HEIGHT][Config::FRAME_BUFFER_WIDTH] |
Frame Buffer. More... | |
uint16_t | g_pending_cnt |
Track the number of sprites that require update. At zero the update method quit without scanning and print methods will set the scan to the correct index. More... | |
uint16_t | g_pixel_data [Config::SPRITE_PIXEL_COUNT] |
Sprite buffer that stores raw pixel data for a single sprite. More... | |
Fsm_status | g_status |
Status of the update FSM. More... | |
Format_number | g_format_number |
Display format for print numeric values. More... | |
Static Private Attributes | |
static constexpr uint8_t | g_ascii_sprites [96 *10] |
ASCII Sprites. Stored in the flash memory. 95 sprites from space ' ' code 32 to tilda '~' code 126 + special code 127. FONT_HEIGHT is used to change font. More... | |
Additional Inherited Members | |
Static Private Member Functions inherited from Longan_nano::Display | |
static uint16_t | color (uint8_t r, uint8_t g, uint8_t b) |
Public Method color | uint8_t | uint8_t | uint8_t |. More... | |
Longan Nano Screen Class.
Screen class: abstraction layer for low level LCD HAL for the ST7735S Longan Nano Display
Screen provides a frame buffer and functions to write on it
LCD class: low level driver for screen hardware. Inherited by screen
2020-07-09
Formulated architeture
Focus on Display dirver first
2020-07-23
Display driver working
Core methods: register_sprite and update
Formulated palette, frame sprite and sprite pixel buffer architecture
Use 16x08 sprites. They already exists and 8 by 8 are too small
Structure of the Screen Update FSM Up
FSM is partitioned into the Display side FSM that handles the physical display and the Screen side FSM that handles the sprite based frame buffer
Screen class is designed to massively reduce memory usage and data sent to physical display. Most of the time I need fast updating characters and nothing more.
2020-07-24
Added through debug
BUG: Color decoding macro: FIXED
Test clear black and white inherited from display: SUCCESS
clear function tested with background calls from update and periodic calls of clear triggered by the RTC interrupt
Test clear screen cycling colors from the palette: SUCCESS
2020-07-25
Test random characters in random position: SUCCESS
"is_same" check if two sprites are the same looking for all the nuances
"paint" method, meant to draw special graphics sprites
"Symbol" enum, meant to provide a few graphical sprites. Few in numbers and meant for light graphics, like progress bars.
Test draw a random sprite with a random color:
2020-07-26
Test print string functions: SUCCESS
Change architecture: do not use RTC ISR but use chrono class for timings. Save a peripheral and achieve a mini hardwired scheduler. PA8 release button switches between demos: SUCCESS
2020-07-27
print number with format
User::String class handles number to string conversion up to 32b signed and unsigned
2020-07-28
tested print numbers with format: SUCCESS
bugfix: check that the number fits than the allowed size. Caused dot artifacts on screen
2020-07-29
"change_color" allow to change the color of all sprites from one to another. E.G. red background to blue background
"set_default_colors" allow to set the default background and foreground colors to be used. Change all the sprites that use those colors as well
"set_palette_color" change a color in the palette. Mark all the sprites that use those colors for update
2020-07-30
color methods
2020-07-31
change color demo
with this release, I have a working screen library that does all I need it to do with 2.804% CPU usage at 100uS slice time
I will add to this library as i work on the end applications and find bugs and shortcomings
BUGFIX: print string had a botched same sprite detection 0.18% absolute performance improvement
Now print number won't refresh sprites that have not changed
Migrated print functions to return the number of updated sprites. -1 if error
2020-08-03
g_pending_cnt was meant to skip scan if zero sprites need updating in the frame buffer
it just increases CPU use overall, so was removed
Paint square method. Removed Symbols.
2020-08-04
Unpack methods from class to make the header interface clear while keeping the implementation in the .hpp
Complete doxygen documentation for all methods
2020-08-06
Add pending_cnt. When counter is zero, the update method won't waste time scanning and print method will start seeking from the first valid sprite saving CPU
Adding error codes and print_err
Add rule. allow conditional formatting of number based on rules
Generated two fonts. 16 pixel height NSimSun and 10 pixel height Courier Now
2020-08-07
Bugfix: Driver wasn't taking advantage of the Display solid color register method to avoid computing a complex color map
and was always computing a full color map. Now solid sprites just send one color.
2020-08-08
Bugfix: The draw string with colors and set color methods sometimes didn't update the sprites correctly
either duplicating the previous char or leaving an artifact on pixel 0,0 of the sprite
it was caused by the update FSM disagreeing on which sprites were solid colors or color maps
now a register_sprite method combine the processing of color data and registering of sprites
this reduces workload and solves the bug. Now Screen::register_sprite and Display::register_sprite nicely handle the hierarchy
just like Screen::update and Display::update
typedef enum Longan_nano::Screen::_Color Longan_nano::Screen::Color |
Use the default Color palette. Short hand indexes for user. User can change the palette at will.
typedef enum Longan_nano::Screen::_Config Longan_nano::Screen::Config |
Configuration parameters for the logical screen.
typedef enum Longan_nano::Screen::_Error Longan_nano::Screen::Error |
Enumerate possible error of the Screen class.
Left or Right alignment for a number.
Possible number configurations.
|
private |
number format to be printed by the print number method
|
private |
Structure that describes a sprite in the sprite frame buffer.
|
private |
|
private |
Status of the update FSM.
Use the default Color palette. Short hand indexes for user. User can change the palette at will.
Enumerator | |
---|---|
BLACK | |
BLUE | |
GREEN | |
CYAN | |
RED | |
MAGENTA | |
BROWN | |
LGRAY | |
DGRAY | |
LBLUE | |
LGREEN | |
LCYAN | |
LRED | |
LMAGENTA | |
YELLOW | |
WHITE |
Configuration parameters for the logical screen.
Enumerate possible error of the Screen class.
Enumerator | |
---|---|
OK | |
PENDING_OVERFLOW | |
PENDING_UNDERFLOW | |
REGISTER_SPRITE_FAIL | |
BAD_ERROR_CODE | |
NUM_ERROR_CODES |
|
private |
Longan_nano::Screen::Screen | ( | void | ) |
Longan_nano::Screen::~Screen | ( | void | ) |
empty destructor ~Screen | void |
Void destructor
public method change_color | Color | Color |
source | | Color | color to be changed |
dest | | Color | replacement color |
Every sprite that use the "source" palette color as either background or foreground has it swapped for the "dest" palette color. All changed sprites are marked for update
int Longan_nano::Screen::clear | ( | Color | color_tmp | ) |
public method clear | Color |
color_tmp | | Color | index of the solid sprite in the palette |
Clear the screen by setting a solid color sprite to each element of the sprite frame buffer
int Longan_nano::Screen::clear | ( | void | ) |
public method clear | void |
Clear the screen by setting a solid color sprite to each element of the sprite frame buffer
|
static |
Public Method color | uint8_t | uint8_t | uint8_t |.
r | | uint8_t | 8bit red color channel |
g | | uint8_t | 8bit green color channel |
b | | uint8_t | 8bit blue color channel |
convert from 24b 8R8G8B space to 16bit 5R6G5B space
RRRRRRRR
GGGGGGGG
BBBBBBBB
RRRRRGGGGGGBBBBB
Screen::Error Longan_nano::Screen::get_error | ( | void | ) |
int Longan_nano::Screen::get_pending | ( | void | ) |
bool Longan_nano::Screen::init | ( | void | ) |
public init init | void
call the initializations for the driver
|
private |
private init init_class_vars | void |
Initialize the class vars
|
inlineprivate |
private init init_default_colors | void |
Initialize the default background and foreground colors
|
private |
private init init_frame_buffer | void
Initialize the sprite frame buffer
|
private |
private init init_fsm | void |
Initialize the update FSM machine
|
private |
private init init_palette | void
initialize palette to default values
|
private |
private tester is_same_sprite | Frame_buffer_sprite | Frame_buffer_sprite |
check if sprite_a is functionally the same as sprite_b this is used to decide if mark a sprite for update or leave it as is this function is more nuanced that it appears this function is inside the drivers and assumes all relevant checks have been made by interface functions E.G. >a foreground sprite with with foreground is the same as a background sprite with white background E.G. >writing 'a' red on black is differet from writing 'a' green on black A change of a color in the palette will automatically mark for update all characters that use that palette color, but its taken care by the relevant function Because of that, no function but the update FSM is allowed to deactivate the update flag, so don't be overly aggressive with the result of this function
|
inlineprivate |
private tester is_using_background | uint8_t |
return true if the sprite make use of the background palette color
|
inlineprivate |
private tester is_using_foreground | uint8_t |
return true if the sprite make use of the foreground palette color
|
inlineprivate |
private tester is_valid_char | char |
return true if the char is stored inside the ascii sprite table
int Longan_nano::Screen::paint | ( | int | origin_h, |
int | origin_w, | ||
Color | color | ||
) |
public method paint | int | int | Color |
Draw a solid color on the screen
There are ery few graphics sprite as they ar meant for progress bars and little more
|
inline |
public method print | int | int | char |
origin_h | | int | height position of the sprite |
origin_w | | int | width position of the sprite |
c | | char | ascii char to be drawn |
print a char inside the sprite frame buffer and mark it for update if needs to be
uses default background and foreground colors
int Longan_nano::Screen::print | ( | int | origin_h, |
int | origin_w, | ||
char | c, | ||
Color | background, | ||
Color | foreground | ||
) |
public method print | int | int | char | Color | Color
origin_h | | int | height position of the sprite |
origin_w | | int | width position of the sprite |
c | | char | ascii char to be drawn |
background | | Color | background color of ths sprite as index from the palette |
foreground | | Color | foreground color of ths sprite as index from the palette |
Print a character on screen using user defined background and foreground colors
Mark the sprite for update if needs to be
|
inline |
public method print | int | int | char | Color
origin_h | | int | height position of the sprite |
origin_w | | int | width position of the sprite |
c | | char | ascii char to be drawn |
foreground | | Color | foreground color of ths sprite as index from the palette |
Print a character on screen using default background color but a user defined foreground color
|
inline |
public method print | int | int | const char* |
origin_h | | int | height position of the sprite |
origin_w | | int | width position of the sprite |
str | | const char * | string to be drawn. Must be null terminated |
print a char inside the sprite frame buffer and mark it for update if needs to be
uses default background and foreground colors
wrapper for more general print string function
int Longan_nano::Screen::print | ( | int | origin_h, |
int | origin_w, | ||
const char * | str, | ||
Color | background, | ||
Color | foreground | ||
) |
public method print | int | int | const char * | Color | Color |
origin_h | | int | height position of the sprite |
origin_w | | int | width position of the sprite |
str | | const char * | string to be drawn. Must be null terminated |
background | | Color | background color of ths sprite as index from the palette |
foreground | | Color | foreground color of ths sprite as index from the palette |
Print a string on screen using user defined background and foreground colors
Strings will not wrap around the screen
String must be \0 terminated
|
inline |
public method print | int | int | const char* | Color |
origin_h | | int | height position of the sprite |
origin_w | | int | width position of the sprite |
str | | const char * | string to be drawn. Must be null terminated |
foreground | | Color | foreground color of ths sprite as index from the palette |
print a char inside the sprite frame buffer and mark it for update if needs to be
use default background
wrapper for more general print string function
|
inline |
public method print | int | int | int |
origin_h | | int | height position of the first character |
origin_w | | int | width position of the first character |
num | | int | number to be shown on screen |
Print a number on screen. Overload with default background and foreground
int Longan_nano::Screen::print | ( | int | origin_h, |
int | origin_w, | ||
int | num, | ||
Color | background, | ||
Color | foreground | ||
) |
public method print | int | int | int | Color | Color |
origin_h | | int | height position of the first character |
origin_w | | int | width position of the first character |
num | | int | number to be shown on screen |
background | | Color | background color of ths sprite as index from the palette |
foreground | | Color | foreground color of ths sprite as index from the palette |
Print a number on screen. Format configuration is handled by format
With left asjust, the number is print starting from left an origin is the position of the most significant number
With right adjust, the origin is the position of the least significant number
LEFT 78901 12.71m
RIGHT 78901 12.71m
ORIGIN ^ ^
The format also specifies full number or enginnering format
|
inline |
public method print | int | int | int | Color |
origin_h | | int | height position of the first character |
origin_w | | int | width position of the first character |
num | | int | number to be shown on screen |
foreground | | Color | foreground color of ths sprite as index from the palette |
Print a number on screen. Overload with default background.
int Longan_nano::Screen::print_err | ( | int | origin_h, |
int | origin_w | ||
) |
public method print_err | int | int |
origin_h | | int | height position of the sprite |
origin_w | | int | width position of the sprite |
print a char inside the sprite frame buffer and mark it for update if needs to be
use default background
wrapper for more general print string function
|
private |
private method register_sprite | uint16_t | uint16_t |
index_h | | uint16_t | index of the sprite in the frame buffer to build pixel from |
index_w | | uint16_t | index of the sprite in the frame buffer to build pixel from |
Register a sprite for draw in the display driver if possible
Sprite can be xomplex color map or solid color
|
private |
private setter report_error | Error |
error_code | | Error | error code of the Screen Class |
Method
bool Longan_nano::Screen::reset_colors | ( | void | ) |
public init reset_colors |
Reset the colors to default
|
inline |
public setter set_color | int | int | Color | Color
origin_h | | int | height position of the sprite |
origin_w | | int | width position of the sprite |
background | | Color | background color of ths sprite as index from the palette |
foreground | | Color | foreground color of ths sprite as index from the palette |
Set background and foreground color of a given sprite
public setter set_default_colors | Color | Color
new_background | | Color | background color of ths sprite as index from the palette |
new_foreground | | Color | foreground color of ths sprite as index from the palette |
Change the default background and foreground colors
All existing sprites are automatically updated as needed
|
inline |
public setter set_format | int | Format_align | Format_format |
number_size | | int | sprites reserved for the number |
align | | Format_align | set alignment of the number |
format | | Format_format | set display format of the number |
With left adjust, the number is print starting from left an origin is the position of the most significant number
With right adjust, the origin is the position of the least significant number
LEFT 78901 12.71m
RIGHT 78901 12.71m
ORIGIN ^ ^
The format also specifies full number or enginnering format
|
inline |
public setter set_format | int | Format_align | Format_format | int |
number_size | | int | sprites reserved for the number |
align | | Format_align | set alignment of the number |
format | | Format_format | set display format of the number |
exp | | int | ENG number exponent |
With left adjust, the number is print starting from left an origin is the position of the most significant number
With right adjust, the origin is the position of the least significant number
LEFT 78901 12.71m
RIGHT 78901 12.71m
ORIGIN ^ ^
The format also specifies full number or enginnering format
int Longan_nano::Screen::set_palette_color | ( | Color | palette_index, |
uint8_t | r, | ||
uint8_t | g, | ||
uint8_t | b | ||
) |
public setter set_palette_color | Color | uint8_t | uint8_t | uint8_t |
palette_index | | Color | color index of the palette to be changed |
r | | uint8_t | red color channel |
g | | uint8_t | red color channel |
b | | uint8_t | red color channel |
Change a color in the palette to another RGB color
Change all sprites that use that color and mark them for update
Use the conversion function provided by the Display driver to compute the right color space
bool Longan_nano::Screen::update | ( | void | ) |
public method update | void
FSM that synchronize the frame buffer with the display using the driver The low level driver exposes control steps used by the high level frame buffer driver
|
private |
private tester update_sprite | uint16_t | uint16_t | Frame_buffer_sprite |
Update a sprite in the frame buffer and mark it for update if required Increase the workload counter if applicable If workload counter is zero, set the scan to the current sprite to quicken the seek
|
staticconstexprprivate |
ASCII Sprites. Stored in the flash memory. 95 sprites from space ' ' code 32 to tilda '~' code 126 + special code 127. FONT_HEIGHT is used to change font.
|
private |
Default background and foreground colors to be used.
|
private |
|
private |
Error code of the library. Default is Error::OK.
|
private |
Display format for print numeric values.
|
private |
Frame Buffer.
|
private |
Color Palette. One special code for transparent. Two special indexes store global background and foreground.
|
private |
Track the number of sprites that require update. At zero the update method quit without scanning and print methods will set the scan to the correct index.
|
private |
Sprite buffer that stores raw pixel data for a single sprite.
|
private |
Status of the update FSM.