mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Improved OSD & displayPort initialisation. Allowed nested screen grabbing
This commit is contained in:
parent
9a62b04699
commit
7c8d1967d0
9 changed files with 153 additions and 124 deletions
|
@ -45,19 +45,25 @@ void displayGrab(displayPort_t *instance)
|
|||
{
|
||||
instance->vTable->grab(instance);
|
||||
instance->vTable->clearScreen(instance);
|
||||
instance->isGrabbed = true;
|
||||
++instance->grabCount;
|
||||
}
|
||||
|
||||
void displayRelease(displayPort_t *instance)
|
||||
{
|
||||
instance->vTable->release(instance);
|
||||
instance->isGrabbed = false;
|
||||
--instance->grabCount;
|
||||
}
|
||||
|
||||
void displayReleaseAll(displayPort_t *instance)
|
||||
{
|
||||
instance->vTable->release(instance);
|
||||
instance->grabCount = 0;
|
||||
}
|
||||
|
||||
bool displayIsGrabbed(const displayPort_t *instance)
|
||||
{
|
||||
// can be called before initialised
|
||||
return (instance && instance->isGrabbed);
|
||||
return (instance && instance->grabCount > 0);
|
||||
}
|
||||
|
||||
int displayWrite(displayPort_t *instance, uint8_t x, uint8_t y, const char *s)
|
||||
|
@ -90,3 +96,12 @@ uint16_t displayTxBytesFree(const displayPort_t *instance)
|
|||
return instance->vTable->txBytesFree(instance);
|
||||
}
|
||||
|
||||
void displayInit(displayPort_t *instance, const displayPortVTable_t *vTable)
|
||||
{
|
||||
instance->vTable = vTable;
|
||||
instance->vTable->clearScreen(instance);
|
||||
instance->cleared = true;
|
||||
instance->grabCount = 0;
|
||||
instance->cursorRow = -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue