diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/pwm_config.h index b8ef2d37f7..3306a20b25 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/pwm_config.h @@ -1,11 +1,12 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-12-13 zylx first version + * 2022-04-14 Miaowulue add PWM1 */ #ifndef __PWM_CONFIG_H__ @@ -17,6 +18,17 @@ extern "C" { #endif +#ifdef BSP_USING_PWM1 +#ifndef PWM1_CONFIG +#define PWM1_CONFIG \ + { \ + .tim_handle.Instance = TIM1, \ + .name = "pwm1", \ + .channel = 0 \ + } +#endif /* PWM1_CONFIG */ +#endif /* BSP_USING_PWM1 */ + #ifdef BSP_USING_PWM2 #ifndef PWM2_CONFIG #define PWM2_CONFIG \ diff --git a/bsp/stm32/libraries/STM32H7xx_HAL/SConscript b/bsp/stm32/libraries/STM32H7xx_HAL/SConscript index 0f33bf8a0d..fd0359b3e9 100644 --- a/bsp/stm32/libraries/STM32H7xx_HAL/SConscript +++ b/bsp/stm32/libraries/STM32H7xx_HAL/SConscript @@ -104,6 +104,9 @@ if GetDepend(['BSP_USING_LTDC']): src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_ltdc.c'] src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma2d.c'] +if GetDepend(['BSP_USING_DCMI']): + src += ['STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dcmi.c'] + path = [cwd + '/STM32H7xx_HAL_Driver/Inc', cwd + '/CMSIS/Device/ST/STM32H7xx/Include', cwd + '/CMSIS/Include'] diff --git a/bsp/stm32/stm32h743-openmv-h7plus/.config b/bsp/stm32/stm32h743-openmv-h7plus/.config index 340b1ae76a..7fec2e93af 100644 --- a/bsp/stm32/stm32h743-openmv-h7plus/.config +++ b/bsp/stm32/stm32h743-openmv-h7plus/.config @@ -155,7 +155,7 @@ CONFIG_RT_USING_SERIAL_V1=y CONFIG_RT_SERIAL_USING_DMA=y CONFIG_RT_SERIAL_RB_BUFSZ=64 # CONFIG_RT_USING_CAN is not set -# CONFIG_RT_USING_HWTIMER is not set +CONFIG_RT_USING_HWTIMER=y # CONFIG_RT_USING_CPUTIME is not set CONFIG_RT_USING_I2C=y # CONFIG_RT_I2C_DEBUG is not set @@ -165,7 +165,7 @@ CONFIG_RT_USING_I2C_BITOPS=y CONFIG_RT_USING_PIN=y # CONFIG_RT_USING_ADC is not set # CONFIG_RT_USING_DAC is not set -# CONFIG_RT_USING_PWM is not set +CONFIG_RT_USING_PWM=y # CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NAND is not set # CONFIG_RT_USING_PM is not set @@ -493,6 +493,7 @@ CONFIG_RT_USING_POSIX_FS=y # CONFIG_PKG_USING_FDT is not set # CONFIG_PKG_USING_CBOX is not set # CONFIG_PKG_USING_SNOWFLAKE is not set +# CONFIG_PKG_USING_HASH_MATCH is not set # # system packages @@ -762,3 +763,6 @@ CONFIG_BSP_USING_I2C1=y CONFIG_BSP_I2C1_SCL_PIN=24 CONFIG_BSP_I2C1_SDA_PIN=25 # CONFIG_BSP_USING_I2C2 is not set +CONFIG_BSP_USING_PWM=y +CONFIG_BSP_USING_PWM1=y +CONFIG_BSP_USING_PWM1_CH1=y diff --git a/bsp/stm32/stm32h743-openmv-h7plus/board/Kconfig b/bsp/stm32/stm32h743-openmv-h7plus/board/Kconfig index 9cd0879e86..5bfdcdb3e3 100644 --- a/bsp/stm32/stm32h743-openmv-h7plus/board/Kconfig +++ b/bsp/stm32/stm32h743-openmv-h7plus/board/Kconfig @@ -93,6 +93,9 @@ menu "Hardware Drivers Config" select BSP_USING_DCMI select BSP_USING_I2C select BSP_USING_I2C1 + select BSP_USING_PWM + select BSP_USING_PWM1 + select BSP_USING_PWM1_CH1 default n config BSP_USING_DCMI @@ -137,6 +140,21 @@ menu "Hardware Drivers Config" endif endif + menuconfig BSP_USING_PWM + bool "Enable PWM" + default n + select RT_USING_PWM + if BSP_USING_PWM + menuconfig BSP_USING_PWM1 + bool "Enable timer1 output pwm" + default n + if BSP_USING_PWM1 + config BSP_USING_PWM1_CH1 + bool "Enable PWM1 channel1" + default n + endif + endif + endmenu endmenu diff --git a/bsp/stm32/stm32h743-openmv-h7plus/board/SConscript b/bsp/stm32/stm32h743-openmv-h7plus/board/SConscript index ad0d466516..6c95f28665 100644 --- a/bsp/stm32/stm32h743-openmv-h7plus/board/SConscript +++ b/bsp/stm32/stm32h743-openmv-h7plus/board/SConscript @@ -18,15 +18,13 @@ path += [cwd + '/CubeMX_Config/Core/Inc'] path += [cwd + '/ports'] if GetDepend(['BSP_USING_QSPI_FLASH']): - src += Glob('ports/drv_qspi_flash.c') + src += ['ports/drv_qspi_flash.c'] if GetDepend(['BSP_USING_SDMMC']): - src += Glob('ports/drv_sdio.c') + src += ['ports/drv_sdio.c'] if GetDepend(['BSP_USING_OV5640']): - src += Glob('ports/drv_ov5640.c') - src += [startup_path_prefix + '/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c'] + src += ['ports/drv_ov5640.c'] if GetDepend(['BSP_USING_DCMI']): - src += Glob('ports/drv_dcmi.c') - src += [startup_path_prefix + '/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dcmi.c'] + src += ['ports/drv_dcmi.c'] if rtconfig.CROSS_TOOL == 'gcc': src += [startup_path_prefix + '/STM32H7xx_HAL/CMSIS/Device/ST/STM32H7xx/Source/Templates/gcc/startup_stm32h743xx.s'] diff --git a/bsp/stm32/stm32h743-openmv-h7plus/rtconfig.h b/bsp/stm32/stm32h743-openmv-h7plus/rtconfig.h index afd5c88440..b9f6fe5cce 100644 --- a/bsp/stm32/stm32h743-openmv-h7plus/rtconfig.h +++ b/bsp/stm32/stm32h743-openmv-h7plus/rtconfig.h @@ -98,9 +98,11 @@ #define RT_USING_SERIAL_V1 #define RT_SERIAL_USING_DMA #define RT_SERIAL_RB_BUFSZ 64 +#define RT_USING_HWTIMER #define RT_USING_I2C #define RT_USING_I2C_BITOPS #define RT_USING_PIN +#define RT_USING_PWM #define RT_USING_RTC #define RT_USING_SDIO #define RT_SDIO_STACK_SIZE 512 @@ -255,5 +257,8 @@ #define BSP_I2C1_SCL_PIN 24 #define BSP_I2C1_SDA_PIN 25 +#define BSP_USING_PWM +#define BSP_USING_PWM1 +#define BSP_USING_PWM1_CH1 #endif