mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Made OSD device independent, now uses displayPort
This commit is contained in:
parent
25bcaa3a05
commit
c97e71e995
10 changed files with 205 additions and 81 deletions
|
@ -61,13 +61,24 @@ static int release(displayPort_t *displayPort)
|
|||
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
|
||||
}
|
||||
|
||||
static int clear(displayPort_t *displayPort)
|
||||
static int clearScreen(displayPort_t *displayPort)
|
||||
{
|
||||
const uint8_t subcmd[] = { 2 };
|
||||
|
||||
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
|
||||
}
|
||||
|
||||
static int drawScreen(displayPort_t *displayPort)
|
||||
{
|
||||
UNUSED(displayPort);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int screenSize(const displayPort_t *displayPort)
|
||||
{
|
||||
return displayPort->rows * displayPort->cols;
|
||||
}
|
||||
|
||||
static int write(displayPort_t *displayPort, uint8_t col, uint8_t row, const char *string)
|
||||
{
|
||||
#define MSP_OSD_MAX_STRING_LENGTH 30
|
||||
|
@ -87,6 +98,21 @@ static int write(displayPort_t *displayPort, uint8_t col, uint8_t row, const cha
|
|||
return output(displayPort, MSP_DISPLAYPORT, buf, len + 4);
|
||||
}
|
||||
|
||||
static int writeChar(displayPort_t *displayPort, uint8_t col, uint8_t row, uint8_t c)
|
||||
{
|
||||
char buf[2];
|
||||
|
||||
buf[0] = c;
|
||||
buf[1] = 0;
|
||||
return write(displayPort, col, row, buf); //!!TODO - check if there is a direct MSP command to do this
|
||||
}
|
||||
|
||||
static bool isTransferInProgress(const displayPort_t *displayPort)
|
||||
{
|
||||
UNUSED(displayPort);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void resync(displayPort_t *displayPort)
|
||||
{
|
||||
displayPort->rows = 13; // XXX Will reflect NTSC/PAL in the future
|
||||
|
@ -102,8 +128,12 @@ static uint32_t txBytesFree(const displayPort_t *displayPort)
|
|||
static const displayPortVTable_t mspDisplayPortVTable = {
|
||||
.grab = grab,
|
||||
.release = release,
|
||||
.clear = clear,
|
||||
.clearScreen = clearScreen,
|
||||
.drawScreen = drawScreen,
|
||||
.screenSize = screenSize,
|
||||
.write = write,
|
||||
.writeChar = writeChar,
|
||||
.isTransferInProgress = isTransferInProgress,
|
||||
.heartbeat = heartbeat,
|
||||
.resync = resync,
|
||||
.txBytesFree = txBytesFree
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue