Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/hw/flysky-st16/FPC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/hw/flysky-st16/PCB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 93 additions & 0 deletions docs/mods/flysky-st16-touch-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Flysky ST16 Hardware Mod for Complete touch Support

This touch screen modification can only be used under the edgetx system and cannot be applied to the flyskyos system.

Adding a touch screen will occupy the wiring of the two rear buttons, thereby affecting the functionality of those two buttons.

[![Back of ST16](../assets/images/hw/flysky-st16/Back_of_st16.png)](../assets/images/hw/flysky-st16/Back_of_st16.png)

relevant document:[flysky ST16 touch](https://www.jianguoyun.com/p/DfgUegMQys6vDhir-aUGIAA)

- [line link](#line-link)
- [Screen material preparation](#screen-material-preparation)
- [Touchscreen assembly](#touchscreen-assembly)

## line link
Connect as shown in the picture.

[![Contact_connection](../assets/images/hw/flysky-st16/Contact_connection.png)](../assets/images/hw/flysky-st16/Contact_connection.png)

I use 0.8mm thick PCB for connection.

[![PCB](../assets/images/hw/flysky-st16/PCB.png)](../assets/images/hw/flysky-st16/PCB.png)
## Screen material preparation

Separate the original outer screen from the inner screen

[![Screen_separation](../assets/images/hw/flysky-st16/Screen_separation.png)](../assets/images/hw/flysky-st16/Screen_separation.png)

Replace with the IC:ft6236U touch external screen.

Product link:[FT6236U touch glass](https://item.taobao.com/item.htm?from=cart&id=627131226350&mi_id=0000tXbR3mX7zBJlOkPorNzXzd14FBHPjWwk2tTlrs-2qR8&skuId=4449085013858&spm=a1z0d.6639537%2F202410.item.d627131226350.2eed7484BfaY5i&upStreamPrice=1800)

Handling the touch glass

Remove the inner protective film and the double-sided adhesive.

[![Touching_the_glass_treatment](../assets/images/hw/flysky-st16/Touching_the_glass_treatment.png)](../assets/images/hw/flysky-st16/Touching_the_glass_treatment.png)

Cut off the protruding part of the front protective film and keep the protective film intact.

[![Touching_the_glass_treatment_2](../assets/images/hw/flysky-st16/Touching_the_glass_treatment_2.png)](../assets/images/hw/flysky-st16/Touching_the_glass_treatment_2.png)

[![Wire_connection](../assets/images/hw/flysky-st16/Wire_connection.png)](../assets/images/hw/flysky-st16/Wire_connection.png)

Display screen 1-6 pin:
1-GND
2-RST
3-INT
4-SCL
5-SDA
6-VCC
The touch screen is connected to the display's 1-6 pins via 6-pin connector.

Welding 6-pin and 40-pin connectors.

40pin connector, 0.5mm pitch, with the cover attached below

6pin connector, 0.5mm pitch, upper connection

[![FPC](../assets/images/hw/flysky-st16/FPC.png)](../assets/images/hw/flysky-st16/FPC.png)
## Touchscreen assembly

The materials required for screen assembly

[![Screen_assembly_components](../assets/images/hw/flysky-st16/Screen_assembly_components.png)](../assets/images/hw/flysky-st16/Screen_assembly_components.png)

Place the inner screen inside the screen frame, and have the wires pass through the gap.

[![Screen_installation](../assets/images/hw/flysky-st16/Screen_installation.png)](../assets/images/hw/flysky-st16/Screen_installation.png)

Then place the touch glass outside the screen frame, and have the wiring pass through the gap.

[![Touching_glass_installation](../assets/images/hw/flysky-st16/Touching_glass_installation.png)](../assets/images/hw/flysky-st16/Touching_glass_installation.png)

As shown in the picture, open the touch glass. Clean the inner screen and the inner side of the touch glass. Put in the TPU gasket.

[![Install_the_TPU_gasket](../assets/images/hw/flysky-st16/Install_the_TPU_gasket.png)](../assets/images/hw/flysky-st16/Install_the_TPU_gasket.png)

Fasten the screen cover plate

[![Top_cover_installation](../assets/images/hw/flysky-st16/Top_cover_installation.png)](../assets/images/hw/flysky-st16/Top_cover_installation.png)

Connect the 6-pin touch cable to the FPC cable, and then connect the 40-pin cable.

[![FPC_connection](../assets/images/hw/flysky-st16/FPC_connection.png)](../assets/images/hw/flysky-st16/FPC_connection.png)

Use tape to fix the fpc to the back of the outer frame.

[![Placement_of_FPC](../assets/images/hw/flysky-st16/Placement_of_FPC.png)](../assets/images/hw/flysky-st16/Placement_of_FPC.png)

Put the screen assembly back into the remote control and insert the screws to connect the wires.

[![FPC_connector_module](../assets/images/hw/flysky-st16/FPC_connector_module.png)](../assets/images/hw/flysky-st16/FPC_connector_module.png)
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ nav:
- Hardware Mods:
- Flysky Hall Sticks: mods/flysky-hall-sticks.md
- Flysky FRM303 Mod for TX16S: mods/flysky-frm303-tx16s.md
- Flysky ST16 Touch Support: mods/flysky-st16-touch-support.md
- Flysky PL18 & PL18EV: mods/flysky-pl18.md
- Flysky NB4+: mods/flysky-nb4plus.md
- Flashing EdgeTX to Flysky PL18/Paladin-EV: mods/flashing-flysky-pl18.md
Expand Down
16 changes: 16 additions & 0 deletions radio/src/targets/st16/hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,22 @@
#define TOUCH_I2C_BUS I2C_Bus_1
#define TOUCH_I2C_CLK_RATE 100000

// Touch pins: INT -> PI11, RST -> PI3
#define TOUCH_INT_GPIO GPIOI
#define TOUCH_INT_GPIO_PIN LL_GPIO_PIN_11
#define TOUCH_RST_GPIO GPIOI
#define TOUCH_RST_GPIO_PIN LL_GPIO_PIN_3

#define TOUCH_INT_EXTI_Line LL_EXTI_LINE_11
#define TOUCH_INT_EXTI_Port LL_SYSCFG_EXTI_PORTI
#define TOUCH_INT_EXTI_SysCfgLine LL_SYSCFG_EXTI_LINE11

// TOUCH_INT_EXTI IRQ for lines 15..10
#if !defined(USE_EXTI15_10_IRQ)
#define USE_EXTI15_10_IRQ
#define EXTI15_10_IRQ_Priority 5
#endif

#define IMU_I2C_BUS I2C_Bus_1
#define IMU_I2C_ADDRESS 0x6A

Expand Down
70 changes: 58 additions & 12 deletions radio/src/targets/st16/touch_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "stm32_gpio_driver.h"
#include "stm32_exti_driver.h"

#include "hal/i2c_driver.h"

#include "hal.h"
#include "timers_driver.h"
#include "delays_driver.h"
Expand Down Expand Up @@ -109,15 +111,62 @@ static tmr10ms_t downTime = 0;
static tmr10ms_t tapTime = 0;
static short tapCount = 0;

// static void _touch_exti_isr(void)
// {
// touchEventOccured = true;
// }
static void _touch_exti_isr(void)
{
touchEventOccured = true;
}

static void _touch_exti_stop(void) {
stm32_exti_disable(TOUCH_INT_EXTI_Line);
}

static void _touch_exti_config(void) {
__HAL_RCC_SYSCFG_CLK_ENABLE();
LL_SYSCFG_SetEXTISource(TOUCH_INT_EXTI_Port, TOUCH_INT_EXTI_SysCfgLine);

stm32_exti_enable(TOUCH_INT_EXTI_Line,
LL_EXTI_TRIGGER_FALLING,
_touch_exti_isr);
}

static void _touch_gpio_config(void) {
LL_GPIO_InitTypeDef gpioInit;
LL_GPIO_StructInit(&gpioInit);

// Enable clocks for the GPIO ports used by touch
stm32_gpio_enable_clock(TOUCH_RST_GPIO);
stm32_gpio_enable_clock(TOUCH_INT_GPIO);

// Configure RST as output, push-pull
gpioInit.Mode = LL_GPIO_MODE_OUTPUT;
gpioInit.Speed = LL_GPIO_SPEED_FREQ_LOW;
gpioInit.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
gpioInit.Pull = LL_GPIO_PULL_NO;
gpioInit.Pin = TOUCH_RST_GPIO_PIN;
LL_GPIO_Init(TOUCH_RST_GPIO, &gpioInit);
LL_GPIO_SetOutputPin(TOUCH_RST_GPIO, TOUCH_RST_GPIO_PIN);

// Configure INT as input with pull-up (10k external pull-up also present)
gpioInit.Pin = TOUCH_INT_GPIO_PIN;
gpioInit.Mode = LL_GPIO_MODE_INPUT;
gpioInit.Pull = LL_GPIO_PULL_UP;
gpioInit.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
LL_GPIO_Init(TOUCH_INT_GPIO, &gpioInit);
LL_GPIO_SetOutputPin(TOUCH_INT_GPIO, TOUCH_INT_GPIO_PIN);

// Init I2C bus used by touch (use platform i2c wrapper)
if (i2c_init(TOUCH_I2C_BUS) < 0) {
TRACE("Touch I2C Init ERROR: i2c_init failed");
}
}

static void _touch_reset() {
LL_GPIO_ResetOutputPin(TOUCH_RST_GPIO, TOUCH_RST_GPIO_PIN);
delay_ms(10);
LL_GPIO_SetOutputPin(TOUCH_RST_GPIO, TOUCH_RST_GPIO_PIN);
delay_ms(300);
}

static void _touch_exti_stop(void) {}
static void _touch_exti_config(void) {}
static void _touch_gpio_config(void) {}
static void _touch_reset() {}

static int _i2c_read(uint8_t addr, uint32_t reg, uint8_t regSize, uint8_t* data, uint16_t len, uint32_t timeout, bool forceLong = false)
{
Expand Down Expand Up @@ -177,8 +226,6 @@ static bool ft6236TouchRead(uint16_t * X, uint16_t * Y)

static bool ft6236HasTouchEvent()
{
touchEventOccured = true;
return true;
return touchEventOccured;
}

Expand Down Expand Up @@ -280,9 +327,8 @@ static bool cst836uTouchRead(uint16_t * X, uint16_t * Y)
static bool cst836uHasTouchEvent()
{
static bool lastHasTouch = false;
touchEventOccured = true;
bool ret = touchEventOccured;
if (ret||1) {
if (ret) {
uint8_t data;
_i2c_readMultipleRetry(TOUCH_CST836U_I2C_ADDRESS, TOUCH_CST836U_TOUCH_NUM_REG, 1, &data, sizeof(data), true);
uint8_t hasTouch = data;
Expand Down