-
Notifications
You must be signed in to change notification settings - Fork 13
Home
This Library is used to display regular (ASCII) and graphical characters to a VGA monitor, using the well known Bluepill board (STM32F103C8T6). A Timer is used to run the VGA driver routine by interrupting your Arduino Sketch execution, in a very similar way to how a preemptive system works. The VGA Timer execution has always execution precedence over your Arduino Sketch.
First of all, this library can be used with Arduino IDE or PlatformIO IDE. The code runs on a Bluepill STM32F103C8 or any other compatible STM32F103Cx board.
To install this library there are two ways:
- To install it by using the Library Manager Menu Option on the Arduino IDE, by searching for BlueVGA.
- To install it by downloading its code and copying it to your library directory for your Arduino environment.
The VGA driver is automatically activated by just creating an instance of BlueVGA
class, like the example bellow:
#include "bluevga.h" // include BleVGA library
#include "font.h" // the library includes a basic open source ASCII font of 8x8 pixels for simplicity
BlueVGA vga(ASCII_FONT); // starts VGA driver using bitmap array ASCII_FONT
Just by declaring the vga
variable above, the driver starts to work.
Notice that you can create or use any other font in your Sketch. Just replace "font.h"
by whatever you may need. There is code in the example folder that does that - snake_byte_game
eample code.
The font used in BlueVGA shall be in Flash and this is important because the code runs on a very specific timing that is calculated considering the wait cycles necessary to read Flash memory and use its font bitmap information to compose the VGA image.
Therefore in case you create your own font, make sure it's declares as const uint8_t *
in order to indicate to the compiler that you want this information to be placed in Flash memory.
The BlueVGA library deals with up to 256 different characters. Each one of the 256 characters may be mapped to the bitmap description on the font. If you try to display a not described character on the screen, you may see some random pixels in the monitor. This happens because the VGA driver will look for a flash memory address based on the character code (0..255) multiplied by 8 (number of bytes to describe a 8x8 bitmap). If your fint doesn't have the bytes to describe that character, it will use whatever is stored at the flash in that address...