mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-02 14:23:19 +08:00
[bsp][Novosense] implemented EPWM driver
This commit is contained in:
@@ -35,6 +35,9 @@ if GetDepend('BSP_USING_WDT'):
|
||||
if GetDepend('BSP_USING_WWDG'):
|
||||
src += ['drv_wwdg.c']
|
||||
|
||||
if GetDepend('BSP_USING_EPWM'):
|
||||
src += ['drv_epwm.c']
|
||||
|
||||
group = DefineGroup('HAL_Drivers', src, depend = [''], CPPPATH = path)
|
||||
|
||||
Return('group')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
/**************************************************************************//**
|
||||
*
|
||||
* @copyright (C) 2026 Novosense Technology Corp. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2026-6-15 Eric First version
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __DRV_EPWM_H__
|
||||
#define __DRV_EPWM_H__
|
||||
|
||||
#include <rtdef.h>
|
||||
|
||||
/* custom command to configure phase */
|
||||
#define PWM_CMD_EXT_SET_SLAVE_PHASE (RT_DEVICE_CTRL_BASE(PWM) + 99)
|
||||
|
||||
#define EPWM_PIN_INFO(epwm_port_a, epwm_pin_a, pin_mux_a, \
|
||||
epwm_port_b, epwm_pin_b, pin_mux_b) \
|
||||
{ \
|
||||
.port_a = epwm_port_a, \
|
||||
.pin_a = epwm_pin_a, \
|
||||
.mux_a = pin_mux_a, \
|
||||
.port_b = epwm_port_b, \
|
||||
.pin_b = epwm_pin_b, \
|
||||
.mux_b = pin_mux_b \
|
||||
}
|
||||
|
||||
#define EPWM_DRV_INIT(num, cnt_mode, clk_div, hs_clk_div) \
|
||||
{ \
|
||||
.name = "epwm"#num , \
|
||||
.instance = EPWM##num, \
|
||||
.count_mode = cnt_mode, \
|
||||
.clock_div = clk_div, \
|
||||
.hs_clock_div = hs_clk_div \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief EPWMx channel
|
||||
*/
|
||||
enum
|
||||
{
|
||||
EPWMX_A = 0,
|
||||
EPWMX_B
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief EPWMx phase configuration
|
||||
*/
|
||||
struct rt_epwm_slave_phase_ext
|
||||
{
|
||||
/* EPWM master reference device,
|
||||
slave pwm phase compare with this master devcie */
|
||||
rt_device_t master_dev;
|
||||
/* unit: degree, 0~360 */
|
||||
rt_uint32_t phase_angle;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -22,4 +22,27 @@ devices.wdt:
|
||||
- CONFIG_BSP_USING_WDT=y
|
||||
- CONFIG_BSP_USING_IWDG1=y
|
||||
- CONFIG_BSP_USING_IWDG2=y
|
||||
- CONFIG_BSP_USING_WWDG=y
|
||||
- CONFIG_BSP_USING_WWDG=y
|
||||
devices.epwm:
|
||||
<<: *scons
|
||||
kconfig:
|
||||
- CONFIG_RT_USING_PWM=y
|
||||
- CONFIG_BSP_USING_EPWM=y
|
||||
- CONFIG_BSP_USING_EPWM1=y
|
||||
- CONFIG_BSP_USING_EPWM2=y
|
||||
- CONFIG_BSP_USING_EPWM3=y
|
||||
- CONFIG_BSP_USING_EPWM4=y
|
||||
- CONFIG_BSP_USING_EPWM5=y
|
||||
- CONFIG_BSP_USING_EPWM6=y
|
||||
- CONFIG_BSP_USING_EPWM7=y
|
||||
- CONFIG_BSP_USING_EPWM8=y
|
||||
- CONFIG_BSP_USING_EPWM9=y
|
||||
- CONFIG_BSP_USING_EPWM10=y
|
||||
- CONFIG_BSP_USING_EPWM11=y
|
||||
- CONFIG_BSP_USING_EPWM12=y
|
||||
- CONFIG_BSP_USING_EPWM13=y
|
||||
- CONFIG_BSP_USING_EPWM14=y
|
||||
- CONFIG_BSP_USING_EPWM15=y
|
||||
- CONFIG_BSP_USING_EPWM16=y
|
||||
- CONFIG_BSP_USING_EPWM17=y
|
||||
- CONFIG_BSP_USING_EPWM18=y
|
||||
@@ -229,4 +229,82 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_EPWM
|
||||
bool "Enable EPWM"
|
||||
select RT_USING_PWM
|
||||
default n
|
||||
if BSP_USING_EPWM
|
||||
config BSP_USING_EPWM1
|
||||
bool "Enable EPWM1"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM2
|
||||
bool "Enable EPWM2"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM3
|
||||
bool "Enable EPWM3"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM4
|
||||
bool "Enable EPWM4"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM5
|
||||
bool "Enable EPWM5"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM6
|
||||
bool "Enable EPWM6"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM7
|
||||
bool "Enable EPWM7"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM8
|
||||
bool "Enable EPWM8"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM9
|
||||
bool "Enable EPWM9"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM10
|
||||
bool "Enable EPWM10"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM11
|
||||
bool "Enable EPWM11"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM12
|
||||
bool "Enable EPWM12"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM13
|
||||
bool "Enable EPWM13"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM14
|
||||
bool "Enable EPWM14"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM15
|
||||
bool "Enable EPWM15"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM16
|
||||
bool "Enable EPWM16"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM17
|
||||
bool "Enable EPWM17"
|
||||
default n
|
||||
|
||||
config BSP_USING_EPWM18
|
||||
bool "Enable EPWM18"
|
||||
default n
|
||||
endif
|
||||
|
||||
endmenu
|
||||
|
||||
Reference in New Issue
Block a user