解决上电和长期运行屏幕触摸无效的问题

This commit is contained in:
2025-12-05 17:42:01 +08:00
parent fe65a0c408
commit bdcc73bc2b
15 changed files with 95 additions and 40 deletions

View File

@@ -1,3 +1,7 @@
# v1.0.8
* 1.gt911的驱动方式有中断改为轮询并初始化重新写;解决上电和长期运行屏幕触摸无效的问题
* 2.修复非标准时区和自动获取时间不一致的bug
# v1.0.7
* 1.增加非标准时区

View File

@@ -11,7 +11,7 @@
#define D_System_Storage "16MB+8MB"
#define D_System_Hardware "1.0"
#define D_System_Screen "480*480"
#define D_System_Ver 107
#define D_System_Ver 108
enum
{

View File

@@ -3389,7 +3389,14 @@ void mcu_write_rtctime(unsigned char time[])
//=0是utc+0
//<0是utc-
//>0是utc+
char zone=(char)((Localtime-standardtime)/3600);//标准时区
// //UTC-04:30
// Localtime=1764832680;
// standardtime=1764848880;
// printf("test utc-04:30 standardtime:%ld\r\n",standardtime);
// printf("test utc-04:30 Localtime:%ld\r\n",Localtime);
int zone=(int)((Localtime-standardtime)/3600);//标准时区
int zone_offset=((Localtime-standardtime)%3600);//处理5:30 6:30等等非准标时区
printf("zone:%d;zone_offset:%d\r\n", zone,zone_offset);
@@ -3481,16 +3488,19 @@ void mcu_write_rtctime(unsigned char time[])
}
struct timeval tv;
//tv.tv_sec=(time_t)Localtime;//用本地时间 时区要设置0 相对0时区的时间
tz_set(zone);
tv.tv_sec=(time_t)standardtime;//utc时间
tz_set(zone);//不支持半时区设置
standardtime=Localtime-zone*3600;//重新计算标准utc+0的时间 考虑UTC+5:30...等非标准时区
tv.tv_sec=(time_t)standardtime;//utc时间 疑惑点 是否要+-1800/2700
tv.tv_usec=0;
// int settimeofday(const struct timeval *tv , const struct timezone *tz);
//tz参数为时区 通常将参数tz设置为NULL表示使用当前系统的时区
//输入时间戳通过settimeofday()函数来设置系统时间,这个函数设置的精度可以精确到微秒
// tz_set(0);//本地时间就是相对0时区的时间
settimeofday(&tv, NULL);//不用重新设置时区
settimeofday(&tv, NULL);
my_memcpy((void *)timestamp,(const char *)time,4); //get timestamp
zigbee_timestamp_to_time();

View File

@@ -259,7 +259,7 @@ static rt_size_t gt911_read_point(struct rt_touch_device *touch, void *buf,
cmd[1] = (rt_uint8_t)(GT911_READ_STATUS & 0xFF);
if (gt911_read_regs(&gt911_client, cmd, &point_status, 1) != RT_EOK) {
LOG_D("read point failed\n");
LOG_E("read point failed\n");
read_num = 0;
goto exit_;
}
@@ -290,7 +290,7 @@ static rt_size_t gt911_read_point(struct rt_touch_device *touch, void *buf,
/* read point num is touch_num */
if (gt911_read_regs(&gt911_client, cmd, read_buf,
read_num * GT911_POINT_INFO_NUM) != RT_EOK) {
LOG_D("read point failed\n");
LOG_E("read point failed\n");
read_num = 0;
goto exit_;
}
@@ -350,7 +350,7 @@ exit_:
write_buf[0] = (rt_uint8_t)((GT911_READ_STATUS >> 8) & 0xFF);
write_buf[1] = (rt_uint8_t)(GT911_READ_STATUS & 0xFF);
write_buf[2] = 0x00;
gt911_write_reg(&gt911_client, write_buf, 3);
gt911_write_reg(&gt911_client, write_buf, 3);//读完后把0x814E寄存器清为0
return read_num;
}
@@ -495,31 +495,53 @@ static int rt_hw_gt911_init(const char *name, struct rt_touch_config *cfg)
rt_memset((void *)touch_device, 0, sizeof(struct rt_touch_device));
/* hw init*/
// // rst output 0
// rt_pin_mode(*(rt_uint8_t *)cfg->user_data, PIN_MODE_OUTPUT);
// rt_pin_write(*(rt_uint8_t *)cfg->user_data, PIN_LOW);
// rt_thread_delay(10);
// // irq output 0
// rt_pin_mode(cfg->irq_pin.pin, PIN_MODE_OUTPUT);
// rt_pin_write(cfg->irq_pin.pin, PIN_LOW);
// rt_thread_delay(2);
// // rst output 1
// rt_pin_mode(*(rt_uint8_t *)cfg->user_data, PIN_MODE_OUTPUT);
// rt_pin_write(*(rt_uint8_t *)cfg->user_data, PIN_HIGH);
// rt_thread_delay(5);
// // // rst input
// // rt_pin_mode(*(rt_uint8_t *)cfg->user_data, PIN_MODE_INPUT);
// //irq output 0
// rt_pin_mode(cfg->irq_pin.pin, PIN_MODE_OUTPUT);
// rt_pin_write(cfg->irq_pin.pin, PIN_LOW);
// rt_thread_delay(50);
// rt_pin_mode(cfg->irq_pin.pin, PIN_MODE_INPUT);
//把RST、INT拉低延时10ms把RST拉高(>5ms)就可以把IIC地址设为0xBA/0xBB
rt_thread_delay(20);//硬件RC电路采用的10k 1uf 复位需要10ms以上
// rst output 0
rt_pin_mode(*(rt_uint8_t *)cfg->user_data, PIN_MODE_OUTPUT);
rt_pin_write(*(rt_uint8_t *)cfg->user_data, PIN_LOW);
rt_thread_delay(10);
// irq output 0
rt_pin_mode(cfg->irq_pin.pin, PIN_MODE_OUTPUT);
rt_pin_write(cfg->irq_pin.pin, PIN_LOW);
rt_thread_delay(2);
rt_thread_delay(50);
// rst output 1
rt_pin_mode(*(rt_uint8_t *)cfg->user_data, PIN_MODE_OUTPUT);
rt_pin_mode(*(rt_uint8_t *)cfg->user_data, PIN_MODE_OUTPUT);
rt_pin_write(*(rt_uint8_t *)cfg->user_data, PIN_HIGH);
rt_thread_delay(200);// irq output 0 >50ms维持不变
rt_thread_delay(5);
// // rst input
// rt_pin_mode(*(rt_uint8_t *)cfg->user_data, PIN_MODE_INPUT);
//irq input 0
rt_pin_mode(cfg->irq_pin.pin, PIN_MODE_INPUT);//改成输入
//irq output 0
rt_pin_mode(cfg->irq_pin.pin, PIN_MODE_OUTPUT);
rt_pin_write(cfg->irq_pin.pin, PIN_LOW);
rt_thread_delay(50);
rt_pin_mode(cfg->irq_pin.pin, PIN_MODE_INPUT);
gt911_client.bus =
(struct rt_i2c_bus_device *)rt_device_find(cfg->dev_name);

View File

@@ -58,7 +58,7 @@ static void touch_entry(void *parameter) /* touch panel control entry */
while (1)
{
rt_sem_take(touch_sem, RT_WAITING_FOREVER);
// rt_sem_take(touch_sem, RT_WAITING_FOREVER);
int num = rt_device_read(dev, 0, read_data, info.point_num);
if (num > 0)
{
@@ -81,19 +81,26 @@ static void touch_entry(void *parameter) /* touch panel control entry */
}
}
}
//aicos_msleep(10);
rt_device_control(dev, RT_TOUCH_CTRL_ENABLE_INT, RT_NULL);
// rt_device_control(dev, RT_TOUCH_CTRL_ENABLE_INT, RT_NULL);//处理完毕再使能中断
/*
* If using polling mode,
* the following conmments must be opened,
* and the masking related to semaphores must be removed.
*/
rt_thread_mdelay(10);
}
}
static rt_err_t rx_callback(rt_device_t dev, rt_size_t size)
{
rt_sem_release(touch_sem);
rt_device_control(dev, RT_TOUCH_CTRL_DISABLE_INT, RT_NULL);
#ifdef AIC_PM_DEMO
extern struct rt_event pm_event;
rt_event_send(&pm_event, 2);
#endif
// rt_sem_release(touch_sem);
// rt_device_control(dev, RT_TOUCH_CTRL_DISABLE_INT, RT_NULL);//中断来了 暂时关闭中断 等处理完毕再打开
// #ifdef AIC_PM_DEMO
// extern struct rt_event pm_event;
// rt_event_send(&pm_event, 2);
// #endif
return 0;
}
@@ -105,7 +112,7 @@ int tpc_run(const char *name, rt_uint16_t x, rt_uint16_t y)
rt_kprintf("can't find device:%s\n", name);
return -1;
}
//中断接收
if (rt_device_open(dev, RT_DEVICE_FLAG_INT_RX) != RT_EOK)
{
rt_kprintf("dev %s is occupied by someone!\n", name);

Binary file not shown.

BIN
t3e-pro标准版_v1.0.8.zip Normal file

Binary file not shown.

View File

@@ -253,7 +253,7 @@ CONFIG_AIC_USING_I2C0=y
#
# CONFIG_AIC_DEV_I2C0_ADDR_BIT is not set
CONFIG_AIC_DEV_I2C0_10BIT=0
CONFIG_AIC_DEV_I2C0_SPEED=400000
CONFIG_AIC_DEV_I2C0_SPEED=200000
# CONFIG_AIC_DEV_I2C0_BUS_MODE is not set
CONFIG_AIC_DEV_I2C0_SLAVE_MODE=0
CONFIG_AIC_USING_PWM0=y

View File

@@ -15,7 +15,7 @@
"info": { // Header information about image
"platform": "d12x",
"product": "t3e-pro",
"version": "1.0.7",
"version": "1.0.8",
"media": {
"type": "spi-nor",
"device_id": 0,

View File

@@ -15,7 +15,7 @@
"info": { // Header information about image
"platform": "d12x",
"product": "t3e-pro",
"version": "1.0.7",
"version": "1.0.8",
"media": {
"type": "spi-nor",
"device_id": 0,

View File

@@ -52,7 +52,7 @@ struct aic_pinmux aic_pinmux_config[] = {
#endif
#ifdef AIC_USING_CTP
{1, PIN_PULL_DIS, 3, AIC_TOUCH_PANEL_RST_PIN},
{1, PIN_PULL_UP, 3, AIC_TOUCH_PANEL_INT_PIN},//硬件没贴上拉电阻 芯片的上拉打开
{1, PIN_PULL_DIS, 3, AIC_TOUCH_PANEL_INT_PIN},//硬件没贴上拉电阻 芯片的上拉打开
#endif
#if defined(AIC_USING_QSPI0) && !defined(AIC_SYSCFG_SIP_FLASH_ENABLE)
/* qspi0 */

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<key name="Software">
<key name="ConEmu">
<key name=".Vanilla" modified="2025-11-29 16:36:40" build="180206">
<key name=".Vanilla" modified="2025-12-05 17:31:06" build="180206">
<value name="StartType" type="hex" data="02"/>
<value name="CmdLine" type="string" data=""/>
<value name="StartTasksFile" type="string" data=""/>
@@ -259,8 +259,8 @@
<value name="Cascaded" type="hex" data="01"/>
<value name="IntegralSize" type="hex" data="00"/>
<value name="WindowMode" type="dword" data="0000051f"/>
<value name="ConWnd X" type="long" data="538"/>
<value name="ConWnd Y" type="long" data="124"/>
<value name="ConWnd X" type="long" data="838"/>
<value name="ConWnd Y" type="long" data="128"/>
<value name="LastMonitor" type="string" data="0,0,1920,1040"/>
<value name="ConWnd Width" type="dword" data="0000006f"/>
<value name="ConWnd Height" type="dword" data="00000026"/>

View File

@@ -201,3 +201,15 @@ me
me
bm
me
list
lunch 3
bm
me
me
bm
me
bm
me
me
bm
me