|
| 1 | +#include <ESP32Video.h> |
| 2 | +#include <Ressources/Font6x8.h> |
| 3 | +#include "VGA/VGA6MonochromeVGAMadnessMultimonitor.h" |
| 4 | + |
| 5 | +//pin configuration |
| 6 | +//red pins |
| 7 | +const int redPin0 = 17; |
| 8 | +const int redPin1 = 2; |
| 9 | +const int redPin2 = 19; |
| 10 | +const int redPin3 = 12; |
| 11 | +const int redPin4 = 23; |
| 12 | +const int redPin5 = 26; |
| 13 | +//green pins |
| 14 | +const int greenPin0 = 16; |
| 15 | +const int greenPin1 = 15; |
| 16 | +const int greenPin2 = 18; |
| 17 | +const int greenPin3 = 14; |
| 18 | +const int greenPin4 = 22; |
| 19 | +const int greenPin5 = 25; |
| 20 | +//blue pins |
| 21 | +const int bluePin0 = 4; |
| 22 | +const int bluePin1 = 13; |
| 23 | +const int bluePin2 = 5; |
| 24 | +const int bluePin3 = 27; |
| 25 | +const int bluePin4 = 21; |
| 26 | +const int bluePin5 = 0; |
| 27 | +const int hsyncPin = 32; |
| 28 | +const int vsyncPin = 33; |
| 29 | + |
| 30 | +//VGA Device |
| 31 | +VGA6MonochromeVGAMadnessMultimonitor videodisplay; |
| 32 | + |
| 33 | +void setup() |
| 34 | +{ |
| 35 | + Serial.begin(115200); |
| 36 | + //selecting the foreground or background color per monitor |
| 37 | + //IMPORTANT: for monochrome mode this MUST be done BEFORE init |
| 38 | + // and color can not be changed after init |
| 39 | + //videodisplay.setMonitor(); // selects all outputs simultaneously (default) |
| 40 | + |
| 41 | + videodisplay.setMonitor(0); |
| 42 | + videodisplay.setFrontGlobalColor(255,255,0); |
| 43 | + videodisplay.setBackGlobalColor(255,0,0); |
| 44 | + |
| 45 | + videodisplay.setMonitor(1); |
| 46 | + videodisplay.setFrontGlobalColor(255,255,255); |
| 47 | + videodisplay.setBackGlobalColor(0,0,0); |
| 48 | + |
| 49 | + videodisplay.setMonitor(2); |
| 50 | + videodisplay.setFrontGlobalColor(0,255,255); |
| 51 | + videodisplay.setBackGlobalColor(0,0,255); |
| 52 | + |
| 53 | + videodisplay.setMonitor(3); |
| 54 | + videodisplay.setFrontGlobalColor(255,0,0); |
| 55 | + videodisplay.setBackGlobalColor(0,0,0); |
| 56 | + |
| 57 | + videodisplay.setMonitor(4); |
| 58 | + videodisplay.setFrontGlobalColor(255,0,255); |
| 59 | + videodisplay.setBackGlobalColor(0,0,255); |
| 60 | + |
| 61 | + videodisplay.setMonitor(5); |
| 62 | + videodisplay.setFrontGlobalColor(0,255,0); |
| 63 | + videodisplay.setBackGlobalColor(0,0,0); |
| 64 | + |
| 65 | + //because of hardware limitations only BackGlobalColors compatible with FrontGlobalColor will set a non-black background: |
| 66 | + // FrontGlobalColor - cyan, BackGlobalColors - green or blue |
| 67 | + // FrontGlobalColor - magenta, BackGlobalColors - red or blue |
| 68 | + // FrontGlobalColor - yellow, BackGlobalColors - red or green |
| 69 | + // FrontGlobalColor - white, BackGlobalColors - any |
| 70 | + |
| 71 | + //initializing vga at the specified pins |
| 72 | + videodisplay.init(VGAMode::MODE320x240, |
| 73 | + redPin0,greenPin0,bluePin0, |
| 74 | + redPin1,greenPin1,bluePin1, |
| 75 | + redPin2,greenPin2,bluePin2, |
| 76 | + redPin3,greenPin3,bluePin3, |
| 77 | + redPin4,greenPin4,bluePin4, |
| 78 | + redPin5,greenPin5,bluePin5, |
| 79 | + hsyncPin, vsyncPin, -1,3,2); |
| 80 | + //selecting the font |
| 81 | + videodisplay.setFont(Font6x8); |
| 82 | + |
| 83 | + for(int xmon = 0; xmon < 3; xmon++) |
| 84 | + { |
| 85 | + for(int ymon = 0; ymon < 2; ymon++) |
| 86 | + { |
| 87 | + videodisplay.line(xmon*320 + 160-14,ymon*240+120+3,xmon*320 + 160+22,ymon*240+120+3,1); |
| 88 | + videodisplay.line(xmon*320 + 160-2,ymon*240+120-12,xmon*320 + 160-2,ymon*240+120+18,1); |
| 89 | + videodisplay.line(xmon*320 + 160+10,ymon*240+120-12,xmon*320 + 160+10,ymon*240+120+18,1); |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + videodisplay.setCursor(160-12,120-5); |
| 94 | + videodisplay.println("1!"); |
| 95 | + videodisplay.setCursor(160+320,120-5); |
| 96 | + videodisplay.println("2!"); |
| 97 | + videodisplay.setCursor(160+320+320+12,120-5); |
| 98 | + videodisplay.println("3!"); |
| 99 | + videodisplay.setCursor(160-12,120+240+5); |
| 100 | + videodisplay.println("4!"); |
| 101 | + videodisplay.setCursor(160+320,120+240+5); |
| 102 | + videodisplay.println("5!"); |
| 103 | + videodisplay.setCursor(160+320+320+12,120+240+5); |
| 104 | + videodisplay.println("6!"); |
| 105 | +} |
| 106 | + |
| 107 | + |
| 108 | +void loop() { |
| 109 | +} |
0 commit comments