1
0

Doxygen code comments included
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2021-10-28 14:44:20 +00:00
parent 2b8b4a048a
commit 3b09803b3a
9 changed files with 103 additions and 17 deletions

View File

@ -1,10 +1,36 @@
#ifndef DISPLAYPROXY_H
#define DISPLAYPROXY_H
/**
* Generic interface for a graphical display allowing for placement of text.
*/
class DisplayProxy
{
public:
/**
* Turn on the display.
* @return True if successful.
*/
virtual bool on() = 0;
/**
* Turn off the display.
* @return True if successful.
*/
virtual bool off() = 0;
/**
* Write a string to the display.
*
* @param x Horizontal starting position. From left to right. (0 indexed)
* @param y Vertical starting position. From top to bottom. (0 indexed)
* @param text String to write
* @return True if successful.
*/
virtual bool write(int x, int y, const char *text) = 0;
/**
* Clear the entire screen.
* @return True if successful.
*/
virtual bool clear() = 0;
virtual bool setOffset(int x, int y) = 0;
};
#endif

View File

@ -11,32 +11,35 @@ DisplayProxyMAX7456::DisplayProxyMAX7456(Max7456 *osd)
onScreenDisplay(true);
}
/**
* Write a text string to the display at the given position
* @param x Position along the X axis
* @param y Position along the Y axis
* @param text The string to print
* @return Success or false
*/
bool DisplayProxyMAX7456::on()
{
onScreenDisplay(true);
return true;
}
bool DisplayProxyMAX7456::off()
{
externalVideo(false);
onScreenDisplay(false);
return true;
}
bool DisplayProxyMAX7456::write(int x, int y, const char *text)
{
this->osd->print(text, x, y);
return true;
}
/**
* Clear the entire screen
*/
bool DisplayProxyMAX7456::clear()
{
this->osd->clearScreen();
return true;
}
/**
* Adjust the display offset.
* Since the signal is analog the characters might be rendered outside the display area
*/
bool DisplayProxyMAX7456::setOffset(int x, int y)
{
this->osd->setDisplayOffsets(x, y);

View File

@ -4,14 +4,47 @@
#include "DisplayProxy.h"
#include "max7456.h"
/**
* Text-User-Interface on a Max7456
*
* The Max7456 provides On-Screen-Display rendering for composite video.
* (Think old school VCR menu overlay)
*
* @link https://www.maximintegrated.com/en/products/analog/video-products/MAX7456.html
*/
class DisplayProxyMAX7456 : public DisplayProxy
{
public:
/**
* Initalize a Max7456 Style display
* - Initialize with CS on Pin 6.
* - Clear the display
* - Initialize blinking frequency.
* - Disable external video
* - Enable OSD.
*/
explicit DisplayProxyMAX7456(Max7456 *osd);
/**
* OSD on, external video left untouched.
*/
bool on();
/**
* OSD off, external video off.
*/
bool off();
/**
* Depending on the font loaded into the Max7456 the output might not be ASCII compatible.
*/
bool write(int x, int y, const char *text) override;
bool clear() override;
bool setOffset(int x, int y) override;
/**
* Adjust the display offset.
* Since the signal is analog the characters might be rendered outside the display area
*/
bool setOffset(int x, int y);
bool externalVideo(bool enabled);
bool onScreenDisplay(bool enabled);