mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-21 01:07:18 +08:00
[bsp][ch32v307]补全PWM设备,并为每个PWM设备添加条件编译,减少代码量 (#6548)
* 新增硬件定时器功能 * 新增定时器功能 * Update Kconfig * Update bsp/wch/risc-v/Libraries/ch32_drivers/drv_hwtimer.h Co-authored-by: Man, Jianting (Meco) <920369182@qq.com> * Update Kconfig * 添加剩余的PWM设备,并为每个PWM设备添加条件编译,减少代码量 * Update drv_pwm.c * 根据建议进行修改 * 已根据建议修改 * Update bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c Co-authored-by: Man, Jianting (Meco) <920369182@qq.com> * Update bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h Co-authored-by: Man, Jianting (Meco) <920369182@qq.com> * Update bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.c Co-authored-by: Man, Jianting (Meco) <920369182@qq.com> Co-authored-by: Man, Jianting (Meco) <920369182@qq.com>
This commit is contained in:
parent
642ba3bc93
commit
11f52eebcf
File diff suppressed because it is too large
Load Diff
40
bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h
Normal file
40
bsp/wch/risc-v/Libraries/ch32_drivers/drv_pwm.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-10-20 MXH the first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_PWM_H__
|
||||
#define __DRV_PWM_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#ifdef BSP_USING_PWM
|
||||
#include "ch32v30x_tim.h"
|
||||
#include <drivers/rt_drv_pwm.h>
|
||||
#include <drivers/hwtimer.h>
|
||||
#include <board.h>
|
||||
|
||||
#ifndef ITEM_NUM
|
||||
#define ITEM_NUM(items) sizeof(items) / sizeof(items[0])
|
||||
#endif
|
||||
|
||||
#define MAX_COUNTER 65535
|
||||
#define MIN_COUNTER 2
|
||||
#define MIN_PULSE 2
|
||||
#define FLAG_NOT_INIT 0xFF
|
||||
|
||||
struct rtdevice_pwm_device
|
||||
{
|
||||
struct rt_device_pwm parent;
|
||||
TIM_TypeDef* periph;
|
||||
rt_uint8_t channel[4];
|
||||
char* name;
|
||||
};
|
||||
|
||||
#endif/* BSP_USING_PWM */
|
||||
|
||||
#endif/* __DRV_PWM_H__ */
|
Loading…
x
Reference in New Issue
Block a user