vtx: fix VTX_SETTINGS_POWER_COUNT and add dummy entries to saPowerNames
[inav.git] / src / main / io / osd_joystick.c
blobc1d9dee5a5ab1de8e4dfb25869e8880a37457f91
1 #include <stdbool.h>
2 #include <stdint.h>
3 #include <string.h>
5 #include "platform.h"
7 #include "common/crc.h"
8 #include "common/maths.h"
9 #include "common/streambuf.h"
10 #include "common/utils.h"
12 #include "build/build_config.h"
14 #include "config/parameter_group.h"
15 #include "config/parameter_group_ids.h"
16 #include "fc/settings.h"
17 #include "fc/runtime_config.h"
19 #include "drivers/time.h"
20 #include "drivers/light_ws2811strip.h"
22 #include "io/serial.h"
23 #include "io/rcdevice.h"
25 #include "osd_joystick.h"
27 #ifdef USE_RCDEVICE
28 #ifdef USE_LED_STRIP
31 PG_REGISTER_WITH_RESET_TEMPLATE(osdJoystickConfig_t, osdJoystickConfig, PG_OSD_JOYSTICK_CONFIG, 0);
33 PG_RESET_TEMPLATE(osdJoystickConfig_t, osdJoystickConfig,
34 .osd_joystick_enabled = SETTING_OSD_JOYSTICK_ENABLED_DEFAULT,
35 .osd_joystick_down = SETTING_OSD_JOYSTICK_DOWN_DEFAULT,
36 .osd_joystick_up = SETTING_OSD_JOYSTICK_UP_DEFAULT,
37 .osd_joystick_left = SETTING_OSD_JOYSTICK_LEFT_DEFAULT,
38 .osd_joystick_right = SETTING_OSD_JOYSTICK_RIGHT_DEFAULT,
39 .osd_joystick_enter = SETTING_OSD_JOYSTICK_ENTER_DEFAULT
42 bool osdJoystickEnabled(void) {
43 return osdJoystickConfig()->osd_joystick_enabled;
47 void osdJoystickSimulate5KeyButtonPress(uint8_t operation) {
48 switch (operation) {
49 case RCDEVICE_CAM_KEY_ENTER:
50 ledPinStartPWM( osdJoystickConfig()->osd_joystick_enter );
51 break;
52 case RCDEVICE_CAM_KEY_LEFT:
53 ledPinStartPWM( osdJoystickConfig()->osd_joystick_left );
54 break;
55 case RCDEVICE_CAM_KEY_UP:
56 ledPinStartPWM( osdJoystickConfig()->osd_joystick_up );
57 break;
58 case RCDEVICE_CAM_KEY_RIGHT:
59 ledPinStartPWM( osdJoystickConfig()->osd_joystick_right );
60 break;
61 case RCDEVICE_CAM_KEY_DOWN:
62 ledPinStartPWM( osdJoystickConfig()->osd_joystick_down );
63 break;
68 void osdJoystickSimulate5KeyButtonRelease(void) {
69 ledPinStopPWM();
73 #endif
74 #endif