mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 05:45:31 +03:00
Introduction of displayPort_t
This commit is contained in:
parent
e26258e686
commit
7960b1665d
16 changed files with 907 additions and 883 deletions
|
@ -38,7 +38,7 @@
|
|||
#include "io/motors.h"
|
||||
#include "io/servos.h"
|
||||
#include "io/gps.h"
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
#include "io/osd.h"
|
||||
#include "io/ledstrip.h"
|
||||
#include "io/vtx.h"
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#include "io/servos.h"
|
||||
#include "io/ledstrip.h"
|
||||
#include "io/gps.h"
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
#include "io/osd.h"
|
||||
#include "io/vtx.h"
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "flight/pid.h"
|
||||
#include "flight/altitudehold.h"
|
||||
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
|
||||
#include "io/beeper.h"
|
||||
#include "io/display.h"
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
#include "rx/rx.h"
|
||||
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
|
||||
#include "io/gps.h"
|
||||
#include "io/beeper.h"
|
||||
|
|
|
@ -11,20 +11,12 @@
|
|||
|
||||
#include "drivers/system.h"
|
||||
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
|
||||
#include "fc/fc_msp.h"
|
||||
#include "msp/msp_protocol.h"
|
||||
#include "msp/msp_serial.h"
|
||||
|
||||
void canvasGetDevParam(uint8_t *pRows, uint8_t *pCols, uint16_t *pBuftime, uint16_t *pBufsize)
|
||||
{
|
||||
*pRows = 13;
|
||||
*pCols = 30;
|
||||
*pBuftime = 23; // = 256/(115200/10)
|
||||
*pBufsize = 192; // 256 * 3/4 (Be conservative)
|
||||
}
|
||||
|
||||
int canvasOutput(uint8_t cmd, uint8_t *buf, int len)
|
||||
{
|
||||
mspSerialPush(cmd, buf, len);
|
||||
|
@ -85,10 +77,18 @@ screenFnVTable_t canvasVTable = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
screenFnVTable_t *canvasInit(void)
|
||||
displayPort_t canvasDisplayPort = {
|
||||
.rows = 13,
|
||||
.cols = 30,
|
||||
.pBuftime = 23, // = 256/(115200/10)
|
||||
.pBufsize = 192, // 256 * 3/4 (Be conservative)
|
||||
.VTable = canvasVTable,
|
||||
};
|
||||
|
||||
displayPort_t *canvasInit(void)
|
||||
{
|
||||
mspSerialPushInit(mspFcPushInit()); // Called once at startup to initialize push function in msp
|
||||
|
||||
return &canvasVTable;
|
||||
return &canvasDisplayPort;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
screenFnVTable_t *canvasInit(void);
|
||||
displayPort_t *canvasInit(void);
|
||||
|
|
1650
src/main/io/cms.c
1650
src/main/io/cms.c
File diff suppressed because it is too large
Load diff
|
@ -1,17 +1,41 @@
|
|||
#pragma once
|
||||
|
||||
typedef struct screenFnVTable_s {
|
||||
int (*begin)(void);
|
||||
int (*end)(void);
|
||||
int (*clear)(void);
|
||||
int (*write)(uint8_t, uint8_t, char *);
|
||||
int (*heartbeat)(void);
|
||||
void (*resync)(void);
|
||||
} screenFnVTable_t;
|
||||
|
||||
typedef struct displayPort_s {
|
||||
uint8_t rows;
|
||||
uint8_t cols;
|
||||
uint16_t buftime;
|
||||
uint16_t bufsize;
|
||||
uint16_t batchsize; // Computed by CMS
|
||||
screenFnVTable_t *VTable;
|
||||
|
||||
// CMS state
|
||||
bool cleared;
|
||||
} displayPort_t;
|
||||
|
||||
void cmsInit(void);
|
||||
void cmsHandler(uint32_t);
|
||||
|
||||
#if 0
|
||||
void cmsOpenMenu();
|
||||
void cmsUpdate(uint32_t);
|
||||
void cmsScreenResync(void);
|
||||
void cmsScreenResync(displayPort_t *);
|
||||
#endif
|
||||
|
||||
// Required for external CMS tables
|
||||
|
||||
void cmsChangeScreen(void * ptr);
|
||||
void cmsExitMenu(void * ptr);
|
||||
void cmsChangeScreen(displayPort_t *, void *);
|
||||
void cmsExitMenu(displayPort_t *, void *);
|
||||
|
||||
#define STARTUP_HELP_TEXT1 "MENU: THR MID"
|
||||
#define STARTUP_HELP_TEXT2 "+ YAW LEFT"
|
||||
#define STARTUP_HELP_TEXT3 "+ PITCH UP"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
typedef void (*OSDMenuFuncPtr)(void *data);
|
||||
typedef void (*OSDMenuFuncPtr)(displayPort_t *, void *);
|
||||
|
||||
//type of elements
|
||||
typedef enum
|
||||
|
@ -95,13 +95,3 @@ typedef struct
|
|||
uint8_t max;
|
||||
const char * const *names;
|
||||
} OSD_TAB_t;
|
||||
|
||||
typedef struct screenFnVTable_s {
|
||||
void (*getDevParam)(uint8_t *, uint8_t *, uint16_t *, uint16_t *);
|
||||
int (*begin)(void);
|
||||
int (*end)(void);
|
||||
int (*clear)(void);
|
||||
int (*write)(uint8_t, uint8_t, char *);
|
||||
int (*heartbeat)(void);
|
||||
void (*resync)(void);
|
||||
} screenFnVTable_t;
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#include "flight/imu.h"
|
||||
#include "flight/failsafe.h"
|
||||
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
|
||||
#ifdef GPS
|
||||
#include "io/gps.h"
|
||||
|
@ -745,15 +745,7 @@ void displayDisablePageCycling(void)
|
|||
}
|
||||
|
||||
#ifdef OLEDCMS
|
||||
#include "io/cms_types.h"
|
||||
|
||||
void displayCMSGetDevParam(uint8_t *pRows, uint8_t *pCols, uint16_t *pBuftime, uint16_t *pBufsize)
|
||||
{
|
||||
*pRows = 8;
|
||||
*pCols = 21;
|
||||
*pBuftime = 1;
|
||||
*pBufsize = 50000;
|
||||
}
|
||||
#include "io/cms.h"
|
||||
|
||||
int displayCMSBegin(void)
|
||||
{
|
||||
|
@ -785,7 +777,6 @@ int displayCMSWrite(uint8_t x, uint8_t y, char *s)
|
|||
}
|
||||
|
||||
screenFnVTable_t displayCMSVTable = {
|
||||
displayCMSGetDevParam,
|
||||
displayCMSBegin,
|
||||
displayCMSEnd,
|
||||
displayCMSClear,
|
||||
|
@ -794,9 +785,17 @@ screenFnVTable_t displayCMSVTable = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
screenFnVTable_t *displayCMSInit(void)
|
||||
displayPort_t displayCMSDisplayPort = {
|
||||
.rows = 8,
|
||||
.cols = 21,
|
||||
.buftime = 1,
|
||||
.bufsize = 50000,
|
||||
.VTable = &displayCMSVTable,
|
||||
};
|
||||
|
||||
displayPort_t *displayCmsInit(void)
|
||||
{
|
||||
return &displayCMSVTable;
|
||||
return &displayCMSDisplayPort;
|
||||
}
|
||||
|
||||
#endif // OLEDCMS
|
||||
|
|
|
@ -46,4 +46,4 @@ void displayDisablePageCycling(void);
|
|||
void displayResetPageCycling(void);
|
||||
void displaySetNextPageChangeAt(uint32_t futureMicros);
|
||||
|
||||
screenFnVTable_t *displayCMSInit(void);
|
||||
displayPort_t *displayCmsInit(void);
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "sensors/sensors.h"
|
||||
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
|
||||
#include "io/serial.h"
|
||||
#include "io/display.h"
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
#include "drivers/system.h"
|
||||
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
#include "io/cms_types.h"
|
||||
|
||||
#include "io/flashfs.h"
|
||||
#include "io/osd.h"
|
||||
|
@ -404,12 +404,10 @@ void osdInit(void)
|
|||
sprintf(string_buffer, "BF VERSION: %s", FC_VERSION_STRING);
|
||||
max7456Write(5, 6, string_buffer);
|
||||
max7456Write(7, 7, STARTUP_HELP_TEXT1);
|
||||
max7456Write(12, 8, STARTUP_HELP_TEXT2);
|
||||
max7456Write(12, 9, STARTUP_HELP_TEXT3);
|
||||
max7456Write(11, 8, STARTUP_HELP_TEXT2);
|
||||
max7456Write(11, 9, STARTUP_HELP_TEXT3);
|
||||
|
||||
#ifdef CMS
|
||||
cmsScreenResync(); // Was max7456RefreshAll(); may be okay.
|
||||
#endif
|
||||
max7456RefreshAll();
|
||||
|
||||
refreshTimeout = 4 * REFRESH_1S;
|
||||
}
|
||||
|
@ -646,14 +644,6 @@ void osdUpdate(uint32_t currentTime)
|
|||
// OSD specific CMS functions
|
||||
//
|
||||
|
||||
void osdGetDevParam(uint8_t *pRows, uint8_t *pCols, uint16_t *pBuftime, uint16_t *pBufsize)
|
||||
{
|
||||
*pRows = max7456GetRowsCount();
|
||||
*pCols = 30;
|
||||
*pBuftime = 1; // Very fast
|
||||
*pBufsize = 50000; // Very large
|
||||
}
|
||||
|
||||
int osdMenuBegin(void)
|
||||
{
|
||||
osdResetAlarms();
|
||||
|
@ -711,7 +701,6 @@ void osdDrawElementPositioningHelp(void)
|
|||
#endif
|
||||
|
||||
screenFnVTable_t osdVTable = {
|
||||
osdGetDevParam,
|
||||
osdMenuBegin,
|
||||
osdMenuEnd,
|
||||
osdClearScreen,
|
||||
|
@ -720,8 +709,16 @@ screenFnVTable_t osdVTable = {
|
|||
max7456RefreshAll,
|
||||
};
|
||||
|
||||
screenFnVTable_t *osdCmsInit(void)
|
||||
displayPort_t osdDisplayPort = {
|
||||
.buftime = 1, // Very fast
|
||||
.bufsize = 50000, // Very large
|
||||
.VTable = &osdVTable,
|
||||
};
|
||||
|
||||
displayPort_t *osdCmsInit(void)
|
||||
{
|
||||
return &osdVTable;
|
||||
osdDisplayPort.rows = max7456GetRowsCount();
|
||||
osdDisplayPort.cols = 30;
|
||||
return &osdDisplayPort;
|
||||
}
|
||||
#endif // OSD
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef struct {
|
|||
void updateOsd(uint32_t currentTime);
|
||||
void osdInit(void);
|
||||
void resetOsdConfig(osd_profile_t *osdProfile);
|
||||
screenFnVTable_t *osdCmsInit(void);
|
||||
displayPort_t *osdCmsInit(void);
|
||||
|
||||
// Character coordinate and attributes
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ uint8_t cliMode = 0;
|
|||
#include "io/flashfs.h"
|
||||
#include "io/beeper.h"
|
||||
#include "io/asyncfatfs/asyncfatfs.h"
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
#include "io/osd.h"
|
||||
#include "io/vtx.h"
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
#include "rx/rx.h"
|
||||
#include "rx/spektrum.h"
|
||||
|
||||
#include "io/cms_types.h"
|
||||
#include "io/cms.h"
|
||||
|
||||
#include "io/beeper.h"
|
||||
#include "io/serial.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue