2181 views|6 replies

1w

Posts

25

Resources
The OP
 

"Playing with the Board" + Replaying MicroPython on the STM32F7DISC (4) [Copy link]

 

touch

The touch function is another feature of the STM32F7DISC development board, which supports up to 5 points of detection. In this version of micropython, we can use it like this:

import lcdF7D as lcd
import tchF7D as ts
from time import sleep_ms

lcd.init()
lcd.set_text_color(0x00FF00)

ts.init(480, 272)


def ts_test():
    while 1:
        ts.get_state()
        if ts.touches() > 0:
            lcd.clear(0)
            print('\nTouch num: ', str(ts.touches()))
            for i in range(ts.touches()):
                print('  {} {}'.format(i+1, ts.point_info(i+1)))
                p = ts.point_info(i+1)
                x1 = max(min(p[0] - p[2]//2, 479), 0)
                x2 = max(min(p[0] + p[2]//2, 479), 0)
                y1 = max(min(p[1] - p[2]//2, 271), 0)
                y2 = max(min(p[1] + p[2]//2, 271), 0)
                lcd.set_text_color(0x00FF00)
                lcd.draw_rect(x1, y1, x2-x1, y2-y1)
        sleep_ms(100)


Operation effect


This content is originally created by dcexpert , a user of EEWORLD forum. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source

Latest reply

Hello, I burned the DFU file you compiled and tried several other LCD routines, all of which worked, but not this 5-point touch one. Is the touch screen function not turned on by default?   Details Published on 2020-4-3 10:14

赞赏

1

查看全部赞赏

 
 

1w

Posts

204

Resources
2
 
Like, haha, not bad!
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

5979

Posts

8

Resources
3
 

pretty!

Personal signature生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 
 
 

9702

Posts

24

Resources
4
 
I also had this board, but unfortunately the touch screen was broken and the LCD also broke later.

Comments

What a shame  Details Published on 2020-2-18 15:47
 
 
 

1w

Posts

25

Resources
5
 
littleshrimp posted on 2020-2-18 15:43 I also had this board but unfortunately the touch screen was broken and the LCD also broke later

What a shame

 
 
 

5

Posts

0

Resources
6
 

Hello, I burned the DFU file you compiled and tried several other LCD routines, all of which worked, but not this 5-point touch one. Is the touch screen function not turned on by default?

Comments

The example demonstrates the use of the touch screen. If it does not work, it may be caused by different hardware versions, which is explained in the instructions on github.  Details Published on 2020-4-3 11:31
 
 
 

1w

Posts

25

Resources
7
 
JohnsonJiang published on 2020-4-3 10:14 Hello, I burned the DFU file you compiled, and tried several other LCD routines, but this 5-point touch is not available. Is it not available by default?

The example demonstrates the use of the touch screen. If it doesn't work, it may be caused by different hardware versions, which is explained in github.

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list