1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Add support for character attribute rich displayport

This commit is contained in:
jflyper 2019-11-21 10:26:37 +09:00
parent e1244af09a
commit 2e84b0c442
17 changed files with 123 additions and 70 deletions

View file

@ -29,6 +29,9 @@
#include "common/utils.h"
#include "pg/pg.h"
#include "pg/pg_ids.h"
#include "drivers/display.h"
#include "io/displayport_msp.h"
@ -37,7 +40,6 @@
#include "msp/msp_protocol.h"
#include "msp/msp_serial.h"
// no template required since defaults are zero
static displayPort_t mspDisplayPort;
#ifdef USE_CLI
@ -97,7 +99,7 @@ static int screenSize(const displayPort_t *displayPort)
return displayPort->rows * displayPort->cols;
}
static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, const char *string)
static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, uint8_t attr, const char *string)
{
#define MSP_OSD_MAX_STRING_LENGTH 30 // FIXME move this
uint8_t buf[MSP_OSD_MAX_STRING_LENGTH + 4];
@ -110,19 +112,19 @@ static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, con
buf[0] = 3;
buf[1] = row;
buf[2] = col;
buf[3] = 0;
buf[3] = displayPortProfileMsp()->attrValues[attr];
memcpy(&buf[4], string, len);
return output(displayPort, MSP_DISPLAYPORT, buf, len + 4);
}
static int writeChar(displayPort_t *displayPort, uint8_t col, uint8_t row, uint8_t c)
static int writeChar(displayPort_t *displayPort, uint8_t col, uint8_t row, uint8_t attr, uint8_t c)
{
char buf[2];
buf[0] = c;
buf[1] = 0;
return writeString(displayPort, col, row, buf); //!!TODO - check if there is a direct MSP command to do this
return writeString(displayPort, col, row, attr, buf); //!!TODO - check if there is a direct MSP command to do this
}
static bool isTransferInProgress(const displayPort_t *displayPort)