Position hold depends on GPS (#14101)
[betaflight.git] / src / main / osd / osd_elements.h
blob9f08c5ee33802d37c791c9a29d75960282a5498d
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #include "drivers/display.h"
25 #include "osd/osd.h"
27 typedef enum {
28 OSD_ELEMENT_TYPE_1 = 0,
29 OSD_ELEMENT_TYPE_2,
30 OSD_ELEMENT_TYPE_3,
31 OSD_ELEMENT_TYPE_4
32 } osdElementType_e;
34 typedef struct osdElementParms_s {
35 uint8_t item;
36 uint8_t elemPosX;
37 uint8_t elemPosY;
38 uint8_t elemOffsetX;
39 uint8_t elemOffsetY;
40 osdElementType_e type;
41 char *buff;
42 displayPort_t *osdDisplayPort;
43 bool drawElement;
44 bool rendered;
45 uint8_t attr;
46 } osdElementParms_t;
48 typedef void (*osdElementDrawFn)(osdElementParms_t *element);
50 int osdConvertTemperatureToSelectedUnit(int tempInDegreesCelcius);
51 void osdFormatDistanceString(char *result, int distance, char leadingSymbol);
52 bool osdFormatRtcDateTime(char *buffer);
53 void osdFormatTime(char * buff, osd_timer_precision_e precision, timeUs_t time);
54 void osdFormatTimer(char *buff, bool showSymbol, bool usePrecision, int timerIndex);
55 float osdGetMetersToSelectedUnit(int32_t meters);
56 char osdGetMetersToSelectedUnitSymbol(void);
57 int32_t osdGetSpeedToSelectedUnit(int32_t value);
58 char osdGetSpeedToSelectedUnitSymbol(void);
59 char osdGetTemperatureSymbolForSelectedUnit(void);
60 void osdAddActiveElements(void);
61 bool osdIsRenderPending(void);
62 uint8_t osdGetActiveElement(void);
63 uint8_t osdGetActiveElementCount(void);
64 bool osdDrawNextActiveElement(displayPort_t *osdDisplayPort);
65 bool osdDisplayActiveElement(void);
66 void osdDrawActiveElementsBackground(displayPort_t *osdDisplayPort);
67 void osdElementsInit(bool backgroundLayerFlag);
68 void osdSyncBlink(timeUs_t currentTimeUs);
69 void osdResetAlarms(void);
70 void osdUpdateAlarms(void);
71 bool osdElementsNeedAccelerometer(void);
72 #ifdef USE_SPEC_PREARM_SCREEN
73 bool osdDrawSpec(displayPort_t *osdDisplayPort);
74 #endif // USE_SPEC_PREARM_SCREEN