36 #include "rom/lldesc.h" 37 #include "driver/gpio.h" 43 #include "fonts/font_8x14.h" 49 #define VGATextController_CHARWIDTH 8 // max 8 50 #define VGATextController_CHARWIDTHBYTES ((VGATextController_CHARWIDTH + 7) / 8) 51 #define VGATextController_CHARHEIGHT 14 52 #define VGATextController_COLUMNS 80 53 #define VGATextController_ROWS 34 54 #define VGATextController_WIDTH 640 55 #define VGATextController_HEIGHT 480 57 #define VGATextController_MODELINE VGA_640x480_60Hz 106 void begin(gpio_num_t redGPIO, gpio_num_t greenGPIO, gpio_num_t blueGPIO, gpio_num_t HSyncGPIO, gpio_num_t VSyncGPIO);
127 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);
146 void setResolution(
char const * modeline =
nullptr,
int viewPortWidth = -1,
int viewPortHeight = -1,
bool doubleBuffered =
false);
153 void setTextMap(uint32_t
const * map,
int rows);
163 int getColumns() {
return VGATextController_COLUMNS; }
164 int getRows() {
return VGATextController_ROWS; }
166 void enableCursor(
bool value) { m_cursorEnabled = value; }
167 void setCursorPos(
int row,
int col) { m_cursorRow = row; m_cursorCol = col; m_cursorCounter = 0; }
168 void setCursorSpeed(
int value) { m_cursorSpeed = value; }
169 void setCursorForeground(
Color value);
170 void setCursorBackground(
Color value);
176 void init(gpio_num_t VSyncGPIO);
177 void setupGPIO(gpio_num_t gpio,
int bit, gpio_mode_t mode);
180 void fillDMABuffers();
181 uint8_t packHVSync(
bool HSync,
bool VSync);
182 uint8_t preparePixelWithSync(
RGB222 rgb,
bool HSync,
bool VSync);
184 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); }
186 static void ISRHandler(
void * arg);
189 static volatile int s_scanLine;
190 static uint32_t s_blankPatternDWord;
191 static uint32_t * s_fgbgPattern;
192 static int s_textRow;
193 static bool s_upperRow;
194 static lldesc_t
volatile * s_frameResetDesc;
198 GPIOStream m_GPIOStream;
199 int m_bitsPerChannel;
200 lldesc_t
volatile * m_DMABuffers;
201 int m_DMABuffersCount;
207 volatile uint8_t * m_blankLine;
208 volatile uint8_t * m_syncLine;
210 intr_handle_t m_isr_handle;
213 volatile uint8_t m_HVSync;
215 uint8_t * m_charData;
216 uint32_t
const * m_map;
219 bool m_cursorEnabled;
224 uint8_t m_cursorForeground;
225 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.