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

Add display port sub-command definitions

This commit is contained in:
Steve Evans 2022-10-02 13:55:57 +01:00
parent 8d909fbe99
commit c2b105486e
2 changed files with 10 additions and 4 deletions

View file

@ -76,7 +76,7 @@ static int grab(displayPort_t *displayPort)
static int release(displayPort_t *displayPort) static int release(displayPort_t *displayPort)
{ {
uint8_t subcmd[] = { 1 }; uint8_t subcmd[] = { MSP_DP_RELEASE };
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd)); return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
} }
@ -85,14 +85,14 @@ static int clearScreen(displayPort_t *displayPort, displayClearOption_e options)
{ {
UNUSED(options); UNUSED(options);
uint8_t subcmd[] = { 2 }; uint8_t subcmd[] = { MSP_DP_CLEAR_SCREEN };
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd)); return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
} }
static bool drawScreen(displayPort_t *displayPort) static bool drawScreen(displayPort_t *displayPort)
{ {
uint8_t subcmd[] = { 4 }; uint8_t subcmd[] = { MSP_DP_DRAW_SCREEN };
output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd)); output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
return 0; return 0;
@ -113,7 +113,7 @@ static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, uin
len = MSP_OSD_MAX_STRING_LENGTH; len = MSP_OSD_MAX_STRING_LENGTH;
} }
buf[0] = 3; buf[0] = MSP_DP_WRITE_STRING;
buf[1] = row; buf[1] = row;
buf[2] = col; buf[2] = col;
buf[3] = displayPortProfileMsp()->attrValues[attr] & ~DISPLAYPORT_MSP_ATTR_BLINK & DISPLAYPORT_MSP_ATTR_MASK; buf[3] = displayPortProfileMsp()->attrValues[attr] & ~DISPLAYPORT_MSP_ATTR_BLINK & DISPLAYPORT_MSP_ATTR_MASK;

View file

@ -24,6 +24,12 @@
#include "pg/displayport_profiles.h" #include "pg/displayport_profiles.h"
// MSP Display Port commands
#define MSP_DP_RELEASE 1
#define MSP_DP_CLEAR_SCREEN 2
#define MSP_DP_WRITE_STRING 3
#define MSP_DP_DRAW_SCREEN 4
// MSP displayport V2 attribute byte bit functions // MSP displayport V2 attribute byte bit functions
#define DISPLAYPORT_MSP_ATTR_VERSION BIT(7) // Format indicator; must be zero for V2 (and V1) #define DISPLAYPORT_MSP_ATTR_VERSION BIT(7) // Format indicator; must be zero for V2 (and V1)
#define DISPLAYPORT_MSP_ATTR_BLINK BIT(6) // Device local blink #define DISPLAYPORT_MSP_ATTR_BLINK BIT(6) // Device local blink