初级会员

- 积分
- 124
- 金钱
- 124
- 注册时间
- 2017-8-7
- 在线时间
- 26 小时
|
由于V3和V2触摸屏引脚配置不一样,直接下载V3的例程会出现触摸屏无法使用的情况。需要更改例程中touch.h的两个地方:
1.
宏定义替换为如下:
#define PEN PFin(10) //PF10-->T_PEN
#define DOUT PFin(8) //PF8-->T_MISO
#define TDIN PFout(9) //PF9-->T_MOSI
#define TCLK PBout(1) //PB1-->T_CLK
#define TCS PBout(2) //PB2-->T_CS
2.
TP_Init()更改如下:
GPIO_InitTypeDef GPIO_InitStructure;//GPIO
//注意,时钟使能之后,对GPIO的操作才有效
//所以上拉之前,必须使能时钟.才能实现真正的上拉输出
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOF, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15|GPIO_Pin_1|GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOF, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10|GPIO_Pin_8;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU ;
GPIO_Init(GPIOF, &GPIO_InitStructure);
按以上方式更改即可,带UCOSIII或裸板都可运行,亲测有效。
|
|