mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-26 09:45:33 +03:00
Merge pull request #8480 from JulioCesarMatias/DisplayPortMSPAddMacros
[Displayport MSP] Add Macros
This commit is contained in:
commit
d1f6f19aa1
2 changed files with 13 additions and 5 deletions
|
@ -38,6 +38,8 @@
|
||||||
#include "msp/msp_protocol.h"
|
#include "msp/msp_protocol.h"
|
||||||
#include "msp/msp_serial.h"
|
#include "msp/msp_serial.h"
|
||||||
|
|
||||||
|
#define MSP_OSD_MAX_STRING_LENGTH 30
|
||||||
|
|
||||||
static displayPort_t mspDisplayPort;
|
static displayPort_t mspDisplayPort;
|
||||||
|
|
||||||
extern uint8_t cliMode;
|
extern uint8_t cliMode;
|
||||||
|
@ -70,21 +72,21 @@ 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int clearScreen(displayPort_t *displayPort)
|
static int clearScreen(displayPort_t *displayPort)
|
||||||
{
|
{
|
||||||
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 int drawScreen(displayPort_t *displayPort)
|
static int drawScreen(displayPort_t *displayPort)
|
||||||
{
|
{
|
||||||
uint8_t subcmd[] = { 4 };
|
uint8_t subcmd[] = { MSP_DP_DRAW_SCREEN };
|
||||||
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
|
return output(displayPort, MSP_DISPLAYPORT, subcmd, sizeof(subcmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +98,7 @@ static int screenSize(const displayPort_t *displayPort)
|
||||||
static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, const char *string, textAttributes_t attr)
|
static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, const char *string, textAttributes_t attr)
|
||||||
{
|
{
|
||||||
UNUSED(attr);
|
UNUSED(attr);
|
||||||
#define MSP_OSD_MAX_STRING_LENGTH 30 // FIXME move this
|
|
||||||
uint8_t buf[MSP_OSD_MAX_STRING_LENGTH + 4];
|
uint8_t buf[MSP_OSD_MAX_STRING_LENGTH + 4];
|
||||||
|
|
||||||
int len = strlen(string);
|
int len = strlen(string);
|
||||||
|
@ -104,7 +106,7 @@ static int writeString(displayPort_t *displayPort, uint8_t col, uint8_t row, con
|
||||||
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] = 0;
|
buf[3] = 0;
|
||||||
|
|
|
@ -20,5 +20,11 @@
|
||||||
#include "config/parameter_group.h"
|
#include "config/parameter_group.h"
|
||||||
#include "drivers/display.h"
|
#include "drivers/display.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
|
||||||
|
|
||||||
struct displayPort_s;
|
struct displayPort_s;
|
||||||
struct displayPort_s *displayPortMspInit(void);
|
struct displayPort_s *displayPortMspInit(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue