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

@ -8,6 +8,10 @@ steps:
- pip install platformio
- pio run
- pio check --skip-packages
- name: build
image: corentinaltepe/doxygen
commands:
- doxygen
- name: release
image: plugins/gitea-release
settings:

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.pio
.pioenvs
.piolibdeps
docs/
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json

6
Doxyfile Normal file
View File

@ -0,0 +1,6 @@
PROJECT_NAME = "MinimOSD-JSON"
OUTPUT_DIRECTORY = "docs/"
INPUT = "src" "lib"
RECURSIVE = YES
WARNINGS = YES
GENERATE_LATEX = NO

View File

@ -44,7 +44,7 @@ bool CommandHandler::parse(const char *cmd)
{
int x = doc["x"];
int y = doc["y"];
this->display->setOffset(x, y);
//this->display->setOffset(x, y);
}
return true;

View File

@ -2,6 +2,9 @@
#define COMMANDHANDLER_H
#include "DisplayProxy.h"
/**
* Parse a JSON command and convert it into a display command
*/
class CommandHandler
{
public:

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);

View File

@ -10,6 +10,11 @@ Max7456 osd;
DisplayProxyMAX7456 display(&osd);
CommandHandler cmd_handler(&display);
/**
* Setup handler (Arduino Style)
*
* Write some debug information to the serial port and initialize the display.
*/
void setup()
{
Serial.begin(BAUDRATE);
@ -34,6 +39,11 @@ void setup()
Serial.println("Ready!");
}
/**
* Loop handler (Arduino Style)
*
* Continously read the serial port if input is available. On line change send to the command handler.
*/
void loop()
{
while (Serial.available() > 0)