40 #include "driver/gpio.h" 46 #include "fonts/font_8x14.h" 52 #define VGATextController_CHARWIDTH 8 // max 8 53 #define VGATextController_CHARWIDTHBYTES ((VGATextController_CHARWIDTH + 7) / 8) 54 #define VGATextController_CHARHEIGHT 14 55 #define VGATextController_COLUMNS 80 56 #define VGATextController_ROWS 34 57 #define VGATextController_WIDTH 640 58 #define VGATextController_HEIGHT 480 60 #define VGATextController_MODELINE VGA_640x480_60Hz 109 void begin(gpio_num_t redGPIO, gpio_num_t greenGPIO, gpio_num_t blueGPIO, gpio_num_t HSyncGPIO, gpio_num_t VSyncGPIO);
130 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);
149 void setResolution(
char const * modeline =
nullptr,
int viewPortWidth = -1,
int viewPortHeight = -1,
bool doubleBuffered =
false);
156 void setTextMap(uint32_t
const * map,
int rows);
166 int getColumns() {
return VGATextController_COLUMNS; }
167 int getRows() {
return VGATextController_ROWS; }
169 void enableCursor(
bool value) { m_cursorEnabled = value; }
170 void setCursorPos(
int row,
int col) { m_cursorRow = row; m_cursorCol = col; m_cursorCounter = 0; }
171 void setCursorSpeed(
int value) { m_cursorSpeed = value; }
172 void setCursorForeground(
Color value);
173 void setCursorBackground(
Color value);
175 FontInfo
const * getFont() {
return &FONT_8x14; }
180 void init(gpio_num_t VSyncGPIO);
181 void setupGPIO(gpio_num_t gpio,
int bit, gpio_mode_t mode);
184 void fillDMABuffers();
185 uint8_t packHVSync(
bool HSync,
bool VSync);
186 uint8_t preparePixelWithSync(
RGB222 rgb,
bool HSync,
bool VSync);
188 uint8_t IRAM_ATTR preparePixel(
RGB222 rgb) {
return m_HVSync | (rgb.
B << VGA_BLUE_BIT) | (rgb.
G << VGA_GREEN_BIT) | (rgb.
R << VGA_RED_BIT); }
190 static void ISRHandler(
void * arg);
193 static volatile int s_scanLine;
194 static uint32_t s_blankPatternDWord;
195 static uint32_t * s_fgbgPattern;
196 static int s_textRow;
197 static bool s_upperRow;
198 static lldesc_t
volatile * s_frameResetDesc;
202 GPIOStream m_GPIOStream;
203 int m_bitsPerChannel;
204 lldesc_t
volatile * m_DMABuffers;
205 int m_DMABuffersCount;
211 volatile uint8_t * m_blankLine;
212 volatile uint8_t * m_syncLine;
214 intr_handle_t m_isr_handle;
217 volatile uint8_t m_HVSync;
219 uint8_t * m_charData;
220 uint32_t
const * m_map;
223 bool m_cursorEnabled;
228 uint8_t m_cursorForeground;
229 uint8_t m_cursorBackground;
Represents the VGA text-only controller.
void begin()
This is the 64 colors (8 GPIOs) initializer using default pinout.
This file contains fabgl::GPIOStream definition.
Color
This enum defines named colors.
void adjustMapSize(int *columns, int *rows)
Adjust columns and rows to the controller limits.
This file contains fabgl::VGAController definition.
void setResolution(char const *modeline=nullptr, int viewPortWidth=-1, int viewPortHeight=-1, bool doubleBuffered=false)
Sets fixed resolution.
Specifies the VGA timings. This is a modeline decoded.
This file contains some utility classes and functions.
This file contains FabGL library configuration settings, like number of supported colors...
Represents a 6 bit RGB color.
Represents the base abstract class for textual display controllers.
void setTextMap(uint32_t const *map, int rows)
Sets text map to display.