Initial support of NB4+

This commit is contained in:
Richard Li
2025-01-24 19:00:12 +01:00
committed by Malte Langermann
parent 35e8b61b7d
commit d651b22379
10 changed files with 142 additions and 27 deletions
+1
View File
@@ -6,6 +6,7 @@
["Flysky NV14", "nv14-"],
["Flysky PL18", "pl18-"],
["Flysky PL18EV", "pl18ev-"],
["Flysky NB4+", "nb4p-"],
["FrSky Horus X10", "x10-"],
["FrSky Horus X10 Express", "x10express-"],
["FrSky Horus X12s", "x12s-"],
+6 -2
View File
@@ -73,7 +73,7 @@ static inline void check_struct()
CHKSIZE(TimerData, 17);
CHKSIZE(ModelHeader, 131);
CHKSIZE(CustomScreenData, 1892);
#if defined(PCBNV14)
#if defined(PCBNV14) || defined(RADIO_NB4P)
CHKTYPE(TopBarPersistentData, 704);
#else
CHKTYPE(TopBarPersistentData, 1048);
@@ -107,7 +107,11 @@ static inline void check_struct()
#elif defined(PCBNV14)
CHKSIZE(ModelData, 26463);
#elif defined(PCBPL18)
CHKSIZE(ModelData, 26845);
#if defined(RADIO_NB4P)
CHKSIZE(ModelData, 26499);
#else
CHKSIZE(ModelData, 26845);
#endif
#elif defined(RADIO_T15)
CHKSIZE(ModelData, 26834);
#elif defined(PCBHORUS)
+4 -1
View File
@@ -40,7 +40,10 @@ add_definitions(-DSOFTWARE_VOLUME)
add_definitions(-DSPI_FLASH)
add_definitions(-DSTM32_SUPPORT_32BIT_TIMERS)
if(PCBREV STREQUAL PL18EV)
if(PCBREV STREQUAL NB4P)
set(FLAVOUR nb4p)
add_definitions(-DRADIO_NB4P)
elseif(PCBREV STREQUAL PL18EV)
set(FLAVOUR pl18ev)
add_definitions(-DRADIO_PL18EV)
else()
+11 -5
View File
@@ -639,11 +639,17 @@
// SDRAM
#define SDRAM_BANK1
#define PORTRAIT_LCD false
#define LANDSCAPE_LCD true
#define LCD_W 480
#define LCD_H 320
#if defined(RADIO_NB4P)
#define PORTRAIT_LCD true
#define LANDSCAPE_LCD false
#define LCD_W 320
#define LCD_H 480
#else
#define PORTRAIT_LCD false
#define LANDSCAPE_LCD true
#define LCD_W 480
#define LCD_H 320
#endif
#define LCD_PHYS_W 320
#define LCD_PHYS_H 480
+26 -11
View File
@@ -1150,18 +1150,33 @@ void LCD_ST7796S_Init(void) {
lcdWriteData( 0x96 );
lcdWriteCommand( 0x36 );
lcdWriteData( 0x28 );
if (LCD_W != LCD_PHYS_W) {
lcdWriteData( 0x28 );
lcdWriteCommand( 0x2A );
lcdWriteData( 0x00 );
lcdWriteData( 0x00 );
lcdWriteData( 0x01 );
lcdWriteData( 0xDF );
lcdWriteCommand( 0x2B );
lcdWriteData( 0x00 );
lcdWriteData( 0x00 );
lcdWriteData( 0x01 );
lcdWriteData( 0x3F );
lcdWriteCommand( 0x2A );
lcdWriteData( 0x00 );
lcdWriteData( 0x00 );
lcdWriteData( 0x01 );
lcdWriteData( 0xDF );
lcdWriteCommand( 0x2B );
lcdWriteData( 0x00 );
lcdWriteData( 0x00 );
lcdWriteData( 0x01 );
lcdWriteData( 0x3F );
} else {
lcdWriteData( 0x88 );
lcdWriteCommand( 0x2A );
lcdWriteData( 0x00 );
lcdWriteData( 0x00 );
lcdWriteData( 0x01 );
lcdWriteData( 0x3F );
lcdWriteCommand( 0x2B );
lcdWriteData( 0x00 );
lcdWriteData( 0x00 );
lcdWriteData( 0x01 );
lcdWriteData( 0xDF );
}
lcdWriteCommand( 0x3A );
lcdWriteData( 0x66 );
+12 -8
View File
@@ -21,12 +21,16 @@
#pragma once
#if defined(RADIO_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 */
#if defined(RADIO_NB4P)
#define USB_NAME "FlySky NB4+"
#define USB_MANUFACTURER 'F', 'l', 'y', 'S', 'k', 'y', ' ', ' ' /* 8 bytes */
#define USB_PRODUCT 'N', 'B', '4', '+', ' ', ' ', ' ', ' ' /* 8 Bytes */
#elif defined(RADIO_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
+62
View File
@@ -679,6 +679,68 @@ LEGACY_NAMES = [
}
}
},
{
"targets": {
"nb4p"
},
"inputs": {
"LH": {
"yaml": "Rud",
"lua": "rud",
"description": "Rudder"
},
"LV": {
"yaml": "Ele",
"lua": "ele",
"description": "Elevator"
},
"RV": {
"yaml": "Thr",
"lua": "thr",
"description": "Throttle"
},
"RH": {
"yaml": "Ail",
"lua": "ail",
"description": "Aileron"
},
"P1": {
"yaml": "POT1",
"lua": "s1",
"label": "S1",
"short_label": "1",
"description": "Potentiometer 1"
},
"P2": {
"yaml": "POT2",
"lua": "s2",
"label": "S2",
"short_label": "2",
"description": "Potentiometer 2"
},
"P3": {
"yaml": "POT3",
"lua": "s3",
"label": "S3",
"short_label": "3",
"description": "Potentiometer 3"
},
"SL1": {
"yaml": "LS",
"lua": "ls",
"label": "LS",
"short_label": "L",
"description": "Left slider"
},
"SL2": {
"yaml": "RS",
"lua": "rs",
"label": "RS",
"short_label": "R",
"description": "Right slider"
},
}
},
{
"targets": {"v12", "v14"},
"inputs": {
+7
View File
@@ -39,6 +39,13 @@ POT_CONFIG = {
"EXT3": {"default": "MULTIPOS"},
"EXT4": {"default": "MULTIPOS"}
},
"nb4p": {
"P1": {"default": "POT"},
"P2": {"default": "POT"},
"P3": {"default": "POT"},
"SL1": {"default": "SLIDER"},
"SL2": {"default": "SLIDER"}
},
"v12": {
"P1": {"default": "POT_CENTER"},
"P2": {"default": "POT_CENTER"},
+10
View File
@@ -65,6 +65,16 @@ SWITCH_CONFIG = {
"SI": { "default": "3POS" },
"SJ": { "default": "3POS" }
},
"nb4p": {
"SA": { "default": "2POS" },
"SB": { "default": "3POS" },
"SC": { "default": "2POS" },
"SD": { "default": "3POS" },
"SE": { "default": "3POS" },
"SF": { "default": "2POS" },
"SG": { "default": "3POS" },
"SH": { "default": "TOGGLE" }
},
"lr3pro": {
# left side
"SA": {"default": "3POS", "display": [0, 0]},
+3
View File
@@ -143,6 +143,9 @@ get_target_build_options() {
pl18ev)
BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=PL18EV"
;;
nb4p)
BUILD_OPTIONS+="-DPCB=PL18 -DPCBREV=NB4P"
;;
*)
echo "Unknown target: $target_name"
return 1