Skip to content

Commit

Permalink
Added PL18EV support.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardclli committed Oct 28, 2023
1 parent cf55bde commit 2a5c0af
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- nv14
- el18
- pl18
- pl18ev
- t12
- t16
- t18
Expand Down Expand Up @@ -95,7 +96,7 @@ jobs:
matrix:
target:
- nv14;el18
- pl18
- pl18;pl18ev
- t12
- t16;t18
- t8;zorro;pocket;commando8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
target:
- nv14;el18
- pl18
- pl18;pl18ev
- t12
- t16
- t18
Expand Down
2 changes: 2 additions & 0 deletions radio/src/targets/pl18/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ add_definitions(-DSOFTWARE_VOLUME)
add_definitions(-DSPI_FLASH)

# defines existing internal modules
if (NOT PCBREV STREQUAL PL18EV)
set(INTERNAL_MODULES MULTI CACHE STRING "Internal modules")
set(DEFAULT_INTERNAL_MODULE MULTIMODULE CACHE STRING "Default internal module")
endif()

set(BITMAPS_TARGET pl18_bitmaps)
set(FONTS_TARGET x12_fonts)
Expand Down
6 changes: 6 additions & 0 deletions radio/src/targets/pl18/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,15 @@ bool isBacklightEnabled();
#if !defined(SIMU)
void usbJoystickUpdate();
#endif
#if (PCBREV == PL18EV)
#define USB_NAME "FlySky PL18EV"
#define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */
#define USB_PRODUCT 'P', 'L', '1', '8', 'E', 'V', ' ', ' ' /* 8 Bytes */
#else
#define USB_NAME "FlySky PL18"
#define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */
#define USB_PRODUCT 'P', 'L', '1', '8', ' ', ' ', ' ', ' ' /* 8 Bytes */
#endif

#if defined(__cplusplus) && !defined(SIMU)
}
Expand Down
28 changes: 25 additions & 3 deletions radio/src/targets/pl18/hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@
#define ADC_GPIO_PIN_POT3 LL_GPIO_PIN_8 // PF.08 VRC
#define ADC_GPIO_PIN_SLIDER1 LL_GPIO_PIN_9 // PF.09 VRD/LS
#define ADC_GPIO_PIN_SLIDER2 LL_GPIO_PIN_7 // PA.07 VRE/RS
//#define ADC_GPIO_PIN_EXT1 LL_GPIO_PIN_2 // PA.02
//#define ADC_GPIO_PIN_EXT2 LL_GPIO_PIN_6 // PF.06

#if (PCBREV == PL18EV)
#define ADC_GPIO_PIN_EXT1 LL_GPIO_PIN_2 // PA.02
#define ADC_GPIO_PIN_EXT2 LL_GPIO_PIN_6 // PF.06
#endif

#define ADC_GPIO_PIN_SWB LL_GPIO_PIN_1 // PC.01
#define ADC_GPIO_PIN_SWD LL_GPIO_PIN_0 // PC.00
Expand Down Expand Up @@ -263,6 +266,22 @@

#define ADC_VREF_PREC2 660

#if (PCBREV == PL18EV)
#define ADC_DIRECTION { \
0,0,0,0, /* gimbals */ \
0,0,0, /* pots */ \
-1,-1, /* sliders */ \
0,0, /* ext1 & 2 */ \
0, /* vbat */ \
0, /* rtc_bat */ \
-1, /* SWB */ \
-1, /* SWD */ \
0, /* SWE */ \
0, /* SWF */ \
0, /* SWG */ \
0 /* SWH */ \
}
#else
#define ADC_DIRECTION { \
0,0,0,0, /* gimbals */ \
0,0,0, /* pots */ \
Expand All @@ -277,7 +296,8 @@
0, /* SWG */ \
0 /* SWH */ \
}

#endif

// Power
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOI
#define PWR_ON_GPIO GPIOI
Expand Down Expand Up @@ -525,6 +545,7 @@
#define FLYSKY_HALL_DMA_Stream_TX LL_DMA_STREAM_4

// Internal Module
#if (!defined(PCBREV))
#define INTMODULE_RCC_AHB1Periph (RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_DMA1)
#define INTMODULE_PWR_GPIO GPIOI
#define INTMODULE_PWR_GPIO_PIN GPIO_Pin_0 // PI.00
Expand All @@ -550,6 +571,7 @@
#define INTMODULE_TIMER_IRQn TIM3_IRQn
#define INTMODULE_TIMER_IRQHandler TIM3_IRQHandler
#define INTMODULE_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1)
#endif

// External Module
#define EXTMODULE
Expand Down
14 changes: 12 additions & 2 deletions radio/util/hw_defs/switch_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@
"pl18": {
"SA": { "default": "2POS" },
"SB": { "default": "3POS" },
"SC": { "default": "3POS" },
"SD": { "default": "2POS" },
"SC": { "default": "2POS" },
"SD": { "default": "3POS" },
"SE": { "default": "3POS" },
"SF": { "default": "2POS" },
"SG": { "default": "3POS" },
"SH": { "default": "TOGGLE" }
},
"pl18ev": {
"SA": { "default": "2POS" },
"SB": { "default": "3POS" },
"SC": { "default": "2POS" },
"SD": { "default": "3POS" },
"SE": { "default": "3POS" },
"SF": { "default": "2POS" },
"SG": { "default": "3POS" },
"SH": { "default": "3POS" }
},
"lr3pro": {
# left side
"SA": {"default": "3POS", "display": [0, 0]},
Expand Down
1 change: 1 addition & 0 deletions tools/build-flysky.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"NV14": { "PCB": "NV14" },
"EL18": { "PCB": "NV14", "PCBREV": "EL18" },
"PL18": { "PCB": "PL18" },
"PL18EV": { "PCB": "PL18", "PCBREV": "PL18EV" },
}

translations = [
Expand Down
3 changes: 3 additions & 0 deletions tools/build-gh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ do
pl18)
BUILD_OPTIONS+="-DPCB=PL18"
;;
pl18ev)
BUILD_OPTIONS+="-DPCB=PL18" -DPCBREV=PL18EV"
;;
commando8)
BUILD_OPTIONS+="-DPCB=X7 -DPCBREV=COMMANDO8"
;;
Expand Down

0 comments on commit 2a5c0af

Please sign in to comment.