FabGL
ESP32 Display Controller and Graphics Library
VGAController Class Reference

Represents the VGA bitmapped controller. More...

#include <vgacontroller.h>

Inherits VGABaseController.

Public Member Functions

void begin ()
 This is the 64 colors (8 GPIOs) initializer using default pinout. 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 (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...
 
DisplayControllerType controllerType ()
 Determines the display controller type. More...
 
uint8_t createRawPixel (RGB222 rgb)
 Creates a raw pixel to use with VGAController.setRawPixel. More...
 
void enableBackgroundPrimitiveExecution (bool value)
 Enables or disables drawings inside vertical retracing time. More...
 
void enableBackgroundPrimitiveTimeout (bool value)
 Enables or disables execution time limitation inside vertical retracing interrupt. More...
 
uint8_t getBitsPerChannel ()
 Gets number of bits allocated for each channel. More...
 
uint8_t * getScanline (int y)
 Gets a raw scanline pointer. More...
 
int getScreenHeight ()
 Determines the screen height in pixels. More...
 
int getScreenWidth ()
 Determines the screen width in pixels. More...
 
int getViewPortCol ()
 Determines horizontal position of the viewport. More...
 
int getViewPortHeight ()
 Determines vertical size of the viewport. More...
 
int getViewPortRow ()
 Determines vertical position of the viewport. More...
 
int getViewPortWidth ()
 Determines horizontal size of the viewport. More...
 
bool isDoubleBuffered ()
 Determines whether BitmappedDisplayController is on double buffered mode. More...
 
void moveScreen (int offsetX, int offsetY)
 Moves screen by specified horizontal and vertical offset. More...
 
NativePixelFormat nativePixelFormat ()
 Represents the native pixel format used by this display. More...
 
void processPrimitives ()
 Draws immediately all primitives in the queue. More...
 
void readScreen (Rect const &rect, RGB222 *destBuf)
 Reads pixels inside the specified rectangle. More...
 
void refreshSprites ()
 Forces the sprites to be updated. More...
 
void removeSprites ()
 Empties the list of active sprites. More...
 
void resumeBackgroundPrimitiveExecution ()
 Resumes drawings after suspendBackgroundPrimitiveExecution(). More...
 
void setMouseCursor (Cursor *cursor)
 Sets mouse cursor and make it visible. More...
 
void setMouseCursor (CursorName cursorName)
 Sets mouse cursor from a set of predefined cursors. More...
 
void setMouseCursorPos (int X, int Y)
 Sets mouse cursor position. More...
 
void setRawPixel (int x, int y, uint8_t rgb)
 Sets a raw pixel prepared using VGAController.createRawPixel. More...
 
void setResolution (char const *modeline, int viewPortWidth=-1, int viewPortHeight=-1, bool doubleBuffered=false)
 Sets current resolution using linux-like modeline. More...
 
template<typename T >
void setSprites (T *sprites, int count)
 Sets the list of active sprites. More...
 
void shrinkScreen (int shrinkX, int shrinkY)
 Reduces or expands screen size by the specified horizontal and vertical offset. More...
 
void suspendBackgroundPrimitiveExecution ()
 Suspends drawings. More...
 
void writeScreen (Rect const &rect, RGB222 *srcBuf)
 Writes pixels inside the specified rectangle. More...
 

Static Public Member Functions

static VGAControllerinstance ()
 Returns the singleton instance of VGAController class. More...
 

Static Public Attributes

static int queueSize = 1024
 Size of display controller primitives queue. More...
 

Detailed Description

Represents the VGA bitmapped controller.

Use this class to set screen resolution and to associate VGA signals to ESP32 GPIO outputs.

This example initializes VGA Controller with 64 colors at 640x350:

fabgl::VGAController 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(VGA_640x350_70Hz);

This example initializes VGA Controller with 8 colors (5 GPIOs used) and 640x350 resolution:

// Assign GPIO22 to Red, GPIO21 to Green, GPIO19 to Blue, GPIO18 to HSync and GPIO5 to VSync
VGAController.begin(GPIO_NUM_22, GPIO_NUM_21, GPIO_NUM_19, GPIO_NUM_18, GPIO_NUM_5);

// Set 640x350@70Hz resolution
VGAController.setResolution(VGA_640x350_70Hz);

This example initializes VGA Controller with 64 colors (8 GPIOs used) and 640x350 resolution:

// Assign GPIO22 and GPIO21 to Red, GPIO19 and GPIO18 to Green, GPIO5 and GPIO4 to Blue, GPIO23 to HSync and GPIO15 to 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);

// Set 640x350@70Hz resolution
VGAController.setResolution(VGA_640x350_70Hz);
Examples
VGA/Altair8800/Altair8800.ino, VGA/ClassicRacer/ClassicRacer.ino, VGA/CollisionDetection/CollisionDetection.ino, VGA/DoubleBuffer/DoubleBuffer.ino, VGA/FileBrowser/FileBrowser.ino, VGA/MouseOnScreen/MouseOnScreen.ino, VGA/SpaceInvaders/SpaceInvaders.ino, VGA/Sprites/Sprites.ino, and VGA/VIC20/VIC20.ino.

Definition at line 89 of file vgacontroller.h.


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