Doxygen code comments included
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
@ -8,6 +8,10 @@ steps:
|
|||||||
- pip install platformio
|
- pip install platformio
|
||||||
- pio run
|
- pio run
|
||||||
- pio check --skip-packages
|
- pio check --skip-packages
|
||||||
|
- name: build
|
||||||
|
image: corentinaltepe/doxygen
|
||||||
|
commands:
|
||||||
|
- doxygen
|
||||||
- name: release
|
- name: release
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
settings:
|
settings:
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
.pio
|
.pio
|
||||||
.pioenvs
|
.pioenvs
|
||||||
.piolibdeps
|
.piolibdeps
|
||||||
|
docs/
|
||||||
.vscode/.browse.c_cpp.db*
|
.vscode/.browse.c_cpp.db*
|
||||||
.vscode/c_cpp_properties.json
|
.vscode/c_cpp_properties.json
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
|
6
Doxyfile
Normal file
6
Doxyfile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
PROJECT_NAME = "MinimOSD-JSON"
|
||||||
|
OUTPUT_DIRECTORY = "docs/"
|
||||||
|
INPUT = "src" "lib"
|
||||||
|
RECURSIVE = YES
|
||||||
|
WARNINGS = YES
|
||||||
|
GENERATE_LATEX = NO
|
@ -44,7 +44,7 @@ bool CommandHandler::parse(const char *cmd)
|
|||||||
{
|
{
|
||||||
int x = doc["x"];
|
int x = doc["x"];
|
||||||
int y = doc["y"];
|
int y = doc["y"];
|
||||||
this->display->setOffset(x, y);
|
//this->display->setOffset(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
#define COMMANDHANDLER_H
|
#define COMMANDHANDLER_H
|
||||||
#include "DisplayProxy.h"
|
#include "DisplayProxy.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse a JSON command and convert it into a display command
|
||||||
|
*/
|
||||||
class CommandHandler
|
class CommandHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,10 +1,36 @@
|
|||||||
#ifndef DISPLAYPROXY_H
|
#ifndef DISPLAYPROXY_H
|
||||||
#define DISPLAYPROXY_H
|
#define DISPLAYPROXY_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic interface for a graphical display allowing for placement of text.
|
||||||
|
*/
|
||||||
class DisplayProxy
|
class DisplayProxy
|
||||||
{
|
{
|
||||||
public:
|
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;
|
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 clear() = 0;
|
||||||
virtual bool setOffset(int x, int y) = 0;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
@ -11,32 +11,35 @@ DisplayProxyMAX7456::DisplayProxyMAX7456(Max7456 *osd)
|
|||||||
onScreenDisplay(true);
|
onScreenDisplay(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Write a text string to the display at the given position
|
bool DisplayProxyMAX7456::on()
|
||||||
* @param x Position along the X axis
|
{
|
||||||
* @param y Position along the Y axis
|
onScreenDisplay(true);
|
||||||
* @param text The string to print
|
return true;
|
||||||
* @return Success or false
|
}
|
||||||
*/
|
|
||||||
|
bool DisplayProxyMAX7456::off()
|
||||||
|
{
|
||||||
|
externalVideo(false);
|
||||||
|
onScreenDisplay(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool DisplayProxyMAX7456::write(int x, int y, const char *text)
|
bool DisplayProxyMAX7456::write(int x, int y, const char *text)
|
||||||
{
|
{
|
||||||
this->osd->print(text, x, y);
|
this->osd->print(text, x, y);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the entire screen
|
|
||||||
*/
|
|
||||||
bool DisplayProxyMAX7456::clear()
|
bool DisplayProxyMAX7456::clear()
|
||||||
{
|
{
|
||||||
this->osd->clearScreen();
|
this->osd->clearScreen();
|
||||||
return true;
|
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)
|
bool DisplayProxyMAX7456::setOffset(int x, int y)
|
||||||
{
|
{
|
||||||
this->osd->setDisplayOffsets(x, y);
|
this->osd->setDisplayOffsets(x, y);
|
||||||
|
@ -4,14 +4,47 @@
|
|||||||
#include "DisplayProxy.h"
|
#include "DisplayProxy.h"
|
||||||
#include "max7456.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
|
class DisplayProxyMAX7456 : public DisplayProxy
|
||||||
{
|
{
|
||||||
public:
|
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);
|
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 write(int x, int y, const char *text) override;
|
||||||
bool clear() 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 externalVideo(bool enabled);
|
||||||
bool onScreenDisplay(bool enabled);
|
bool onScreenDisplay(bool enabled);
|
||||||
|
|
||||||
|
10
src/main.cpp
10
src/main.cpp
@ -10,6 +10,11 @@ Max7456 osd;
|
|||||||
DisplayProxyMAX7456 display(&osd);
|
DisplayProxyMAX7456 display(&osd);
|
||||||
CommandHandler cmd_handler(&display);
|
CommandHandler cmd_handler(&display);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup handler (Arduino Style)
|
||||||
|
*
|
||||||
|
* Write some debug information to the serial port and initialize the display.
|
||||||
|
*/
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(BAUDRATE);
|
Serial.begin(BAUDRATE);
|
||||||
@ -34,6 +39,11 @@ void setup()
|
|||||||
Serial.println("Ready!");
|
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()
|
void loop()
|
||||||
{
|
{
|
||||||
while (Serial.available() > 0)
|
while (Serial.available() > 0)
|
||||||
|
Reference in New Issue
Block a user