Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
68c5cc39
R
rt-thread
项目概览
2301_76519099
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
3
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
68c5cc39
编写于
9月 13, 2018
作者:
xuzhuoyi96
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp][stm32f429-disco] Add guiengine support
上级
fd7af6a1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
102 addition
and
20 deletion
+102
-20
bsp/stm32f429-disco/applications/application.c
bsp/stm32f429-disco/applications/application.c
+5
-0
bsp/stm32f429-disco/drivers/drv_lcd.c
bsp/stm32f429-disco/drivers/drv_lcd.c
+79
-19
bsp/stm32f429-disco/drivers/drv_lcd.h
bsp/stm32f429-disco/drivers/drv_lcd.h
+18
-1
未找到文件。
bsp/stm32f429-disco/applications/application.c
浏览文件 @
68c5cc39
...
...
@@ -34,6 +34,8 @@
void
rt_init_thread_entry
(
void
*
parameter
)
{
rt_device_t
lcd
;
/* GDB STUB */
#ifdef RT_USING_GDB
gdb_set_device
(
"uart6"
);
...
...
@@ -59,6 +61,9 @@ void rt_init_thread_entry(void* parameter)
#ifdef RT_USING_FINSH
finsh_system_init
();
#endif
lcd
=
rt_device_find
(
"lcd"
);
rtgui_graphic_set_device
(
lcd
);
rt_gui_demo_init
();
}
int
rt_application_init
()
...
...
bsp/stm32f429-disco/drivers/drv_lcd.c
浏览文件 @
68c5cc39
...
...
@@ -64,6 +64,7 @@ static RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
static
uint32_t
ActiveLayer
=
0
;
//LCD_DrvTypeDef *LcdDrv;
SPI_HandleTypeDef
hspi5
;
static
SPI_HandleTypeDef
SpiHandle
;
void
delay_us
(
rt_uint32_t
nus
)
{
...
...
@@ -86,6 +87,28 @@ void delay_ms(rt_uint32_t nms)
}
}
/**
* @brief SPI MSP Init.
* @param hspi: SPI handle
*/
static
void
SPIx_MspInit
(
SPI_HandleTypeDef
*
hspi
)
{
GPIO_InitTypeDef
GPIO_InitStructure
;
/* Enable SPIx clock */
DISCOVERY_SPIx_CLK_ENABLE
();
/* Enable DISCOVERY_SPI GPIO clock */
DISCOVERY_SPIx_GPIO_CLK_ENABLE
();
/* configure SPI SCK, MOSI and MISO */
GPIO_InitStructure
.
Pin
=
(
DISCOVERY_SPIx_SCK_PIN
|
DISCOVERY_SPIx_MOSI_PIN
|
DISCOVERY_SPIx_MISO_PIN
);
GPIO_InitStructure
.
Mode
=
GPIO_MODE_AF_PP
;
GPIO_InitStructure
.
Pull
=
GPIO_PULLDOWN
;
GPIO_InitStructure
.
Speed
=
GPIO_SPEED_MEDIUM
;
GPIO_InitStructure
.
Alternate
=
DISCOVERY_SPIx_AF
;
HAL_GPIO_Init
(
DISCOVERY_SPIx_GPIO_PORT
,
&
GPIO_InitStructure
);
}
/**
* @brief Selects the LCD Layer.
...
...
@@ -244,29 +267,66 @@ static uint32_t SPIx_Read(uint8_t ReadSize)
/**
* @brief Configures the LCD_SPI interface.
*/
__weak
void
LCD_IO_Init
(
void
)
void
LCD_IO_Init
(
void
)
{
/* Set or Reset the control line */
GPIO_InitTypeDef
GPIO_InitStructure
;
/* Configure NCS in Output Push-Pull mode */
LCD_WRX_GPIO_CLK_ENABLE
();
GPIO_InitStructure
.
Pin
=
LCD_WRX_PIN
;
GPIO_InitStructure
.
Mode
=
GPIO_MODE_OUTPUT_PP
;
GPIO_InitStructure
.
Pull
=
GPIO_NOPULL
;
GPIO_InitStructure
.
Speed
=
GPIO_SPEED_FAST
;
HAL_GPIO_Init
(
LCD_WRX_GPIO_PORT
,
&
GPIO_InitStructure
);
LCD_RDX_GPIO_CLK_ENABLE
();
GPIO_InitStructure
.
Pin
=
LCD_RDX_PIN
;
GPIO_InitStructure
.
Mode
=
GPIO_MODE_OUTPUT_PP
;
GPIO_InitStructure
.
Pull
=
GPIO_NOPULL
;
GPIO_InitStructure
.
Speed
=
GPIO_SPEED_FAST
;
HAL_GPIO_Init
(
LCD_RDX_GPIO_PORT
,
&
GPIO_InitStructure
);
/* Configure the LCD Control pins ----------------------------------------*/
LCD_NCS_GPIO_CLK_ENABLE
();
/* Configure NCS in Output Push-Pull mode */
GPIO_InitStructure
.
Pin
=
LCD_NCS_PIN
;
GPIO_InitStructure
.
Mode
=
GPIO_MODE_OUTPUT_PP
;
GPIO_InitStructure
.
Pull
=
GPIO_NOPULL
;
GPIO_InitStructure
.
Speed
=
GPIO_SPEED_FAST
;
HAL_GPIO_Init
(
LCD_NCS_GPIO_PORT
,
&
GPIO_InitStructure
);
/* Set or Reset the control line */
LCD_CS_LOW
();
LCD_CS_HIGH
();
/* SPI5 parameter configuration*/
hspi5
.
Instance
=
SPI5
;
hspi5
.
Init
.
Mode
=
SPI_MODE_MASTER
;
hspi5
.
Init
.
Direction
=
SPI_DIRECTION_2LINES
;
hspi5
.
Init
.
DataSize
=
SPI_DATASIZE_8BIT
;
hspi5
.
Init
.
CLKPolarity
=
SPI_POLARITY_LOW
;
hspi5
.
Init
.
CLKPhase
=
SPI_PHASE_1EDGE
;
hspi5
.
Init
.
NSS
=
SPI_NSS_SOFT
;
hspi5
.
Init
.
BaudRatePrescaler
=
SPI_BAUDRATEPRESCALER_16
;
hspi5
.
Init
.
FirstBit
=
SPI_FIRSTBIT_MSB
;
hspi5
.
Init
.
TIMode
=
SPI_TIMODE_DISABLE
;
hspi5
.
Init
.
CRCCalculation
=
SPI_CRCCALCULATION_DISABLE
;
hspi5
.
Init
.
CRCPolynomial
=
10
;
if
(
HAL_SPI_Init
(
&
hspi5
)
!=
HAL_OK
)
{
//_Error_Handler(__FILE__, __LINE__);
}
/* SPI configuration -----------------------------------------------------*/
SpiHandle
.
Instance
=
DISCOVERY_SPIx
;
/* SPI baudrate is set to 5.6 MHz (PCLK2/SPI_BaudRatePrescaler = 90/16 = 5.625 MHz)
to verify these constraints:
- ILI9341 LCD SPI interface max baudrate is 10MHz for write and 6.66MHz for read
- l3gd20 SPI interface max baudrate is 10MHz for write/read
- PCLK2 frequency is set to 90 MHz
*/
SpiHandle
.
Init
.
BaudRatePrescaler
=
SPI_BAUDRATEPRESCALER_16
;
/* On STM32F429I-Discovery, LCD ID cannot be read then keep a common configuration */
/* for LCD and GYRO (SPI_DIRECTION_2LINES) */
/* Note: To read a register a LCD, SPI_DIRECTION_1LINE should be set */
SpiHandle
.
Init
.
Direction
=
SPI_DIRECTION_2LINES
;
SpiHandle
.
Init
.
CLKPhase
=
SPI_PHASE_1EDGE
;
SpiHandle
.
Init
.
CLKPolarity
=
SPI_POLARITY_LOW
;
SpiHandle
.
Init
.
CRCCalculation
=
SPI_CRCCALCULATION_DISABLED
;
SpiHandle
.
Init
.
CRCPolynomial
=
7
;
SpiHandle
.
Init
.
DataSize
=
SPI_DATASIZE_8BIT
;
SpiHandle
.
Init
.
FirstBit
=
SPI_FIRSTBIT_MSB
;
SpiHandle
.
Init
.
NSS
=
SPI_NSS_SOFT
;
SpiHandle
.
Init
.
TIMode
=
SPI_TIMODE_DISABLED
;
SpiHandle
.
Init
.
Mode
=
SPI_MODE_MASTER
;
SPIx_MspInit
(
&
SpiHandle
);
HAL_SPI_Init
(
&
SpiHandle
);
}
...
...
bsp/stm32f429-disco/drivers/drv_lcd.h
浏览文件 @
68c5cc39
...
...
@@ -150,7 +150,24 @@
#define LCD_RDX_GPIO_PORT GPIOD
#define LCD_RDX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define LCD_RDX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
/*############################### SPIx #######################################*/
#define DISCOVERY_SPIx SPI5
#define DISCOVERY_SPIx_CLK_ENABLE() __HAL_RCC_SPI5_CLK_ENABLE()
#define DISCOVERY_SPIx_GPIO_PORT GPIOF
/* GPIOF */
#define DISCOVERY_SPIx_AF GPIO_AF5_SPI5
#define DISCOVERY_SPIx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define DISCOVERY_SPIx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#define DISCOVERY_SPIx_SCK_PIN GPIO_PIN_7
/* PF.07 */
#define DISCOVERY_SPIx_MISO_PIN GPIO_PIN_8
/* PF.08 */
#define DISCOVERY_SPIx_MOSI_PIN GPIO_PIN_9
/* PF.09 */
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
on accurate values, they just guarantee that the application will not remain
stuck if the SPI communication is corrupted.
You may modify these timeout values depending on CPU frequency and application
conditions (interrupts routines ...). */
#define SPIx_TIMEOUT_MAX ((uint32_t)0x1000)
int
rt_lcd_init
(
void
);
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录