FabGL
ESP32 Display Controller and Graphics Library
fabgl::VGATextController Class Reference

Represents the VGA text-only controller. More...

#include <vgatextcontroller.h>

Inheritance diagram for fabgl::VGATextController:
Collaboration diagram for fabgl::VGATextController:

Public Member Functions

void adjustMapSize (int *columns, int *rows)
 Adjust columns and rows to the controller limits. More...
 
void begin (gpio_num_t redGPIO, gpio_num_t greenGPIO, gpio_num_t blueGPIO, gpio_num_t HSyncGPIO, gpio_num_t VSyncGPIO)
 This is the 8 colors (5 GPIOs) initializer. More...
 
void begin (gpio_num_t red1GPIO, gpio_num_t red0GPIO, gpio_num_t green1GPIO, gpio_num_t green0GPIO, gpio_num_t blue1GPIO, gpio_num_t blue0GPIO, gpio_num_t HSyncGPIO, gpio_num_t VSyncGPIO)
 This is the 64 colors (8 GPIOs) initializer. More...
 
void begin ()
 This is the 64 colors (8 GPIOs) initializer using default pinout. More...
 
DisplayControllerType controllerType ()
 Determines the display controller type. More...
 
int getScreenHeight ()
 Determines the screen height in pixels. More...
 
int getScreenWidth ()
 Determines the screen width in pixels. More...
 
void setResolution (char const *modeline=nullptr)
 Sets fixed resolution. More...
 
void setTextMap (uint32_t const *map, int rows)
 Sets text map to display. More...
 

Detailed Description

Represents the VGA text-only controller.

The text only VGA controller allows only text, but requires less than 50K of RAM. Resolution is fixed at 640x480, with 80 columns by 34 rows, 16 colors.

Text only output is very CPU intensive process and consumes up to 30% of one CPU core. Anyway this allows to have more than 290K free for your application.

Graphics (Canvas) aren't possible. Also, some character styles aren't also possible (double size, 132 columns, italic).

This example initializes VGA Text Controller with 64 colors (16 usable):

fabgl::VGATextController VGAController;
// the default assigns GPIO22 and GPIO21 to Red, GPIO19 and GPIO18 to Green, GPIO5 and GPIO4 to Blue, GPIO23 to HSync and GPIO15 to VSync
VGAController.begin();
VGAController.setResolution();
Examples:
VGA/Altair8800/Altair8800.ino, VGA/LoopbackTerminal/LoopbackTerminal.ino, VGA/MultitaskingCPM/MultitaskingCPM.ino, and VGA/NetworkTerminal/NetworkTerminal.ino.

Member Function Documentation

◆ adjustMapSize()

void fabgl::VGATextController::adjustMapSize ( int *  columns,
int *  rows 
)
virtual

Adjust columns and rows to the controller limits.

Parameters
columnsIf > 0 then it is set to 80.
rowsIf > 0 then it is limited to 1..34 range.

Implements fabgl::TextualDisplayController.

◆ begin() [1/3]

void fabgl::VGATextController::begin ( gpio_num_t  redGPIO,
gpio_num_t  greenGPIO,
gpio_num_t  blueGPIO,
gpio_num_t  HSyncGPIO,
gpio_num_t  VSyncGPIO 
)

This is the 8 colors (5 GPIOs) initializer.

One GPIO per channel, plus horizontal and vertical sync signals.

Parameters
redGPIOGPIO to use for red channel.
greenGPIOGPIO to use for green channel.
blueGPIOGPIO to use for blue channel.
HSyncGPIOGPIO to use for horizontal sync signal.
VSyncGPIOGPIO to use for vertical sync signal.

Example:

// Use GPIO 22 for red, GPIO 21 for green, GPIO 19 for blue, GPIO 18 for HSync and GPIO 5 for VSync
VGAController.begin(GPIO_NUM_22, GPIO_NUM_21, GPIO_NUM_19, GPIO_NUM_18, GPIO_NUM_5);
Examples:
VGA/LoopbackTerminal/LoopbackTerminal.ino, VGA/MultitaskingCPM/MultitaskingCPM.ino, and VGA/NetworkTerminal/NetworkTerminal.ino.

◆ begin() [2/3]

void fabgl::VGATextController::begin ( gpio_num_t  red1GPIO,
gpio_num_t  red0GPIO,
gpio_num_t  green1GPIO,
gpio_num_t  green0GPIO,
gpio_num_t  blue1GPIO,
gpio_num_t  blue0GPIO,
gpio_num_t  HSyncGPIO,
gpio_num_t  VSyncGPIO 
)

This is the 64 colors (8 GPIOs) initializer.

Two GPIOs per channel, plus horizontal and vertical sync signals.

Parameters
red1GPIOGPIO to use for red channel, MSB bit.
red0GPIOGPIO to use for red channel, LSB bit.
green1GPIOGPIO to use for green channel, MSB bit.
green0GPIOGPIO to use for green channel, LSB bit.
blue1GPIOGPIO to use for blue channel, MSB bit.
blue0GPIOGPIO to use for blue channel, LSB bit.
HSyncGPIOGPIO to use for horizontal sync signal.
VSyncGPIOGPIO to use for vertical sync signal.

Example:

// Use GPIO 22-21 for red, GPIO 19-18 for green, GPIO 5-4 for blue, GPIO 23 for HSync and GPIO 15 for VSync
VGAController.begin(GPIO_NUM_22, GPIO_NUM_21, GPIO_NUM_19, GPIO_NUM_18, GPIO_NUM_5, GPIO_NUM_4, GPIO_NUM_23, GPIO_NUM_15);

◆ begin() [3/3]

void fabgl::VGATextController::begin ( )

This is the 64 colors (8 GPIOs) initializer using default pinout.

Two GPIOs per channel, plus horizontal and vertical sync signals. Use GPIO 22-21 for red, GPIO 19-18 for green, GPIO 5-4 for blue, GPIO 23 for HSync and GPIO 15 for VSync

Example:

VGAController.begin();

◆ controllerType()

DisplayControllerType fabgl::TextualDisplayController::controllerType ( )
inlinevirtualinherited

Determines the display controller type.

Returns
Display controller type.

Implements fabgl::BaseDisplayController.

◆ getScreenHeight()

int fabgl::VGATextController::getScreenHeight ( )
inlinevirtual

Determines the screen height in pixels.

Returns
Screen height in pixels.

Implements fabgl::BaseDisplayController.

Examples:
VGA/LoopbackTerminal/LoopbackTerminal.ino, and VGA/NetworkTerminal/NetworkTerminal.ino.

◆ getScreenWidth()

int fabgl::VGATextController::getScreenWidth ( )
inlinevirtual

Determines the screen width in pixels.

Returns
Screen width in pixels.

Implements fabgl::BaseDisplayController.

Examples:
VGA/LoopbackTerminal/LoopbackTerminal.ino, and VGA/NetworkTerminal/NetworkTerminal.ino.

◆ setResolution()

void fabgl::VGATextController::setResolution ( char const *  modeline = nullptr)

Sets fixed resolution.

This call is required, even you cannot set or change resolution.

Examples:
VGA/LoopbackTerminal/LoopbackTerminal.ino, VGA/MultitaskingCPM/MultitaskingCPM.ino, and VGA/NetworkTerminal/NetworkTerminal.ino.

◆ setTextMap()

void fabgl::VGATextController::setTextMap ( uint32_t const *  map,
int  rows 
)
virtual

Sets text map to display.

This is set automatically by the terminal.

Implements fabgl::TextualDisplayController.


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