1
0

Documentation cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jens True 2021-11-03 10:13:25 +00:00
parent d4df2225b5
commit b8eccbe162
6 changed files with 44 additions and 9 deletions

@ -1,6 +1,7 @@
PROJECT_NAME = "MinimOSD-JSON"
OUTPUT_DIRECTORY = "docs/"
INPUT = "src" "lib"
INPUT = "README.md" "src" "lib"
RECURSIVE = YES
WARNINGS = YES
GENERATE_LATEX = NO
USE_MDFILE_AS_MAINPAGE = README.md

@ -8,7 +8,7 @@ CommandHandler::CommandHandler(DisplayProxy *display)
this->display = display;
}
bool CommandHandler::parse(const char *cmd)
bool CommandHandler::parseJSON(const char *cmd)
{
Serial.print("Handling: ");
Serial.println(cmd);
@ -23,7 +23,7 @@ bool CommandHandler::parse(const char *cmd)
return false;
}
const char *command = doc["command"];
const char *command = doc["cmd"];
if (strcmp("write", command) == 0 && doc["text"].is<const char*>() && doc["x"].is<int>() && doc["y"].is<int>())
{
const char *text = doc["text"];

@ -3,14 +3,31 @@
#include "DisplayProxy.h"
/**
* Parse a JSON command and convert it into a display command
* Parse a JSON command and convert it into display command(s)
*/
class CommandHandler
{
public:
/**
* Constructor.
*
* @param display Takes an implementation of DisplayProxy through polymorphism.
*/
explicit CommandHandler(DisplayProxy *display);
bool parse(const char *cmd);
/**
* Parse a command in JSON format
* @code{.json}
* {"cmd":"write","x": 2, "y": 10, "text":"Hello World"}
* @endcode
*
* @param cmd String to parse
* @return True if the input was parsed correctly.
*/
bool parseJSON(const char *cmd);
private:
/**
* Internal helper for printing debug strings
*/
void debugWrite(int x, int y, const char *text);
DisplayProxy *display;

@ -3,6 +3,7 @@
/**
* Generic interface for a graphical display allowing for placement of text.
* Focused on TUI.
*/
class DisplayProxy
{
@ -12,6 +13,7 @@ public:
* @return True if successful.
*/
virtual bool on() = 0;
/**
* Turn off the display.
* @return True if successful.
@ -27,6 +29,7 @@ public:
* @return True if successful.
*/
virtual bool write(int x, int y, const char *text) = 0;
/**
* Clear the entire screen.
* @return True if successful.

@ -6,12 +6,14 @@
/**
* Text-User-Interface on a Max7456
* Text-User-Interface on a MAX7456
*
* The Max7456 provides On-Screen-Display rendering for composite video.
* 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
* To find the offical documentation for the part please refer to the Maxim page for the MAX7456.
* [Maxim Page](https://www.maximintegrated.com/en/products/analog/video-products/MAX7456.html)
*
*/
class DisplayProxyMAX7456 : public DisplayProxy
{
@ -45,7 +47,19 @@ public:
* Since the signal is analog the characters might be rendered outside the display area
*/
bool setOffset(int x, int y);
/**
* Turn off the external video feed
* If the external feed is disabled the background will be grey
* @param enabled True to turn on the external video input
*/
bool externalVideo(bool enabled);
/**
* Turn on the overlay
*
* @param enabled True to turn on the overlay
*/
bool onScreenDisplay(bool enabled);
private:

@ -49,6 +49,6 @@ void loop()
while (Serial.available() > 0)
{
String input = Serial.readStringUntil('\n');
cmd_handler.parse(input.c_str());
cmd_handler.parseJSON(input.c_str());
}
}