Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
bb4fc9cb
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,发现更多精彩内容 >>
未验证
提交
bb4fc9cb
编写于
3月 20, 2022
作者:
mysterywolf
提交者:
GitHub
3月 20, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[stm32 pandora] support backlight with brightness adjustable (#5691)
上级
9ee5940f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
9 deletion
+23
-9
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
+3
-0
bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c
bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c
+19
-9
bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.h
bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.h
+1
-0
未找到文件。
bsp/stm32/stm32l475-atk-pandora/board/Kconfig
浏览文件 @
bb4fc9cb
...
...
@@ -57,6 +57,9 @@ menu "Onboard Peripheral Drivers"
select BSP_USING_SPI
select BSP_USING_SPI3
select BSP_SPI3_TX_USING_DMA
select BSP_USING_PWM
select BSP_USING_PWM4
select BSP_USING_PWM4_CH2
default n
config BSP_USING_LCD_SAMPLE
...
...
bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c
浏览文件 @
bb4fc9cb
...
...
@@ -24,7 +24,6 @@
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#define LCD_PWR_PIN GET_PIN(B, 7)
#define LCD_DC_PIN GET_PIN(B, 4)
#define LCD_RES_PIN GET_PIN(B, 6)
...
...
@@ -120,9 +119,6 @@ static void lcd_gpio_init(void)
rt_pin_mode
(
LCD_DC_PIN
,
PIN_MODE_OUTPUT
);
rt_pin_mode
(
LCD_RES_PIN
,
PIN_MODE_OUTPUT
);
rt_pin_mode
(
LCD_PWR_PIN
,
PIN_MODE_OUTPUT
);
rt_pin_write
(
LCD_PWR_PIN
,
PIN_LOW
);
rt_pin_write
(
LCD_RES_PIN
,
PIN_LOW
);
//wait at least 100ms for reset
...
...
@@ -133,8 +129,10 @@ static void lcd_gpio_init(void)
static
int
rt_hw_lcd_init
(
void
)
{
__HAL_RCC_GPIOD_CLK_ENABLE
();
rt_hw_spi_device_attach
(
"spi3"
,
"spi30"
,
GPIOD
,
GPIO_PIN_7
);
lcd_gpio_init
();
/* Memory Data Access Control */
lcd_write_cmd
(
0x36
);
lcd_write_data
(
0x00
);
...
...
@@ -213,7 +211,7 @@ static int rt_hw_lcd_init(void)
rt_thread_mdelay
(
100
);
/* display on */
rt_pin_write
(
LCD_PWR_PIN
,
PIN_HIGH
);
lcd_display_on
(
);
lcd_write_cmd
(
0x29
);
return
RT_EOK
;
...
...
@@ -236,27 +234,39 @@ void lcd_set_color(rt_uint16_t back, rt_uint16_t fore)
}
#endif
/* BSP_USING_LVGL */
void
lcd_display_brightness
(
rt_uint8_t
percent
)
{
struct
rt_device_pwm
*
pwm_dev
;
pwm_dev
=
(
struct
rt_device_pwm
*
)
rt_device_find
(
"pwm4"
);
if
(
pwm_dev
!=
RT_NULL
)
{
rt_pwm_set
(
pwm_dev
,
2
,
1000000
,
percent
*
10000
);
/* PWM4 CH2 with 1000Hz */
rt_pwm_enable
(
pwm_dev
,
2
);
}
}
void
lcd_display_on
(
void
)
{
rt_pin_write
(
LCD_PWR_PIN
,
PIN_HIGH
);
lcd_display_brightness
(
100
);
}
void
lcd_display_off
(
void
)
{
rt_pin_write
(
LCD_PWR_PIN
,
PIN_LOW
);
lcd_display_brightness
(
0
);
}
/* lcd enter the minimum power consumption mode and backlight off. */
void
lcd_enter_sleep
(
void
)
{
rt_pin_write
(
LCD_PWR_PIN
,
PIN_LOW
);
lcd_display_off
(
);
rt_thread_mdelay
(
5
);
lcd_write_cmd
(
0x10
);
}
/* lcd turn off sleep mode and backlight on. */
void
lcd_exit_sleep
(
void
)
{
rt_pin_write
(
LCD_PWR_PIN
,
PIN_HIGH
);
lcd_display_on
(
);
rt_thread_mdelay
(
5
);
lcd_write_cmd
(
0x11
);
rt_thread_mdelay
(
120
);
...
...
bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.h
浏览文件 @
bb4fc9cb
...
...
@@ -55,6 +55,7 @@ void lcd_enter_sleep(void);
void
lcd_exit_sleep
(
void
);
void
lcd_display_on
(
void
);
void
lcd_display_off
(
void
);
void
lcd_display_brightness
(
rt_uint8_t
percent
);
void
lcd_address_set
(
rt_uint16_t
x1
,
rt_uint16_t
y1
,
rt_uint16_t
x2
,
rt_uint16_t
y2
);
void
lcd_fill_array
(
rt_uint16_t
x_start
,
rt_uint16_t
y_start
,
rt_uint16_t
x_end
,
rt_uint16_t
y_end
,
void
*
pcolor
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录