Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
RT-Thread
rt-thread
提交
4aa38e3d
R
rt-thread
项目概览
RT-Thread
/
rt-thread
9 个月 前同步成功
通知
752
Star
8909
Fork
4735
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
提交
4aa38e3d
编写于
3月 30, 2023
作者:
R
Rbb666
提交者:
guo
3月 30, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Infineon]Add slider driver demo
上级
8552d061
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
39 deletion
+43
-39
bsp/Infineon/libraries/HAL_Drivers/drv_gpio.c
bsp/Infineon/libraries/HAL_Drivers/drv_gpio.c
+7
-7
bsp/Infineon/libraries/HAL_Drivers/drv_pwm.c
bsp/Infineon/libraries/HAL_Drivers/drv_pwm.c
+11
-20
bsp/Infineon/libraries/HAL_Drivers/drv_pwm.h
bsp/Infineon/libraries/HAL_Drivers/drv_pwm.h
+13
-4
bsp/Infineon/psoc6-evaluationkit-062S2/applications/main.c
bsp/Infineon/psoc6-evaluationkit-062S2/applications/main.c
+1
-1
bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig
bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig
+9
-5
bsp/Infineon/psoc6-evaluationkit-062S2/board/ports/slider_sample.c
...eon/psoc6-evaluationkit-062S2/board/ports/slider_sample.c
+2
-2
未找到文件。
bsp/Infineon/libraries/HAL_Drivers/drv_gpio.c
浏览文件 @
4aa38e3d
...
...
@@ -95,7 +95,7 @@ static void irq_callback(void *callback_arg, cyhal_gpio_event_t event)
cyhal_gpio_callback_data_t
irq_cb_data
;
static
void
ifx_pin_mode
(
rt_device_t
dev
,
rt_base_t
pin
,
rt_
base
_t
mode
)
static
void
ifx_pin_mode
(
rt_device_t
dev
,
rt_base_t
pin
,
rt_
uint8
_t
mode
)
{
rt_uint16_t
gpio_pin
;
...
...
@@ -132,7 +132,7 @@ static void ifx_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode)
}
}
static
void
ifx_pin_write
(
rt_device_t
dev
,
rt_base_t
pin
,
rt_
base
_t
value
)
static
void
ifx_pin_write
(
rt_device_t
dev
,
rt_base_t
pin
,
rt_
uint8
_t
value
)
{
rt_uint16_t
gpio_pin
;
...
...
@@ -148,7 +148,7 @@ static void ifx_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value)
cyhal_gpio_write
(
gpio_pin
,
value
);
}
static
int
ifx_pin_read
(
rt_device_t
dev
,
rt_base_t
pin
)
static
rt_int8_t
ifx_pin_read
(
struct
rt_device
*
device
,
rt_base_t
pin
)
{
rt_uint16_t
gpio_pin
;
...
...
@@ -164,8 +164,8 @@ static int ifx_pin_read(rt_device_t dev, rt_base_t pin)
return
cyhal_gpio_read
(
gpio_pin
);
}
static
rt_err_t
ifx_pin_attach_irq
(
struct
rt_device
*
device
,
rt_
int32
_t
pin
,
rt_uint
32
_t
mode
,
void
(
*
hdr
)(
void
*
args
),
void
*
args
)
static
rt_err_t
ifx_pin_attach_irq
(
struct
rt_device
*
device
,
rt_
base
_t
pin
,
rt_uint
8
_t
mode
,
void
(
*
hdr
)(
void
*
args
),
void
*
args
)
{
rt_uint16_t
gpio_port
;
rt_uint16_t
gpio_pin
;
...
...
@@ -207,7 +207,7 @@ static rt_err_t ifx_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
return
RT_EOK
;
}
static
rt_err_t
ifx_pin_dettach_irq
(
struct
rt_device
*
device
,
rt_
int32
_t
pin
)
static
rt_err_t
ifx_pin_dettach_irq
(
struct
rt_device
*
device
,
rt_
base
_t
pin
)
{
rt_uint16_t
gpio_port
;
rt_uint16_t
gpio_pin
;
...
...
@@ -241,7 +241,7 @@ static rt_err_t ifx_pin_dettach_irq(struct rt_device *device, rt_int32_t pin)
}
static
rt_err_t
ifx_pin_irq_enable
(
struct
rt_device
*
device
,
rt_base_t
pin
,
rt_uint
32
_t
enabled
)
rt_uint
8
_t
enabled
)
{
rt_uint16_t
gpio_port
;
rt_uint16_t
gpio_pin
;
...
...
bsp/Infineon/libraries/HAL_Drivers/drv_pwm.c
浏览文件 @
4aa38e3d
...
...
@@ -31,8 +31,8 @@ struct ifx_pwm
static
struct
ifx_pwm
ifx_pwm_obj
[]
=
{
#ifdef BSP_USING_PWM0_PORT
13
PWM0_CH
3_PORT13
_CONFIG
,
#ifdef BSP_USING_PWM0_PORT
0
PWM0_CH
0_PORT0
_CONFIG
,
#endif
#ifdef BSP_USING_PWM0_PORT2
...
...
@@ -58,6 +58,10 @@ static struct ifx_pwm ifx_pwm_obj[] =
#ifdef BSP_USING_PWM0_PORT12
PWM0_CH7_PORT12_CONFIG
,
#endif
#ifdef BSP_USING_PWM0_PORT13
PWM0_CH3_PORT13_CONFIG
,
#endif
};
static
rt_err_t
drv_pwm_enable
(
cyhal_pwm_t
*
htim
,
struct
rt_pwm_configuration
*
configuration
,
rt_bool_t
enable
)
...
...
@@ -165,26 +169,13 @@ static rt_err_t ifx_hw_pwm_init(struct ifx_pwm *device)
RT_ASSERT
(
device
!=
RT_NULL
);
/* config pwm channel */
if
(
device
->
channel
==
0x03
)
if
(
cyhal_pwm_init_adv
(
device
->
pwm_obj
,
device
->
gpio
,
NC
,
CYHAL_PWM_LEFT_ALIGN
,
true
,
0u
,
false
,
RT_NULL
)
!=
RT_EOK
)
{
if
(
cyhal_pwm_init_adv
(
device
->
pwm_obj
,
device
->
gpio
,
NC
,
CYHAL_PWM_LEFT_ALIGN
,
true
,
0u
,
false
,
RT_NULL
)
!=
RT_EOK
)
{
LOG_E
(
"%s channel3 config failed"
,
device
->
name
);
result
=
-
RT_ERROR
;
goto
__exit
;
}
}
/* config pwm channel */
if
(
device
->
channel
==
0x07
)
{
if
(
cyhal_pwm_init_adv
(
device
->
pwm_obj
,
device
->
gpio
,
NC
,
CYHAL_PWM_LEFT_ALIGN
,
true
,
0u
,
false
,
RT_NULL
)
!=
RT_EOK
)
{
LOG_E
(
"%s channel7 config failed"
,
device
->
name
);
result
=
-
RT_ERROR
;
goto
__exit
;
}
LOG_E
(
"%s channel%d config failed"
,
device
->
name
,
device
->
channel
);
result
=
-
RT_ERROR
;
goto
__exit
;
}
__exit:
return
result
;
}
...
...
bsp/Infineon/libraries/HAL_Drivers/drv_pwm.h
浏览文件 @
4aa38e3d
...
...
@@ -22,12 +22,12 @@ extern "C"
#define MAX_PERIOD 65535
#ifdef BSP_USING_PWM0
#ifndef PWM0_CH
3_PORT13
_CONFIG
#define PWM0_CH
3_PORT13_CONFIG
\
#ifndef PWM0_CH
0_PORT0
_CONFIG
#define PWM0_CH
0_PORT0_CONFIG
\
{ \
.name = "pwm0", \
.channel =
3
, \
.gpio = GET_PIN(
13, 7),
\
.channel =
0
, \
.gpio = GET_PIN(
0, 0),
\
}
#endif
/* PWM0_CH7_PORT2_CONFIG */
...
...
@@ -84,6 +84,15 @@ extern "C"
.gpio = GET_PIN(12, 6), \
}
#endif
/* PWM0_CH7_PORT12_CONFIG */
#ifndef PWM0_CH3_PORT13_CONFIG
#define PWM0_CH3_PORT13_CONFIG \
{ \
.name = "pwm0", \
.channel = 3, \
.gpio = GET_PIN(13, 7), \
}
#endif
/* PWM0_CH3_PORT13_CONFIG */
#endif
/* BSP_USING_PWM0 */
#ifdef __cplusplus
...
...
bsp/Infineon/psoc6-evaluationkit-062S2/applications/main.c
浏览文件 @
4aa38e3d
...
...
@@ -13,7 +13,7 @@
#include "drv_gpio.h"
#define LED_PIN GET_PIN(0,
0
)
#define LED_PIN GET_PIN(0,
1
)
int
main
(
void
)
{
...
...
bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig
浏览文件 @
4aa38e3d
...
...
@@ -60,12 +60,12 @@ menu "On-chip Peripheral Drivers"
bool "Enable timer0 output pwm"
default n
if BSP_USING_PWM0
menuconfig BSP_USING_PWM0_CH
3
bool "Enable PWM0 channel
3
"
menuconfig BSP_USING_PWM0_CH
0
bool "Enable PWM0 channel
0
"
default n
if BSP_USING_PWM0_CH
3
config BSP_USING_PWM0_PORT
13
bool "Enable PWM0-PORT
13
output pwm"
if BSP_USING_PWM0_CH
0
config BSP_USING_PWM0_PORT
0
bool "Enable PWM0-PORT
0
output pwm"
default n
endif
menuconfig BSP_USING_PWM0_CH7
...
...
@@ -263,6 +263,10 @@ menu "Board extended module Drivers"
config BSP_USING_SLIDER
bool "Enable Slider Demo"
select BSP_USING_PWM
select BSP_USING_PWM0
select BSP_USING_PWM0_CH0
select BSP_USING_PWM0_PORT0
default n
menuconfig BSP_USING_RW007
...
...
bsp/Infineon/psoc6-evaluationkit-062S2/board/ports/slider_sample.c
浏览文件 @
4aa38e3d
...
...
@@ -44,7 +44,7 @@ static rt_thread_t sld_thread = RT_NULL;
#error You need enable PWM to use this sample
#else
#define PWM_DEV_NAME "pwm0"
#define PWM_DEV_CHANNEL
3
#define PWM_DEV_CHANNEL
0
static
struct
rt_device_pwm
*
pwm_dev
;
#endif
...
...
@@ -128,7 +128,7 @@ void Slider_Init(void)
return
;
}
#ifdef BSP_USING_PWM0_PORT
13
#ifdef BSP_USING_PWM0_PORT
0
/* Initiate PWM*/
pwm_dev
=
(
struct
rt_device_pwm
*
)
rt_device_find
(
PWM_DEV_NAME
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录