6 #include "drivers/osd.h"
8 typedef struct widgetRect_s
{
16 DISPLAY_WIDGET_TYPE_AHI
,
17 DISPLAY_WIDGET_TYPE_SIDEBAR
,
18 } displayWidgetType_e
;
21 DISPLAY_WIDGET_AHI_STYLE_STAIRCASE
= 0,
22 DISPLAY_WIDGET_AHI_STYLE_LINE
= 1,
26 DISPLAY_WIDGET_AHI_OPTION_SHOW_CORNERS
= 1 << 0,
29 typedef struct widgetAHIConfiguration_s
{
31 widgetAHIStyle_e style
;
32 widgetAHIOptions_t options
;
33 unsigned crosshairMargin
;
35 } widgetAHIConfiguration_t
;
37 typedef struct widgetAHIData_s
{
38 float pitch
; // radians
39 float roll
; // radians
44 DISPLAY_WIDGET_SIDEBAR_OPTION_LEFT
= 1 << 0, // Display the sidebar oriented to the left. Default is to the right
45 DISPLAY_WIDGET_SIDEBAR_OPTION_REVERSE
= 1 << 1, // Reverse the sidebar direction, so positive values move it down
46 DISPLAY_WIDGET_SIDEBAR_OPTION_UNLABELED
= 1 << 2, // Don't display the central label with the value.
47 DISPLAY_WIDGET_SIDEBAR_OPTION_STATIC
= 1 << 3, // The sidebar doesn't scroll nor display values along it.
48 } widgetSidebarOptions_t
;
50 typedef struct widgetSidebarConfiguration_s
{
52 widgetSidebarOptions_t options
;
53 uint8_t divisions
; // How many divisions the sidebar will have
54 uint16_t counts_per_step
; // How much the value increases/decreases per division BEFORE applying the unit scale
55 osdUnit_t unit
; // The unit used to display the values in the sidebar
56 } widgetSidebarConfiguration_t
;
58 typedef struct displayWidgetsVTable_s displayWidgetsVTable_t
;
60 typedef struct displayWidgets_s
{
61 const displayWidgetsVTable_t
*vTable
;
65 typedef struct displayWidgetsVTable_s
{
66 int (*supportedInstances
)(displayWidgets_t
*widgets
, displayWidgetType_e widgetType
);
67 bool (*configureAHI
)(displayWidgets_t
*widgets
, unsigned instance
, const widgetAHIConfiguration_t
*config
);
68 bool (*drawAHI
)(displayWidgets_t
*widgets
, unsigned instance
, const widgetAHIData_t
*data
);
69 bool (*configureSidebar
)(displayWidgets_t
*widgets
, unsigned instance
, const widgetSidebarConfiguration_t
*config
);
70 bool (*drawSidebar
)(displayWidgets_t
*widgets
, unsigned instance
, int32_t data
);
71 } displayWidgetsVTable_t
;
73 int displayWidgetsSupportedInstances(displayWidgets_t
*widgets
, displayWidgetType_e widgetType
);
74 bool displayWidgetsConfigureAHI(displayWidgets_t
*widgets
, unsigned instance
, const widgetAHIConfiguration_t
*config
);
75 bool displayWidgetsDrawAHI(displayWidgets_t
*widgets
, unsigned instance
, const widgetAHIData_t
*data
);
76 bool displayWidgetsConfigureSidebar(displayWidgets_t
*widgets
, unsigned instance
, const widgetSidebarConfiguration_t
*config
);
77 bool displayWidgetsDrawSidebar(displayWidgets_t
*widgets
, unsigned instance
, int32_t data
);