2021-03-13 17:25:12 +00:00
|
|
|
|
/*
|
|
|
|
|
CONNECTION from ESP32 to a composite video TV
|
|
|
|
|
|
|
|
|
|
A) voltageDivider = false; B) voltageDivider = true
|
|
|
|
|
|
|
|
|
|
55 shades 179 shades
|
|
|
|
|
|
|
|
|
|
ESP32 TV ESP32 TV
|
|
|
|
|
-----+ -----+ ____ 100 ohm
|
|
|
|
|
G|- G|---|____|+
|
|
|
|
|
pin25|--------- Comp pin25|---|____|+--------- Comp
|
|
|
|
|
pin26|- pin26|- 220 ohm
|
|
|
|
|
| |
|
|
|
|
|
| |
|
|
|
|
|
-----+ -----+
|
|
|
|
|
|
|
|
|
|
Connect pin 25 or 26
|
|
|
|
|
|
|
|
|
|
C) R–2R resistor ladder; D) unequal rungs ladder
|
|
|
|
|
|
|
|
|
|
55 shades up to 254 shades?
|
|
|
|
|
|
|
|
|
|
ESP32 TV ESP32 TV
|
|
|
|
|
-----+ -----+ ____
|
|
|
|
|
G|-+_____ G|---|____|
|
|
|
|
|
pinA0|-| R2R |- Comp pinA0|---|____|+--------- Comp
|
|
|
|
|
pinA1|-| | pinA1|---|____|
|
|
|
|
|
pinA2|-| | ...|
|
|
|
|
|
...|-|_____| |
|
|
|
|
|
-----+ -----+
|
|
|
|
|
|
|
|
|
|
Connect pins of your choice (A0...A8=any pins).
|
|
|
|
|
Custom ladders can be used by tweaking colorMinValue and colorMaxValue
|
|
|
|
|
*/
|
2021-03-13 23:08:55 +00:00
|
|
|
|
|
2021-03-13 17:25:12 +00:00
|
|
|
|
#include <ESP32Lib.h>
|
|
|
|
|
#include <Ressources/Font6x8.h>
|
2021-03-13 23:08:55 +00:00
|
|
|
|
#include <Ressources/CodePage437_8x8.h>
|
2021-03-13 17:25:12 +00:00
|
|
|
|
//#include <Ressources/CodePage437_8x14.h>
|
|
|
|
|
//#include <Ressources/CodePage437_8x16.h>
|
|
|
|
|
//#include <Ressources/CodePage437_8x19.h>
|
2021-03-13 23:08:55 +00:00
|
|
|
|
//#include <Ressources/CodePage437_9x16.h>
|
|
|
|
|
#define FONT CodePage437_8x8
|
2021-03-13 17:25:12 +00:00
|
|
|
|
|
|
|
|
|
//pin configuration for DAC
|
|
|
|
|
const int outputPin = 25;
|
|
|
|
|
// A) B)
|
|
|
|
|
CompositeGrayDAC videodisplay;
|
|
|
|
|
// C) D)
|
|
|
|
|
//CompositeGrayLadder videodisplay;
|
|
|
|
|
|
|
|
|
|
class Display {
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// view(able) size
|
|
|
|
|
int vw = 350;
|
|
|
|
|
int vh = 235;
|
|
|
|
|
|
|
|
|
|
// offsets (to fix overscan, depends on your display)
|
|
|
|
|
int ow = 10;
|
|
|
|
|
int oh = 26;
|
|
|
|
|
|
|
|
|
|
// display size
|
|
|
|
|
int w = 365; // vw + 2*ow
|
|
|
|
|
int h = 275; // vh + 2*oh
|
|
|
|
|
|
2021-03-13 23:08:55 +00:00
|
|
|
|
int font_w = FONT.charWidth;
|
|
|
|
|
int font_h = FONT.charHeight + 1;
|
2021-03-13 17:25:12 +00:00
|
|
|
|
|
|
|
|
|
int cols = vw / font_w;
|
|
|
|
|
int rows = vh / font_h;
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
|
{
|
|
|
|
|
// Composite video init, see options in the header ^^^
|
|
|
|
|
// A)
|
|
|
|
|
//videodisplay.init(CompMode::MODEPAL288P, 25, false);
|
|
|
|
|
// B)
|
|
|
|
|
videodisplay.init(CompMode::MODEPAL288P, 25, true);
|
|
|
|
|
videodisplay.clear();
|
|
|
|
|
|
|
|
|
|
videodisplay.xres = w;
|
|
|
|
|
videodisplay.yres = h;
|
|
|
|
|
|
|
|
|
|
videodisplay.setFont(FONT);
|
|
|
|
|
|
|
|
|
|
/*/ view area test
|
|
|
|
|
videodisplay.rect(ow, oh, vw, vh, 50);
|
|
|
|
|
/**/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void scroll(int d) {
|
|
|
|
|
videodisplay.scroll(d, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void fill_rect(int x, int y, int w, int h, int color) {
|
|
|
|
|
videodisplay.fillRect(x, y, w, h, color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void pixel(int x, int y, int color) {
|
|
|
|
|
videodisplay.dotFast(x, y, color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void print_character(int col, int row, int fg_color, int bg_color, char character) {
|
|
|
|
|
int x = ow + col*font_w;
|
|
|
|
|
int y = oh + row*font_h;
|
|
|
|
|
videodisplay.setCursor(x, y);
|
2021-03-13 23:08:55 +00:00
|
|
|
|
videodisplay.setTextColor(fg_color, bg_color);
|
2021-03-13 17:25:12 +00:00
|
|
|
|
videodisplay.print(character);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int get_display_width() { return w; }
|
|
|
|
|
int get_display_height() { return h; }
|
|
|
|
|
int get_view_width() { return vw; }
|
|
|
|
|
int get_view_height() { return vh; }
|
|
|
|
|
int get_view_width_offset() { return ow; }
|
|
|
|
|
int get_view_height_offset() { return oh; }
|
|
|
|
|
|
|
|
|
|
};
|