Skip to content

Commit 51edc9c

Browse files
committed
[bsp] add n32 pwm driver
1 parent 9a6d515 commit 51edc9c

36 files changed

Lines changed: 2775 additions & 997 deletions

File tree

bsp/n32/libraries/n32_drivers/SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ if GetDepend(['RT_USING_RTC']):
4545
if GetDepend(['RT_USING_WDT']):
4646
src += ['drv_wdt.c']
4747

48+
if GetDepend('BSP_USING_PWM'):
49+
src += ['drv_base.c']
50+
51+
if GetDepend(['BSP_USING_PWM']):
52+
src += ['drv_pwm.c']
53+
4854
path = [cwd]
4955
path += [cwd + '/config']
5056

bsp/n32/n32g43xcl-stb/.config

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ CONFIG_RT_USING_DEVICE=y
179179
CONFIG_RT_USING_CONSOLE=y
180180
CONFIG_RT_CONSOLEBUF_SIZE=128
181181
CONFIG_RT_CONSOLE_DEVICE_NAME="usart1"
182-
CONFIG_RT_VER_NUM=0x50201
182+
CONFIG_RT_VER_NUM=0x50300
183183
# CONFIG_RT_USING_STDC_ATOMIC is not set
184184
CONFIG_RT_BACKTRACE_LEVEL_MAX_NR=32
185185
# end of RT-Thread Kernel
@@ -267,6 +267,7 @@ CONFIG_RT_USING_RTC=y
267267
# CONFIG_RT_USING_SOFT_RTC is not set
268268
# CONFIG_RT_USING_SDIO is not set
269269
CONFIG_RT_USING_SPI=y
270+
CONFIG_RT_USING_SPI_ISR=y
270271
# CONFIG_RT_USING_SOFT_SPI is not set
271272
# CONFIG_RT_USING_QSPI is not set
272273
# CONFIG_RT_USING_SPI_MSD is not set
@@ -361,8 +362,6 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
361362
# CONFIG_RT_USING_RT_LINK is not set
362363
# end of Utilities
363364

364-
# CONFIG_RT_USING_VBUS is not set
365-
366365
#
367366
# Using USB legacy version
368367
#
@@ -371,6 +370,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
371370
# end of Using USB legacy version
372371

373372
# CONFIG_RT_USING_FDT is not set
373+
# CONFIG_RT_USING_RUST is not set
374374
# end of RT-Thread Components
375375

376376
#
@@ -738,6 +738,7 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
738738
# CONFIG_PKG_USING_R_RHEALSTONE is not set
739739
# CONFIG_PKG_USING_HEARTBEAT is not set
740740
# CONFIG_PKG_USING_MICRO_ROS_RTTHREAD_PACKAGE is not set
741+
# CONFIG_PKG_USING_CHERRYECAT is not set
741742
# end of system packages
742743

743744
#
@@ -894,6 +895,12 @@ CONFIG_RT_LIBC_TZ_DEFAULT_SEC=0
894895
# CONFIG_PKG_USING_GD32_ARM_CMSIS_DRIVER is not set
895896
# CONFIG_PKG_USING_GD32_ARM_SERIES_DRIVER is not set
896897
# end of GD32 Drivers
898+
899+
#
900+
# HPMicro SDK
901+
#
902+
# CONFIG_PKG_USING_HPM_SDK is not set
903+
# end of HPMicro SDK
897904
# end of HAL & SDK Drivers
898905

899906
#

bsp/n32/n32g43xcl-stb/board/Kconfig

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,104 @@ menu "On-chip Peripheral Drivers"
164164
select RT_USING_CAN
165165
default n
166166

167+
#-----------------------------PWM----------------------------------
168+
menuconfig BSP_USING_PWM
169+
bool "Enable PWM"
170+
default n
171+
select RT_USING_PWM
172+
select RT_USING_HWTIMER
173+
if BSP_USING_PWM
174+
menuconfig BSP_USING_TIM1_PWM
175+
bool "Enable TIM1 output PWM"
176+
default n
177+
# --------------selcet remap-----------------
178+
if BSP_USING_TIM1_PWM
179+
choice
180+
prompt "Select Pin"
181+
default TIM1_REMAP_0
182+
config TIM1_REMAP_0
183+
bool "PA8 PA9 PA10 PA11"
184+
config TIM1_REMAP_3
185+
bool "PE9 PE11 PE13 PE14"
186+
endchoice
187+
# -----------tim chanle enable-----------------
188+
config BSP_USING_TIM1_PWM_CH1
189+
bool "Enable TIM1 CH1"
190+
default n
191+
config BSP_USING_TIM1_PWM_CH2
192+
bool "Enable TIM1 CH2"
193+
default n
194+
config BSP_USING_TIM1_PWM_CH3
195+
bool "Enable TIM1 CH3"
196+
default n
197+
config BSP_USING_TIM1_PWM_CH4
198+
bool "Enable TIM1 CH4"
199+
default n
200+
endif
201+
202+
203+
menuconfig BSP_USING_TIM2_PWM
204+
bool "Enable TIM2 output PWM"
205+
default n
206+
if BSP_USING_TIM2_PWM
207+
choice
208+
prompt "Select Pin"
209+
default TIM2_REMAP_0
210+
config TIM2_REMAP_0
211+
bool "PA0 PA1 PA2 PA3"
212+
config TIM2_REMAP_1
213+
bool "PA15 PB3 PA2 PA3"
214+
config TIM2_REMAP_2
215+
bool "PA0 PA1 PB10 PB11"
216+
config TIM2_REMAP_3
217+
bool "PA15 PB3 PB10 PB11"
218+
endchoice
219+
220+
config BSP_USING_TIM2_PWM_CH0
221+
bool "Enable TIM2 CH1"
222+
default n
223+
config BSP_USING_TIM2_PWM_CH1
224+
bool "Enable TIM2 CH2"
225+
default n
226+
config BSP_USING_TIM2_PWM_CH2
227+
bool "Enable TIM2 CH3"
228+
default n
229+
config BSP_USING_TIM2_PWM_CH3
230+
bool "Enable TIM2 CH4"
231+
default n
232+
endif
233+
234+
menuconfig BSP_USING_TIM3_PWM
235+
bool "Enable TIM3 output PWM"
236+
default n
237+
if BSP_USING_TIM3_PWM
238+
choice
239+
prompt "Select Pin"
240+
default TIM3_REMAP_0
241+
config TIM3_REMAP_0
242+
bool "PA6 PA7 PB0 PB1"
243+
config TIM3_REMAP_2
244+
bool "PB4 PB5 PB0 PB1"
245+
config TIM3_REMAP_3
246+
bool "PC6 PC7 PC8 PC9"
247+
endchoice
248+
249+
config BSP_USING_TIM3_PWM_CH0
250+
bool "Enable TIM3 CH1"
251+
default n
252+
config BSP_USING_TIM3_PWM_CH1
253+
bool "Enable TIM3 CH2"
254+
default n
255+
config BSP_USING_TIM3_PWM_CH2
256+
bool "Enable TIM3 CH3"
257+
default n
258+
config BSP_USING_TIM3_PWM_CH3
259+
bool "Enable TIM3 CH3"
260+
default n
261+
endif#BSP_USING_TIM3_PWM
262+
263+
endif#BSP_USING_PWM
264+
167265
rsource "../../libraries/n32_drivers/Kconfig"
168266

169267
endmenu

0 commit comments

Comments
 (0)