diff --git a/bsp/stm32/docs/STM32系列外设驱动添加指南.md b/bsp/stm32/docs/STM32系列外设驱动添加指南.md index 68afb4bfb4..41ffcecd58 100644 --- a/bsp/stm32/docs/STM32系列外设驱动添加指南.md +++ b/bsp/stm32/docs/STM32系列外设驱动添加指南.md @@ -144,3 +144,18 @@ ![adc 编译](figures/adc_config3.png) ![adc 编译](figures/adc_config4.png) + +#### 5.3.4 编码器外设驱动添加说明 + + 1. 打开 STM32CubeMX 工程,设置 TIMER 在 Cube 里的选项,如下图所示: + + ![pulse_encoder CubeMX 配置](figures/pulse_encoder_config1.png) + + 2. 打开 stm32/stm32f407-atk-explorer/board/Kconfig ,添加 Kconfig 选项。选中自己添加的选项后,生成一遍工程,如下图所示: + + ![pulse_encoder Kconfig 配置](figures/pulse_encoder_config2.png) + + 3. 打开工程进行编译,工程会提示 PULSE_ENCODER4_CONFIG 未定义。 可以在 stm32/libraries/HAL_Drivers/config/f4/pulse_encoder_config.h 中进行定义,如下图所示: + + ![pulse_encoder 编译](figures/pulse_encoder_config3.png) + ![pulse_encoder 编译](figures/pulse_encoder_config4.png) diff --git a/bsp/stm32/docs/figures/pulse_encoder_config1.png b/bsp/stm32/docs/figures/pulse_encoder_config1.png new file mode 100644 index 0000000000..dafcc071c3 Binary files /dev/null and b/bsp/stm32/docs/figures/pulse_encoder_config1.png differ diff --git a/bsp/stm32/docs/figures/pulse_encoder_config2.png b/bsp/stm32/docs/figures/pulse_encoder_config2.png new file mode 100644 index 0000000000..2fb5888a35 Binary files /dev/null and b/bsp/stm32/docs/figures/pulse_encoder_config2.png differ diff --git a/bsp/stm32/docs/figures/pulse_encoder_config3.png b/bsp/stm32/docs/figures/pulse_encoder_config3.png new file mode 100644 index 0000000000..b33f7bf074 Binary files /dev/null and b/bsp/stm32/docs/figures/pulse_encoder_config3.png differ diff --git a/bsp/stm32/docs/figures/pulse_encoder_config4.png b/bsp/stm32/docs/figures/pulse_encoder_config4.png new file mode 100644 index 0000000000..c488f03682 Binary files /dev/null and b/bsp/stm32/docs/figures/pulse_encoder_config4.png differ