6 #include "drivers/display.h"
7 #include "drivers/osd.h"
10 FRSKY_OSD_TRANSACTION_OPT_PROFILED
= 1 << 0,
11 FRSKY_OSD_TRANSACTION_OPT_RESET_DRAWING
= 1 << 1,
12 } frskyOSDTransactionOptions_e
;
15 FRSKY_OSD_COLOR_BLACK
= 0,
16 FRSKY_OSD_COLOR_TRANSPARENT
= 1,
17 FRSKY_OSD_COLOR_WHITE
= 2,
18 FRSKY_OSD_COLOR_GRAY
= 3,
22 FRSKY_OSD_OUTLINE_TYPE_NONE
= 0,
23 FRSKY_OSD_OUTLINE_TYPE_TOP
= 1 << 0,
24 FRSKY_OSD_OUTLINE_TYPE_RIGHT
= 1 << 1,
25 FRSKY_OSD_OUTLINE_TYPE_BOTTOM
= 1 << 2,
26 FRSKY_OSD_OUTLINE_TYPE_LEFT
= 1 << 3,
27 } frskyOSDLineOutlineType_e
;
31 FRSKY_OSD_WIDGET_ID_AHI
= 0,
33 FRSKY_OSD_WIDGET_ID_SIDEBAR_0
= 1,
34 FRSKY_OSD_WIDGET_ID_SIDEBAR_1
= 2,
36 FRSKY_OSD_WIDGET_ID_GRAPH_0
= 3,
37 FRSKY_OSD_WIDGET_ID_GRAPH_1
= 4,
38 FRSKY_OSD_WIDGET_ID_GRAPH_2
= 5,
39 FRSKY_OSD_WIDGET_ID_GRAPH_3
= 6,
41 FRSKY_OSD_WIDGET_ID_CHARGAUGE_0
= 7,
42 FRSKY_OSD_WIDGET_ID_CHARGAUGE_1
= 8,
43 FRSKY_OSD_WIDGET_ID_CHARGAUGE_2
= 9,
44 FRSKY_OSD_WIDGET_ID_CHARGAUGE_3
= 10,
46 FRSKY_OSD_WIDGET_ID_SIDEBAR_FIRST
= FRSKY_OSD_WIDGET_ID_SIDEBAR_0
,
47 FRSKY_OSD_WIDGET_ID_SIDEBAR_LAST
= FRSKY_OSD_WIDGET_ID_SIDEBAR_1
,
49 FRSKY_OSD_WIDGET_ID_GRAPH_FIRST
= FRSKY_OSD_WIDGET_ID_GRAPH_0
,
50 FRSKY_OSD_WIDGET_ID_GRAPH_LAST
= FRSKY_OSD_WIDGET_ID_GRAPH_3
,
52 FRSKY_OSD_WIDGET_ID_CHARGAUGE_FIRST
= FRSKY_OSD_WIDGET_ID_CHARGAUGE_0
,
53 FRSKY_OSD_WIDGET_ID_CHARGAUGE_LAST
= FRSKY_OSD_WIDGET_ID_CHARGAUGE_3
,
56 typedef struct frskyOSDPoint_s
{
59 } __attribute__((packed
)) frskyOSDPoint_t
;
61 typedef struct frskyOSDSize_s
{
64 } __attribute__((packed
)) frskyOSDSize_t
;
66 typedef struct frskyOSDRect_s
{
67 frskyOSDPoint_t origin
;
69 } __attribute__((packed
)) frskyOSDRect_t
;
71 typedef struct frskyOSDWidgetAHIData_s
75 } __attribute__((packed
)) frskyOSDWidgetAHIData_t
;
77 typedef struct frskyOSDWidgetAHIConfig_s
82 uint8_t crosshairMargin
;
84 } __attribute__((packed
)) frskyOSDWidgetAHIConfig_t
;
86 typedef struct frskyOSDWidgetSidebarData_s
89 } __attribute__((packed
)) frskyOSDWidgetSidebarData_t
;
91 typedef struct frskyOSDWidgetSidebarConfig_s
96 uint16_t counts_per_step
;
98 } __attribute__((packed
)) frskyOSDWidgetSidebarConfig_t
;
100 bool frskyOSDInit(videoSystem_e videoSystem
);
101 bool frskyOSDIsReady(void);
102 void frskyOSDUpdate(void);
103 void frskyOSDBeginTransaction(frskyOSDTransactionOptions_e opts
);
104 void frskyOSDCommitTransaction(void);
105 void frskyOSDFlushSendBuffer(void);
106 bool frskyOSDReadFontCharacter(unsigned char_address
, osdCharacter_t
*chr
);
107 bool frskyOSDWriteFontCharacter(unsigned char_address
, const osdCharacter_t
*chr
);
109 unsigned frskyOSDGetGridRows(void);
110 unsigned frskyOSDGetGridCols(void);
112 unsigned frskyOSDGetPixelWidth(void);
113 unsigned frskyOSDGetPixelHeight(void);
115 void frskyOSDDrawStringInGrid(unsigned x
, unsigned y
, const char *buff
, textAttributes_t attr
);
116 void frskyOSDDrawCharInGrid(unsigned x
, unsigned y
, uint16_t chr
, textAttributes_t attr
);
117 bool frskyOSDReadCharInGrid(unsigned x
, unsigned y
, uint16_t *c
, textAttributes_t
*attr
);
118 void frskyOSDClearScreen(void);
120 void frskyOSDSetStrokeColor(frskyOSDColor_e color
);
121 void frskyOSDSetFillColor(frskyOSDColor_e color
);
122 void frskyOSDSetStrokeAndFillColor(frskyOSDColor_e color
);
123 void frskyOSDSetColorInversion(bool inverted
);
124 void frskyOSDSetPixel(int x
, int y
, frskyOSDColor_e color
);
125 void frskyOSDSetPixelToStrokeColor(int x
, int y
);
126 void frskyOSDSetPixelToFillColor(int x
, int y
);
127 void frskyOSDSetStrokeWidth(unsigned width
);
128 void frskyOSDSetLineOutlineType(frskyOSDLineOutlineType_e outlineType
);
129 void frskyOSDSetLineOutlineColor(frskyOSDColor_e outlineColor
);
131 void frskyOSDClipToRect(int x
, int y
, int w
, int h
);
132 void frskyOSDClearRect(int x
, int y
, int w
, int h
);
133 void frskyOSDResetDrawingState(void);
134 void frskyOSDDrawCharacter(int x
, int y
, uint16_t chr
, uint8_t opts
);
135 void frskyOSDDrawCharacterMask(int x
, int y
, uint16_t chr
, frskyOSDColor_e color
, uint8_t opts
);
136 void frskyOSDDrawString(int x
, int y
, const char *s
, uint8_t opts
);
137 void frskyOSDDrawStringMask(int x
, int y
, const char *s
, frskyOSDColor_e color
, uint8_t opts
);
138 void frskyOSDMoveToPoint(int x
, int y
);
139 void frskyOSDStrokeLineToPoint(int x
, int y
);
140 void frskyOSDStrokeTriangle(int x1
, int y1
, int x2
, int y2
, int x3
, int y3
);
141 void frskyOSDFillTriangle(int x1
, int y1
, int x2
, int y2
, int x3
, int y3
);
142 void frskyOSDFillStrokeTriangle(int x1
, int y1
, int x2
, int y2
, int x3
, int y3
);
143 void frskyOSDStrokeRect(int x
, int y
, int w
, int h
);
144 void frskyOSDFillRect(int x
, int y
, int w
, int h
);
145 void frskyOSDFillStrokeRect(int x
, int y
, int w
, int h
);
146 void frskyOSDStrokeEllipseInRect(int x
, int y
, int w
, int h
);
147 void frskyOSDFillEllipseInRect(int x
, int y
, int w
, int h
);
148 void frskyOSDFillStrokeEllipseInRect(int x
, int y
, int w
, int h
);
150 void frskyOSDCtmReset(void);
151 void frskyOSDCtmSet(float m11
, float m12
, float m21
, float m22
, float m31
, float m32
);
152 void frskyOSDCtmTranslate(float tx
, float ty
);
153 void frskyOSDCtmScale(float sx
, float sy
);
154 void frskyOSDCtmRotate(float r
);
156 void frskyOSDContextPush(void);
157 void frskyOSDContextPop(void);
159 bool frskyOSDSupportsWidgets(void);
160 bool frskyOSDSetWidgetConfig(frskyOSDWidgetID_e widget
, const void *config
, size_t configSize
);
161 bool frskyOSDDrawWidget(frskyOSDWidgetID_e widget
, const void *data
, size_t dataSize
);
163 uint32_t frskyOSDQuantize(float val
, float min
, float max
, int bits
);