[RTduino]STM32F411对接RTduino软件包 (#6524)
This commit is contained in:
parent
94221bbdd8
commit
56794960d1
|
@ -2,8 +2,11 @@ from building import *
|
||||||
import os
|
import os
|
||||||
|
|
||||||
cwd = GetCurrentDir()
|
cwd = GetCurrentDir()
|
||||||
src = Glob('*.c')
|
|
||||||
CPPPATH = [cwd]
|
CPPPATH = [cwd]
|
||||||
|
src = ['main.c']
|
||||||
|
|
||||||
|
if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
|
||||||
|
src += ['arduino_main.cpp']
|
||||||
|
|
||||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2022-10-14 liYony first version
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
void setup(void)
|
||||||
|
{
|
||||||
|
/* put your setup code here, to run once: */
|
||||||
|
Serial.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(void)
|
||||||
|
{
|
||||||
|
/* put your main code here, to run repeatedly: */
|
||||||
|
Serial.println("Hello Arduino!");
|
||||||
|
delay(800);
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
# STM32F411 Nucleo开发板的Arduino生态兼容说明
|
||||||
|
|
||||||
|
## 1 RTduino - RT-Thread的Arduino生态兼容层
|
||||||
|
|
||||||
|
STM32F411 Nucleo开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作本BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)。
|
||||||
|
|
||||||
|
### 1.1 如何开启针对本BSP的Arduino生态兼容层
|
||||||
|
|
||||||
|
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
|
||||||
|
|
||||||
|
```Kconfig
|
||||||
|
Hardware Drivers Config --->
|
||||||
|
Onboard Peripheral Drivers --->
|
||||||
|
[*] Compatible with Arduino Ecosystem (RTduino)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2 Arduino引脚排布
|
||||||
|
|
||||||
|
![nucleo-f411-pinout](nucleo-f411-pinout.png)
|
||||||
|
|
||||||
|
该BSP遵照Arduino UNO板的引脚排列方式,详见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)。
|
||||||
|
|
||||||
|
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
|
||||||
|
| ----------- | --------- | ---- | --------------------------------------------- |
|
||||||
|
| 0 (D0) | PA3 | 是 | Serial-Rx,默认被RT-Thread的UART设备框架uart2接管 |
|
||||||
|
| 1 (D1) | PA2 | 是 | Serial-Tx,默认被RT-Thread的UART设备框架uart2接管 |
|
||||||
|
| 2 (D2) | PA10 | 是 | |
|
||||||
|
| 3 (D3) | PB3 | 是 | PWM2-CH2,默认被RT-Thread的PWM设备框架pwm2接管 |
|
||||||
|
| 4 (D4) | PB5 | 是 | |
|
||||||
|
| 5 (D5) | PB4 | 是 | PWM3-CH1,默认被RT-Thread的PWM设备框架pwm3接管 |
|
||||||
|
| 6 (D6) | PB10 | 是 | PWM2-CH3,默认被RT-Thread的PWM设备框架pwm2接管 |
|
||||||
|
| 7 (D7) | PA8 | 是 | |
|
||||||
|
| 8 (D8) | PA9 | 是 | |
|
||||||
|
| 9 (D9) | PC7 | 是 | PWM3-CH2,默认被RT-Thread的PWM设备框架pwm3接管 |
|
||||||
|
| 10 (D10) | PB6 | 是 | PWM4-CH1,默认被RT-Thread的PWM设备框架pwm4接管 |
|
||||||
|
| 11 (D11) | PA7 | 是 | PWM1-CH1N,默认被RT-Thread的PWM设备框架pwm1接管 |
|
||||||
|
| 12 (D12) | PA6 | 是 | |
|
||||||
|
| 13 (D13, ) | PA5 | 是 | 板载用户LED |
|
||||||
|
| 14 (D14) | PB9 | 是 | I2C-SDA,默认被RT-Thread的I2C设备框架i2c1总线接管 |
|
||||||
|
| 15 (D15) | PB8 | 是 | I2C-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
|
||||||
|
| 16 (D16) | PC13 | 是 | 用户按键(左侧蓝色) |
|
||||||
|
| A0 | PA0 | 是 | ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||||
|
| A1 | PA1 | 是 | ADC1-CH1,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||||
|
| A2 | PA4 | 是 | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||||
|
| A3 | PB0 | 是 | ADC1-CH8,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||||
|
| A4 | PC1 | 是 | ADC1-CH11,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||||
|
| A5 | PC0 | 是 | ADC1-CH10,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||||
|
| A6 | -- | | 芯片内部参考电压 ADC1-CH17,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||||
|
| A7 | -- | | 芯片内部温度 ADC1-CH16,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||||
|
|
||||||
|
> 注意:
|
||||||
|
>
|
||||||
|
> 1. 驱动舵机和analogWrite函数要选择不同定时器发生的PWM信号引脚,由于STM32的定时器4个通道需要保持相同的频率,如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite,可能会导致舵机失效。
|
||||||
|
> 2. USART2是Nucleo板的默认串口,理论应对接到了Arduino引脚编号的D0和D1,但是其实际用于串口通信,因此不允许当做普通IO来使用和操作。如果需要将D0、D1与STM32 USART2的引脚相连,需要手动焊接锡桥SB62、SB63。
|
||||||
|
> 3. Nucleo板的Arduino接口中AVDD(即AREF)默认是与VDD相连的,如果需要扩展板提供外部参考电压,需要将SB57锡桥挑开。
|
||||||
|
> 4. D11引脚是PWM反相位引脚(互补输出引脚),但是这里不用考虑到占空比互补问题(CHx-20%,CHxN-80%),直接正常使用即可。
|
||||||
|
|
||||||
|
> 参考资料
|
||||||
|
>
|
||||||
|
> 1. [STM32 Nucleo-64板用户手册](https://www.st.com/resource/en/user_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf)
|
||||||
|
|
||||||
|
## 3 通信
|
||||||
|
|
||||||
|
### 3.1 I2C总线
|
||||||
|
|
||||||
|
STM32F411 Nucleo板的I2C总线是板上丝印的 `SCL/D15` 和 `SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
|
||||||
|
|
||||||
|
### 3.2 SPI总线
|
||||||
|
|
||||||
|
目前本BSP不支持使用Arduino的SPI功能。
|
||||||
|
|
||||||
|
### 3.3 串口
|
||||||
|
|
||||||
|
本BSP通过 `Serial.` 方法调用 `uart2` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)。
|
|
@ -0,0 +1,9 @@
|
||||||
|
from building import *
|
||||||
|
|
||||||
|
cwd = GetCurrentDir()
|
||||||
|
src = Glob('*.c') + Glob('*.cpp')
|
||||||
|
inc = [cwd]
|
||||||
|
|
||||||
|
group = DefineGroup('Arduino', src, depend = ['PKG_USING_RTDUINO'], CPPPATH = inc)
|
||||||
|
|
||||||
|
Return('group')
|
Binary file not shown.
After Width: | Height: | Size: 263 KiB |
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2022-10-14 liYony first version
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <board.h>
|
||||||
|
#include "pins_arduino.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
|
||||||
|
* [] means optional
|
||||||
|
* Digital pins must NOT give the device name and channel.
|
||||||
|
* Analog pins MUST give the device name and channel(ADC, PWM or DAC).
|
||||||
|
* Arduino Pin must keep in sequence.
|
||||||
|
*/
|
||||||
|
const pin_map_t pin_map_table[]=
|
||||||
|
{
|
||||||
|
{D0, GET_PIN(A,3), "uart2"}, /* Serial-RX */
|
||||||
|
{D1, GET_PIN(A,2), "uart2"}, /* Serial-TX */
|
||||||
|
{D2, GET_PIN(A,10)},
|
||||||
|
{D3, GET_PIN(B,3), "pwm2", 2}, /* PWM */
|
||||||
|
{D4, GET_PIN(B,5)},
|
||||||
|
{D5, GET_PIN(B,4), "pwm3", 1}, /* PWM */
|
||||||
|
{D6, GET_PIN(B,10), "pwm2", 3}, /* PWM */
|
||||||
|
{D7, GET_PIN(A,8)},
|
||||||
|
{D8, GET_PIN(A,9)},
|
||||||
|
{D9, GET_PIN(C,7), "pwm3", 2}, /* PWM */
|
||||||
|
{D10, GET_PIN(B,6), "pwm4", 1}, /* PWM */
|
||||||
|
{D11, GET_PIN(A,7), "pwm1", -1}, /* PWM */
|
||||||
|
{D12, GET_PIN(A,6)},
|
||||||
|
{D13, GET_PIN(A,5)}, /* LED_BUILTIN */
|
||||||
|
{D14, GET_PIN(B,9), "i2c1"}, /* I2C-SDA (Wire) */
|
||||||
|
{D15, GET_PIN(B,8), "i2c1"}, /* I2C-SCL (Wire) */
|
||||||
|
{D16, GET_PIN(C,13)},
|
||||||
|
{A0, GET_PIN(A,0), "adc1", 0}, /* ADC */
|
||||||
|
{A1, GET_PIN(A,1), "adc1", 1}, /* ADC */
|
||||||
|
{A2, GET_PIN(A,4), "adc1", 4}, /* ADC */
|
||||||
|
{A3, GET_PIN(B,0), "adc1", 8}, /* ADC */
|
||||||
|
{A4, GET_PIN(C,1), "adc1", 11}, /* ADC */
|
||||||
|
{A5, GET_PIN(C,0), "adc1", 10}, /* ADC */
|
||||||
|
{A6, RT_NULL, "adc1", 17}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
|
||||||
|
{A7, RT_NULL, "adc1", 16}, /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */
|
||||||
|
};
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2022-10-14 liYony first version
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef Pins_Arduino_h
|
||||||
|
#define Pins_Arduino_h
|
||||||
|
|
||||||
|
/* pins alias. Must keep in sequence */
|
||||||
|
#define D0 (0)
|
||||||
|
#define D1 (1)
|
||||||
|
#define D2 (2)
|
||||||
|
#define D3 (3)
|
||||||
|
#define D4 (4)
|
||||||
|
#define D5 (5)
|
||||||
|
#define D6 (6)
|
||||||
|
#define D7 (7)
|
||||||
|
#define D8 (8)
|
||||||
|
#define D9 (9)
|
||||||
|
#define D10 (10)
|
||||||
|
#define D11 (11)
|
||||||
|
#define D12 (12)
|
||||||
|
#define D13 (13)
|
||||||
|
#define D14 (14)
|
||||||
|
#define D15 (15)
|
||||||
|
#define D16 (16)
|
||||||
|
#define A0 (17)
|
||||||
|
#define A1 (18)
|
||||||
|
#define A2 (19)
|
||||||
|
#define A3 (20)
|
||||||
|
#define A4 (21)
|
||||||
|
#define A5 (22)
|
||||||
|
#define A6 (23)
|
||||||
|
#define A7 (24)
|
||||||
|
|
||||||
|
#define F_CPU 84000000L /* CPU:84MHz */
|
||||||
|
|
||||||
|
#define LED_BUILTIN D13 /* Default Built-in LED */
|
||||||
|
|
||||||
|
/* i2c1 : PB9-SDA PB8-SCL */
|
||||||
|
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
|
||||||
|
|
||||||
|
#endif /* Pins_Arduino_h */
|
File diff suppressed because one or more lines are too long
|
@ -1,120 +1,123 @@
|
||||||
#MicroXplorer Configuration settings - do not modify
|
#MicroXplorer Configuration settings - do not modify
|
||||||
|
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_0
|
||||||
|
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,master,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag
|
||||||
|
ADC1.NbrOfConversionFlag=1
|
||||||
|
ADC1.Rank-0\#ChannelRegularConversion=1
|
||||||
|
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES
|
||||||
|
ADC1.master=1
|
||||||
File.Version=6
|
File.Version=6
|
||||||
KeepUserPlacement=true
|
KeepUserPlacement=true
|
||||||
|
Mcu.CPN=STM32F411RET6
|
||||||
Mcu.Family=STM32F4
|
Mcu.Family=STM32F4
|
||||||
Mcu.IP0=IWDG
|
Mcu.IP0=ADC1
|
||||||
Mcu.IP1=NVIC
|
Mcu.IP1=IWDG
|
||||||
Mcu.IP2=RCC
|
Mcu.IP10=USART2
|
||||||
Mcu.IP3=RTC
|
Mcu.IP11=USART6
|
||||||
Mcu.IP4=SPI1
|
Mcu.IP2=NVIC
|
||||||
|
Mcu.IP3=RCC
|
||||||
|
Mcu.IP4=RTC
|
||||||
Mcu.IP5=SYS
|
Mcu.IP5=SYS
|
||||||
Mcu.IP6=TIM3
|
Mcu.IP6=TIM1
|
||||||
Mcu.IP7=USART2
|
Mcu.IP7=TIM2
|
||||||
Mcu.IP8=USART6
|
Mcu.IP8=TIM3
|
||||||
Mcu.IPNb=9
|
Mcu.IP9=TIM4
|
||||||
|
Mcu.IPNb=12
|
||||||
Mcu.Name=STM32F411R(C-E)Tx
|
Mcu.Name=STM32F411R(C-E)Tx
|
||||||
Mcu.Package=LQFP64
|
Mcu.Package=LQFP64
|
||||||
Mcu.Pin0=PC13-ANTI_TAMP
|
Mcu.Pin0=PC14-OSC32_IN
|
||||||
Mcu.Pin1=PC14-OSC32_IN
|
Mcu.Pin1=PC15-OSC32_OUT
|
||||||
Mcu.Pin10=PB0
|
Mcu.Pin10=PA4
|
||||||
Mcu.Pin11=PB1
|
Mcu.Pin11=PA7
|
||||||
Mcu.Pin12=PA11
|
Mcu.Pin12=PB0
|
||||||
Mcu.Pin13=PA12
|
Mcu.Pin13=PB1
|
||||||
Mcu.Pin14=PA13
|
Mcu.Pin14=PB10
|
||||||
Mcu.Pin15=PA14
|
Mcu.Pin15=PC7
|
||||||
Mcu.Pin16=PB3
|
Mcu.Pin16=PA11
|
||||||
Mcu.Pin17=PB4
|
Mcu.Pin17=PA12
|
||||||
Mcu.Pin18=PB5
|
Mcu.Pin18=PA13
|
||||||
Mcu.Pin19=VP_IWDG_VS_IWDG
|
Mcu.Pin19=PA14
|
||||||
Mcu.Pin2=PC15-OSC32_OUT
|
Mcu.Pin2=PH0 - OSC_IN
|
||||||
Mcu.Pin20=VP_RTC_VS_RTC_Activate
|
Mcu.Pin20=PB3
|
||||||
Mcu.Pin21=VP_SYS_VS_Systick
|
Mcu.Pin21=PB4
|
||||||
Mcu.Pin22=VP_TIM3_VS_ClockSourceINT
|
Mcu.Pin22=PB6
|
||||||
Mcu.Pin3=PH0 - OSC_IN
|
Mcu.Pin23=VP_IWDG_VS_IWDG
|
||||||
Mcu.Pin4=PH1 - OSC_OUT
|
Mcu.Pin24=VP_RTC_VS_RTC_Activate
|
||||||
Mcu.Pin5=PA2
|
Mcu.Pin25=VP_SYS_VS_Systick
|
||||||
Mcu.Pin6=PA3
|
Mcu.Pin26=VP_TIM1_VS_ClockSourceINT
|
||||||
Mcu.Pin7=PA5
|
Mcu.Pin27=VP_TIM2_VS_ClockSourceINT
|
||||||
Mcu.Pin8=PA6
|
Mcu.Pin28=VP_TIM3_VS_ClockSourceINT
|
||||||
Mcu.Pin9=PA7
|
Mcu.Pin29=VP_TIM4_VS_ClockSourceINT
|
||||||
Mcu.PinsNb=23
|
Mcu.Pin3=PH1 - OSC_OUT
|
||||||
|
Mcu.Pin4=PC0
|
||||||
|
Mcu.Pin5=PC1
|
||||||
|
Mcu.Pin6=PA0-WKUP
|
||||||
|
Mcu.Pin7=PA1
|
||||||
|
Mcu.Pin8=PA2
|
||||||
|
Mcu.Pin9=PA3
|
||||||
|
Mcu.PinsNb=30
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F411RETx
|
Mcu.UserName=STM32F411RETx
|
||||||
MxCube.Version=5.0.1
|
MxCube.Version=6.6.1
|
||||||
MxDb.Version=DB.5.0.1
|
MxDb.Version=DB.6.0.60
|
||||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:true
|
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
||||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:true
|
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
||||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:true
|
NVIC.ForceEnableDMAVector=true
|
||||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:true
|
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
||||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:true
|
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
||||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false
|
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
||||||
|
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_0
|
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_0
|
||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false
|
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true
|
NVIC.SysTick_IRQn=true\:0\:0\:true\:false\:true\:true\:true\:false
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:true\:false\:false
|
||||||
|
PA0-WKUP.Locked=true
|
||||||
|
PA0-WKUP.Signal=ADCx_IN0
|
||||||
|
PA1.Locked=true
|
||||||
|
PA1.Signal=ADCx_IN1
|
||||||
PA11.Locked=true
|
PA11.Locked=true
|
||||||
PA11.Mode=Asynchronous
|
PA11.Mode=Asynchronous
|
||||||
PA11.Signal=USART6_TX
|
PA11.Signal=USART6_TX
|
||||||
PA12.Locked=true
|
|
||||||
PA12.Mode=Asynchronous
|
PA12.Mode=Asynchronous
|
||||||
PA12.Signal=USART6_RX
|
PA12.Signal=USART6_RX
|
||||||
PA13.GPIOParameters=GPIO_Label
|
|
||||||
PA13.GPIO_Label=TMS
|
|
||||||
PA13.Locked=true
|
|
||||||
PA13.Mode=Serial_Wire
|
PA13.Mode=Serial_Wire
|
||||||
PA13.Signal=SYS_JTMS-SWDIO
|
PA13.Signal=SYS_JTMS-SWDIO
|
||||||
PA14.GPIOParameters=GPIO_Label
|
|
||||||
PA14.GPIO_Label=TCK
|
|
||||||
PA14.Locked=true
|
|
||||||
PA14.Mode=Serial_Wire
|
PA14.Mode=Serial_Wire
|
||||||
PA14.Signal=SYS_JTCK-SWCLK
|
PA14.Signal=SYS_JTCK-SWCLK
|
||||||
PA2.GPIOParameters=GPIO_PuPd
|
|
||||||
PA2.GPIO_PuPd=GPIO_PULLUP
|
|
||||||
PA2.Mode=Asynchronous
|
PA2.Mode=Asynchronous
|
||||||
PA2.Signal=USART2_TX
|
PA2.Signal=USART2_TX
|
||||||
PA3.GPIOParameters=GPIO_PuPd
|
|
||||||
PA3.GPIO_PuPd=GPIO_PULLUP
|
|
||||||
PA3.Mode=Asynchronous
|
PA3.Mode=Asynchronous
|
||||||
PA3.Signal=USART2_RX
|
PA3.Signal=USART2_RX
|
||||||
PA5.Mode=Full_Duplex_Master
|
PA4.Locked=true
|
||||||
PA5.Signal=SPI1_SCK
|
PA4.Signal=ADCx_IN4
|
||||||
PA6.Signal=S_TIM3_CH1
|
PA7.Locked=true
|
||||||
PA7.Signal=S_TIM3_CH2
|
PA7.Mode=PWM Generation1 CH1N
|
||||||
PB0.Signal=S_TIM3_CH3
|
PA7.Signal=TIM1_CH1N
|
||||||
|
PB0.Locked=true
|
||||||
|
PB0.Signal=ADCx_IN8
|
||||||
|
PB1.Locked=true
|
||||||
PB1.Signal=S_TIM3_CH4
|
PB1.Signal=S_TIM3_CH4
|
||||||
PB3.GPIOParameters=GPIO_Label
|
PB10.Locked=true
|
||||||
PB3.GPIO_Label=SWO
|
PB10.Signal=S_TIM2_CH3
|
||||||
PB3.Locked=true
|
PB3.Locked=true
|
||||||
PB3.Signal=SYS_JTDO-SWO
|
PB3.Signal=S_TIM2_CH2
|
||||||
PB4.Mode=Full_Duplex_Master
|
PB4.Locked=true
|
||||||
PB4.Signal=SPI1_MISO
|
PB4.Signal=S_TIM3_CH1
|
||||||
PB5.Mode=Full_Duplex_Master
|
PB6.Locked=true
|
||||||
PB5.Signal=SPI1_MOSI
|
PB6.Signal=S_TIM4_CH1
|
||||||
PC13-ANTI_TAMP.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
|
PC0.Locked=true
|
||||||
PC13-ANTI_TAMP.GPIO_Label=B1 [Blue PushButton]
|
PC0.Signal=ADCx_IN10
|
||||||
PC13-ANTI_TAMP.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
PC1.Locked=true
|
||||||
PC13-ANTI_TAMP.Locked=true
|
PC1.Signal=ADCx_IN11
|
||||||
PC13-ANTI_TAMP.Signal=GPXTI13
|
|
||||||
PC14-OSC32_IN.Locked=true
|
|
||||||
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
||||||
PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
||||||
PC15-OSC32_OUT.Locked=true
|
|
||||||
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
||||||
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
|
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
|
||||||
PCC.Checker=false
|
PC7.Locked=true
|
||||||
PCC.Line=STM32F411
|
PC7.Signal=S_TIM3_CH2
|
||||||
PCC.MCU=STM32F411R(C-E)Tx
|
PH0\ -\ OSC_IN.Mode=HSE-External-Oscillator
|
||||||
PCC.PartNumber=STM32F411RETx
|
|
||||||
PCC.Seq0=0
|
|
||||||
PCC.Series=STM32F4
|
|
||||||
PCC.Temperature=25
|
|
||||||
PCC.Vdd=null
|
|
||||||
PH0\ -\ OSC_IN.Locked=true
|
|
||||||
PH0\ -\ OSC_IN.Mode=HSE-External-Clock-Source
|
|
||||||
PH0\ -\ OSC_IN.Signal=RCC_OSC_IN
|
PH0\ -\ OSC_IN.Signal=RCC_OSC_IN
|
||||||
PH1\ -\ OSC_OUT.Locked=true
|
PH1\ -\ OSC_OUT.Mode=HSE-External-Oscillator
|
||||||
PH1\ -\ OSC_OUT.Mode=HSE-External-Clock-Source
|
|
||||||
PH1\ -\ OSC_OUT.Signal=RCC_OSC_OUT
|
PH1\ -\ OSC_OUT.Signal=RCC_OSC_OUT
|
||||||
PinOutPanel.RotationAngle=0
|
PinOutPanel.RotationAngle=0
|
||||||
ProjectManager.AskForMigrate=true
|
ProjectManager.AskForMigrate=true
|
||||||
|
@ -126,7 +129,7 @@ ProjectManager.CustomerFirmwarePackage=
|
||||||
ProjectManager.DefaultFWLocation=true
|
ProjectManager.DefaultFWLocation=true
|
||||||
ProjectManager.DeletePrevious=true
|
ProjectManager.DeletePrevious=true
|
||||||
ProjectManager.DeviceId=STM32F411RETx
|
ProjectManager.DeviceId=STM32F411RETx
|
||||||
ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.23.0
|
ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.27.1
|
||||||
ProjectManager.FreePins=false
|
ProjectManager.FreePins=false
|
||||||
ProjectManager.HalAssertFull=false
|
ProjectManager.HalAssertFull=false
|
||||||
ProjectManager.HeapSize=0x200
|
ProjectManager.HeapSize=0x200
|
||||||
|
@ -139,11 +142,12 @@ ProjectManager.PreviousToolchain=
|
||||||
ProjectManager.ProjectBuild=false
|
ProjectManager.ProjectBuild=false
|
||||||
ProjectManager.ProjectFileName=CubeMX_Config.ioc
|
ProjectManager.ProjectFileName=CubeMX_Config.ioc
|
||||||
ProjectManager.ProjectName=CubeMX_Config
|
ProjectManager.ProjectName=CubeMX_Config
|
||||||
|
ProjectManager.RegisterCallBack=
|
||||||
ProjectManager.StackSize=0x400
|
ProjectManager.StackSize=0x400
|
||||||
ProjectManager.TargetToolchain=MDK-ARM V5
|
ProjectManager.TargetToolchain=MDK-ARM V5
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UnderRoot=false
|
ProjectManager.UnderRoot=false
|
||||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_USART6_UART_Init-USART6-false-HAL-true,6-MX_RTC_Init-RTC-false-HAL-true,7-MX_IWDG_Init-IWDG-false-HAL-true,8-MX_SPI1_Init-SPI1-false-HAL-true
|
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_ADC1_Init-ADC1-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true,7-MX_TIM2_Init-TIM2-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_RTC_Init-RTC-false-HAL-true,10-MX_SPI1_Init-SPI1-false-HAL-true,11-MX_USART6_UART_Init-USART6-false-HAL-true
|
||||||
RCC.48MHZClocksFreq_Value=42000000
|
RCC.48MHZClocksFreq_Value=42000000
|
||||||
RCC.AHBFreq_Value=84000000
|
RCC.AHBFreq_Value=84000000
|
||||||
RCC.APB1CLKDivider=RCC_HCLK_DIV2
|
RCC.APB1CLKDivider=RCC_HCLK_DIV2
|
||||||
|
@ -177,26 +181,41 @@ RCC.VCOInputFreq_Value=2000000
|
||||||
RCC.VCOInputMFreq_Value=500000
|
RCC.VCOInputMFreq_Value=500000
|
||||||
RCC.VCOOutputFreq_Value=168000000
|
RCC.VCOOutputFreq_Value=168000000
|
||||||
RCC.VcooutputI2S=48000000
|
RCC.VcooutputI2S=48000000
|
||||||
SH.GPXTI13.0=GPIO_EXTI13
|
SH.ADCx_IN0.0=ADC1_IN0,IN0
|
||||||
SH.GPXTI13.ConfNb=1
|
SH.ADCx_IN0.ConfNb=1
|
||||||
|
SH.ADCx_IN1.0=ADC1_IN1,IN1
|
||||||
|
SH.ADCx_IN1.ConfNb=1
|
||||||
|
SH.ADCx_IN10.0=ADC1_IN10,IN10
|
||||||
|
SH.ADCx_IN10.ConfNb=1
|
||||||
|
SH.ADCx_IN11.0=ADC1_IN11,IN11
|
||||||
|
SH.ADCx_IN11.ConfNb=1
|
||||||
|
SH.ADCx_IN4.0=ADC1_IN4,IN4
|
||||||
|
SH.ADCx_IN4.ConfNb=1
|
||||||
|
SH.ADCx_IN8.0=ADC1_IN8,IN8
|
||||||
|
SH.ADCx_IN8.ConfNb=1
|
||||||
|
SH.S_TIM2_CH2.0=TIM2_CH2,PWM Generation2 CH2
|
||||||
|
SH.S_TIM2_CH2.ConfNb=1
|
||||||
|
SH.S_TIM2_CH3.0=TIM2_CH3,PWM Generation3 CH3
|
||||||
|
SH.S_TIM2_CH3.ConfNb=1
|
||||||
SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
|
SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1
|
||||||
SH.S_TIM3_CH1.ConfNb=1
|
SH.S_TIM3_CH1.ConfNb=1
|
||||||
SH.S_TIM3_CH2.0=TIM3_CH2,PWM Generation2 CH2
|
SH.S_TIM3_CH2.0=TIM3_CH2,PWM Generation2 CH2
|
||||||
SH.S_TIM3_CH2.ConfNb=1
|
SH.S_TIM3_CH2.ConfNb=1
|
||||||
SH.S_TIM3_CH3.0=TIM3_CH3,PWM Generation3 CH3
|
|
||||||
SH.S_TIM3_CH3.ConfNb=1
|
|
||||||
SH.S_TIM3_CH4.0=TIM3_CH4,PWM Generation4 CH4
|
SH.S_TIM3_CH4.0=TIM3_CH4,PWM Generation4 CH4
|
||||||
SH.S_TIM3_CH4.ConfNb=1
|
SH.S_TIM3_CH4.ConfNb=1
|
||||||
SPI1.CalculateBaudRate=42.0 MBits/s
|
SH.S_TIM4_CH1.0=TIM4_CH1,PWM Generation1 CH1
|
||||||
SPI1.Direction=SPI_DIRECTION_2LINES
|
SH.S_TIM4_CH1.ConfNb=1
|
||||||
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
|
TIM1.Channel-PWM\ Generation1\ CH1N=TIM_CHANNEL_1
|
||||||
SPI1.Mode=SPI_MODE_MASTER
|
TIM1.IPParameters=Channel-PWM Generation1 CH1N
|
||||||
SPI1.VirtualType=VM_MASTER
|
TIM2.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||||
|
TIM2.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
||||||
|
TIM2.IPParameters=Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3
|
||||||
TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||||
TIM3.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
TIM3.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||||
TIM3.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
|
||||||
TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
|
TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
|
||||||
TIM3.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4
|
TIM3.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation4 CH4
|
||||||
|
TIM4.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
||||||
|
TIM4.IPParameters=Channel-PWM Generation1 CH1
|
||||||
USART2.IPParameters=VirtualMode
|
USART2.IPParameters=VirtualMode
|
||||||
USART2.VirtualMode=VM_ASYNC
|
USART2.VirtualMode=VM_ASYNC
|
||||||
USART6.IPParameters=VirtualMode
|
USART6.IPParameters=VirtualMode
|
||||||
|
@ -207,7 +226,13 @@ VP_RTC_VS_RTC_Activate.Mode=RTC_Enabled
|
||||||
VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
|
VP_RTC_VS_RTC_Activate.Signal=RTC_VS_RTC_Activate
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||||
|
VP_TIM1_VS_ClockSourceINT.Mode=Internal
|
||||||
|
VP_TIM1_VS_ClockSourceINT.Signal=TIM1_VS_ClockSourceINT
|
||||||
|
VP_TIM2_VS_ClockSourceINT.Mode=Internal
|
||||||
|
VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT
|
||||||
VP_TIM3_VS_ClockSourceINT.Mode=Internal
|
VP_TIM3_VS_ClockSourceINT.Mode=Internal
|
||||||
VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT
|
VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT
|
||||||
|
VP_TIM4_VS_ClockSourceINT.Mode=Internal
|
||||||
|
VP_TIM4_VS_ClockSourceINT.Signal=TIM4_VS_ClockSourceINT
|
||||||
board=NUCLEO-F411RE
|
board=NUCLEO-F411RE
|
||||||
boardIOC=true
|
boardIOC=true
|
||||||
|
|
|
@ -80,14 +80,6 @@ void Error_Handler(void);
|
||||||
/* USER CODE END EFP */
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
#define B1_Pin GPIO_PIN_13
|
|
||||||
#define B1_GPIO_Port GPIOC
|
|
||||||
#define TMS_Pin GPIO_PIN_13
|
|
||||||
#define TMS_GPIO_Port GPIOA
|
|
||||||
#define TCK_Pin GPIO_PIN_14
|
|
||||||
#define TCK_GPIO_Port GPIOA
|
|
||||||
#define SWO_Pin GPIO_PIN_3
|
|
||||||
#define SWO_GPIO_Port GPIOB
|
|
||||||
/* USER CODE BEGIN Private defines */
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
/* USER CODE END Private defines */
|
||||||
|
@ -97,5 +89,3 @@ void Error_Handler(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __MAIN_H */
|
#endif /* __MAIN_H */
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
|
|
|
@ -1,36 +1,24 @@
|
||||||
|
/* USER CODE BEGIN Header */
|
||||||
/**
|
/**
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @file stm32f4xx_hal_conf.h
|
* @file stm32f4xx_hal_conf_template.h
|
||||||
* @brief HAL configuration file.
|
* @author MCD Application Team
|
||||||
|
* @brief HAL configuration template file.
|
||||||
|
* This file should be copied to the application folder and renamed
|
||||||
|
* to stm32f4xx_hal_conf.h.
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* @attention
|
* @attention
|
||||||
*
|
*
|
||||||
* <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
* Copyright (c) 2017 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
* are permitted provided that the following conditions are met:
|
* in the root directory of this software component.
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
#ifndef __STM32F4xx_HAL_CONF_H
|
#ifndef __STM32F4xx_HAL_CONF_H
|
||||||
|
@ -49,10 +37,11 @@
|
||||||
*/
|
*/
|
||||||
#define HAL_MODULE_ENABLED
|
#define HAL_MODULE_ENABLED
|
||||||
|
|
||||||
/* #define HAL_ADC_MODULE_ENABLED */
|
#define HAL_ADC_MODULE_ENABLED
|
||||||
/* #define HAL_CRYP_MODULE_ENABLED */
|
/* #define HAL_CRYP_MODULE_ENABLED */
|
||||||
/* #define HAL_CAN_MODULE_ENABLED */
|
/* #define HAL_CAN_MODULE_ENABLED */
|
||||||
/* #define HAL_CRC_MODULE_ENABLED */
|
/* #define HAL_CRC_MODULE_ENABLED */
|
||||||
|
/* #define HAL_CAN_LEGACY_MODULE_ENABLED */
|
||||||
/* #define HAL_CRYP_MODULE_ENABLED */
|
/* #define HAL_CRYP_MODULE_ENABLED */
|
||||||
/* #define HAL_DAC_MODULE_ENABLED */
|
/* #define HAL_DAC_MODULE_ENABLED */
|
||||||
/* #define HAL_DCMI_MODULE_ENABLED */
|
/* #define HAL_DCMI_MODULE_ENABLED */
|
||||||
|
@ -73,12 +62,13 @@
|
||||||
/* #define HAL_SAI_MODULE_ENABLED */
|
/* #define HAL_SAI_MODULE_ENABLED */
|
||||||
/* #define HAL_SD_MODULE_ENABLED */
|
/* #define HAL_SD_MODULE_ENABLED */
|
||||||
/* #define HAL_MMC_MODULE_ENABLED */
|
/* #define HAL_MMC_MODULE_ENABLED */
|
||||||
#define HAL_SPI_MODULE_ENABLED
|
/* #define HAL_SPI_MODULE_ENABLED */
|
||||||
#define HAL_TIM_MODULE_ENABLED
|
#define HAL_TIM_MODULE_ENABLED
|
||||||
#define HAL_UART_MODULE_ENABLED
|
#define HAL_UART_MODULE_ENABLED
|
||||||
/* #define HAL_USART_MODULE_ENABLED */
|
/* #define HAL_USART_MODULE_ENABLED */
|
||||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||||
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||||
|
/* #define HAL_SMBUS_MODULE_ENABLED */
|
||||||
/* #define HAL_WWDG_MODULE_ENABLED */
|
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||||
/* #define HAL_PCD_MODULE_ENABLED */
|
/* #define HAL_PCD_MODULE_ENABLED */
|
||||||
/* #define HAL_HCD_MODULE_ENABLED */
|
/* #define HAL_HCD_MODULE_ENABLED */
|
||||||
|
@ -87,11 +77,12 @@
|
||||||
/* #define HAL_QSPI_MODULE_ENABLED */
|
/* #define HAL_QSPI_MODULE_ENABLED */
|
||||||
/* #define HAL_CEC_MODULE_ENABLED */
|
/* #define HAL_CEC_MODULE_ENABLED */
|
||||||
/* #define HAL_FMPI2C_MODULE_ENABLED */
|
/* #define HAL_FMPI2C_MODULE_ENABLED */
|
||||||
|
/* #define HAL_FMPSMBUS_MODULE_ENABLED */
|
||||||
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
/* #define HAL_SPDIFRX_MODULE_ENABLED */
|
||||||
/* #define HAL_DFSDM_MODULE_ENABLED */
|
/* #define HAL_DFSDM_MODULE_ENABLED */
|
||||||
/* #define HAL_LPTIM_MODULE_ENABLED */
|
/* #define HAL_LPTIM_MODULE_ENABLED */
|
||||||
/* #define HAL_EXTI_MODULE_ENABLED */
|
|
||||||
#define HAL_GPIO_MODULE_ENABLED
|
#define HAL_GPIO_MODULE_ENABLED
|
||||||
|
#define HAL_EXTI_MODULE_ENABLED
|
||||||
#define HAL_DMA_MODULE_ENABLED
|
#define HAL_DMA_MODULE_ENABLED
|
||||||
#define HAL_RCC_MODULE_ENABLED
|
#define HAL_RCC_MODULE_ENABLED
|
||||||
#define HAL_FLASH_MODULE_ENABLED
|
#define HAL_FLASH_MODULE_ENABLED
|
||||||
|
@ -105,11 +96,11 @@
|
||||||
* (when HSE is used as system clock source, directly or through the PLL).
|
* (when HSE is used as system clock source, directly or through the PLL).
|
||||||
*/
|
*/
|
||||||
#if !defined (HSE_VALUE)
|
#if !defined (HSE_VALUE)
|
||||||
#define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
|
#define HSE_VALUE 8000000U /*!< Value of the External oscillator in Hz */
|
||||||
#endif /* HSE_VALUE */
|
#endif /* HSE_VALUE */
|
||||||
|
|
||||||
#if !defined (HSE_STARTUP_TIMEOUT)
|
#if !defined (HSE_STARTUP_TIMEOUT)
|
||||||
#define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
|
#define HSE_STARTUP_TIMEOUT 100U /*!< Time out for HSE start up, in ms */
|
||||||
#endif /* HSE_STARTUP_TIMEOUT */
|
#endif /* HSE_STARTUP_TIMEOUT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,7 +116,7 @@
|
||||||
* @brief Internal Low Speed oscillator (LSI) value.
|
* @brief Internal Low Speed oscillator (LSI) value.
|
||||||
*/
|
*/
|
||||||
#if !defined (LSI_VALUE)
|
#if !defined (LSI_VALUE)
|
||||||
#define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/
|
#define LSI_VALUE 32000U /*!< LSI Typical Value in Hz*/
|
||||||
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
||||||
The real value may vary depending on the variations
|
The real value may vary depending on the variations
|
||||||
in voltage and temperature.*/
|
in voltage and temperature.*/
|
||||||
|
@ -133,11 +124,11 @@
|
||||||
* @brief External Low Speed oscillator (LSE) value.
|
* @brief External Low Speed oscillator (LSE) value.
|
||||||
*/
|
*/
|
||||||
#if !defined (LSE_VALUE)
|
#if !defined (LSE_VALUE)
|
||||||
#define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */
|
#define LSE_VALUE 32768U /*!< Value of the External Low Speed oscillator in Hz */
|
||||||
#endif /* LSE_VALUE */
|
#endif /* LSE_VALUE */
|
||||||
|
|
||||||
#if !defined (LSE_STARTUP_TIMEOUT)
|
#if !defined (LSE_STARTUP_TIMEOUT)
|
||||||
#define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
|
#define LSE_STARTUP_TIMEOUT 5000U /*!< Time out for LSE start up, in ms */
|
||||||
#endif /* LSE_STARTUP_TIMEOUT */
|
#endif /* LSE_STARTUP_TIMEOUT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,7 +137,7 @@
|
||||||
* frequency, this source is inserted directly through I2S_CKIN pad.
|
* frequency, this source is inserted directly through I2S_CKIN pad.
|
||||||
*/
|
*/
|
||||||
#if !defined (EXTERNAL_CLOCK_VALUE)
|
#if !defined (EXTERNAL_CLOCK_VALUE)
|
||||||
#define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/
|
#define EXTERNAL_CLOCK_VALUE 12288000U /*!< Value of the External audio frequency in Hz*/
|
||||||
#endif /* EXTERNAL_CLOCK_VALUE */
|
#endif /* EXTERNAL_CLOCK_VALUE */
|
||||||
|
|
||||||
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
/* Tip: To avoid modifying this file each time you need to use different HSE,
|
||||||
|
@ -156,13 +147,53 @@
|
||||||
/**
|
/**
|
||||||
* @brief This is the HAL system configuration section
|
* @brief This is the HAL system configuration section
|
||||||
*/
|
*/
|
||||||
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
|
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
|
||||||
#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
|
#define TICK_INT_PRIORITY 0U /*!< tick interrupt priority */
|
||||||
#define USE_RTOS 0U
|
#define USE_RTOS 0U
|
||||||
#define PREFETCH_ENABLE 1U
|
#define PREFETCH_ENABLE 1U
|
||||||
#define INSTRUCTION_CACHE_ENABLE 1U
|
#define INSTRUCTION_CACHE_ENABLE 1U
|
||||||
#define DATA_CACHE_ENABLE 1U
|
#define DATA_CACHE_ENABLE 1U
|
||||||
|
|
||||||
|
#define USE_HAL_ADC_REGISTER_CALLBACKS 0U /* ADC register callback disabled */
|
||||||
|
#define USE_HAL_CAN_REGISTER_CALLBACKS 0U /* CAN register callback disabled */
|
||||||
|
#define USE_HAL_CEC_REGISTER_CALLBACKS 0U /* CEC register callback disabled */
|
||||||
|
#define USE_HAL_CRYP_REGISTER_CALLBACKS 0U /* CRYP register callback disabled */
|
||||||
|
#define USE_HAL_DAC_REGISTER_CALLBACKS 0U /* DAC register callback disabled */
|
||||||
|
#define USE_HAL_DCMI_REGISTER_CALLBACKS 0U /* DCMI register callback disabled */
|
||||||
|
#define USE_HAL_DFSDM_REGISTER_CALLBACKS 0U /* DFSDM register callback disabled */
|
||||||
|
#define USE_HAL_DMA2D_REGISTER_CALLBACKS 0U /* DMA2D register callback disabled */
|
||||||
|
#define USE_HAL_DSI_REGISTER_CALLBACKS 0U /* DSI register callback disabled */
|
||||||
|
#define USE_HAL_ETH_REGISTER_CALLBACKS 0U /* ETH register callback disabled */
|
||||||
|
#define USE_HAL_HASH_REGISTER_CALLBACKS 0U /* HASH register callback disabled */
|
||||||
|
#define USE_HAL_HCD_REGISTER_CALLBACKS 0U /* HCD register callback disabled */
|
||||||
|
#define USE_HAL_I2C_REGISTER_CALLBACKS 0U /* I2C register callback disabled */
|
||||||
|
#define USE_HAL_FMPI2C_REGISTER_CALLBACKS 0U /* FMPI2C register callback disabled */
|
||||||
|
#define USE_HAL_FMPSMBUS_REGISTER_CALLBACKS 0U /* FMPSMBUS register callback disabled */
|
||||||
|
#define USE_HAL_I2S_REGISTER_CALLBACKS 0U /* I2S register callback disabled */
|
||||||
|
#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U /* IRDA register callback disabled */
|
||||||
|
#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U /* LPTIM register callback disabled */
|
||||||
|
#define USE_HAL_LTDC_REGISTER_CALLBACKS 0U /* LTDC register callback disabled */
|
||||||
|
#define USE_HAL_MMC_REGISTER_CALLBACKS 0U /* MMC register callback disabled */
|
||||||
|
#define USE_HAL_NAND_REGISTER_CALLBACKS 0U /* NAND register callback disabled */
|
||||||
|
#define USE_HAL_NOR_REGISTER_CALLBACKS 0U /* NOR register callback disabled */
|
||||||
|
#define USE_HAL_PCCARD_REGISTER_CALLBACKS 0U /* PCCARD register callback disabled */
|
||||||
|
#define USE_HAL_PCD_REGISTER_CALLBACKS 0U /* PCD register callback disabled */
|
||||||
|
#define USE_HAL_QSPI_REGISTER_CALLBACKS 0U /* QSPI register callback disabled */
|
||||||
|
#define USE_HAL_RNG_REGISTER_CALLBACKS 0U /* RNG register callback disabled */
|
||||||
|
#define USE_HAL_RTC_REGISTER_CALLBACKS 0U /* RTC register callback disabled */
|
||||||
|
#define USE_HAL_SAI_REGISTER_CALLBACKS 0U /* SAI register callback disabled */
|
||||||
|
#define USE_HAL_SD_REGISTER_CALLBACKS 0U /* SD register callback disabled */
|
||||||
|
#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U /* SMARTCARD register callback disabled */
|
||||||
|
#define USE_HAL_SDRAM_REGISTER_CALLBACKS 0U /* SDRAM register callback disabled */
|
||||||
|
#define USE_HAL_SRAM_REGISTER_CALLBACKS 0U /* SRAM register callback disabled */
|
||||||
|
#define USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */
|
||||||
|
#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U /* SMBUS register callback disabled */
|
||||||
|
#define USE_HAL_SPI_REGISTER_CALLBACKS 0U /* SPI register callback disabled */
|
||||||
|
#define USE_HAL_TIM_REGISTER_CALLBACKS 0U /* TIM register callback disabled */
|
||||||
|
#define USE_HAL_UART_REGISTER_CALLBACKS 0U /* UART register callback disabled */
|
||||||
|
#define USE_HAL_USART_REGISTER_CALLBACKS 0U /* USART register callback disabled */
|
||||||
|
#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U /* WWDG register callback disabled */
|
||||||
|
|
||||||
/* ########################## Assert Selection ############################## */
|
/* ########################## Assert Selection ############################## */
|
||||||
/**
|
/**
|
||||||
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
* @brief Uncomment the line below to expanse the "assert_param" macro in the
|
||||||
|
@ -185,20 +216,20 @@
|
||||||
/* Definition of the Ethernet driver buffers size and count */
|
/* Definition of the Ethernet driver buffers size and count */
|
||||||
#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
|
#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
|
||||||
#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
|
#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
|
||||||
#define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
|
#define ETH_RXBUFNB 4U /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
|
||||||
#define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
|
#define ETH_TXBUFNB 4U /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
|
||||||
|
|
||||||
/* Section 2: PHY configuration section */
|
/* Section 2: PHY configuration section */
|
||||||
|
|
||||||
/* DP83848_PHY_ADDRESS Address*/
|
/* DP83848_PHY_ADDRESS Address*/
|
||||||
#define DP83848_PHY_ADDRESS 0x01U
|
#define DP83848_PHY_ADDRESS 0x01U
|
||||||
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
|
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
|
||||||
#define PHY_RESET_DELAY ((uint32_t)0x000000FFU)
|
#define PHY_RESET_DELAY 0x000000FFU
|
||||||
/* PHY Configuration delay */
|
/* PHY Configuration delay */
|
||||||
#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
|
#define PHY_CONFIG_DELAY 0x00000FFFU
|
||||||
|
|
||||||
#define PHY_READ_TO ((uint32_t)0x0000FFFFU)
|
#define PHY_READ_TO 0x0000FFFFU
|
||||||
#define PHY_WRITE_TO ((uint32_t)0x0000FFFFU)
|
#define PHY_WRITE_TO 0x0000FFFFU
|
||||||
|
|
||||||
/* Section 3: Common PHY Registers */
|
/* Section 3: Common PHY Registers */
|
||||||
|
|
||||||
|
@ -244,14 +275,14 @@
|
||||||
#include "stm32f4xx_hal_rcc.h"
|
#include "stm32f4xx_hal_rcc.h"
|
||||||
#endif /* HAL_RCC_MODULE_ENABLED */
|
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_EXTI_MODULE_ENABLED
|
|
||||||
#include "stm32f4xx_hal_exti.h"
|
|
||||||
#endif /* HAL_EXTI_MODULE_ENABLED */
|
|
||||||
|
|
||||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||||
#include "stm32f4xx_hal_gpio.h"
|
#include "stm32f4xx_hal_gpio.h"
|
||||||
#endif /* HAL_GPIO_MODULE_ENABLED */
|
#endif /* HAL_GPIO_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||||
|
#include "stm32f4xx_hal_exti.h"
|
||||||
|
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_DMA_MODULE_ENABLED
|
#ifdef HAL_DMA_MODULE_ENABLED
|
||||||
#include "stm32f4xx_hal_dma.h"
|
#include "stm32f4xx_hal_dma.h"
|
||||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||||
|
@ -268,6 +299,10 @@
|
||||||
#include "stm32f4xx_hal_can.h"
|
#include "stm32f4xx_hal_can.h"
|
||||||
#endif /* HAL_CAN_MODULE_ENABLED */
|
#endif /* HAL_CAN_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
|
||||||
|
#include "stm32f4xx_hal_can_legacy.h"
|
||||||
|
#endif /* HAL_CAN_LEGACY_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_CRC_MODULE_ENABLED
|
#ifdef HAL_CRC_MODULE_ENABLED
|
||||||
#include "stm32f4xx_hal_crc.h"
|
#include "stm32f4xx_hal_crc.h"
|
||||||
#endif /* HAL_CRC_MODULE_ENABLED */
|
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||||
|
@ -324,6 +359,10 @@
|
||||||
#include "stm32f4xx_hal_i2c.h"
|
#include "stm32f4xx_hal_i2c.h"
|
||||||
#endif /* HAL_I2C_MODULE_ENABLED */
|
#endif /* HAL_I2C_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_SMBUS_MODULE_ENABLED
|
||||||
|
#include "stm32f4xx_hal_smbus.h"
|
||||||
|
#endif /* HAL_SMBUS_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_I2S_MODULE_ENABLED
|
#ifdef HAL_I2S_MODULE_ENABLED
|
||||||
#include "stm32f4xx_hal_i2s.h"
|
#include "stm32f4xx_hal_i2s.h"
|
||||||
#endif /* HAL_I2S_MODULE_ENABLED */
|
#endif /* HAL_I2S_MODULE_ENABLED */
|
||||||
|
@ -356,10 +395,6 @@
|
||||||
#include "stm32f4xx_hal_sd.h"
|
#include "stm32f4xx_hal_sd.h"
|
||||||
#endif /* HAL_SD_MODULE_ENABLED */
|
#endif /* HAL_SD_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_MMC_MODULE_ENABLED
|
|
||||||
#include "stm32f4xx_hal_mmc.h"
|
|
||||||
#endif /* HAL_MMC_MODULE_ENABLED */
|
|
||||||
|
|
||||||
#ifdef HAL_SPI_MODULE_ENABLED
|
#ifdef HAL_SPI_MODULE_ENABLED
|
||||||
#include "stm32f4xx_hal_spi.h"
|
#include "stm32f4xx_hal_spi.h"
|
||||||
#endif /* HAL_SPI_MODULE_ENABLED */
|
#endif /* HAL_SPI_MODULE_ENABLED */
|
||||||
|
@ -412,6 +447,10 @@
|
||||||
#include "stm32f4xx_hal_fmpi2c.h"
|
#include "stm32f4xx_hal_fmpi2c.h"
|
||||||
#endif /* HAL_FMPI2C_MODULE_ENABLED */
|
#endif /* HAL_FMPI2C_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_FMPSMBUS_MODULE_ENABLED
|
||||||
|
#include "stm32f4xx_hal_fmpsmbus.h"
|
||||||
|
#endif /* HAL_FMPSMBUS_MODULE_ENABLED */
|
||||||
|
|
||||||
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
#ifdef HAL_SPDIFRX_MODULE_ENABLED
|
||||||
#include "stm32f4xx_hal_spdifrx.h"
|
#include "stm32f4xx_hal_spdifrx.h"
|
||||||
#endif /* HAL_SPDIFRX_MODULE_ENABLED */
|
#endif /* HAL_SPDIFRX_MODULE_ENABLED */
|
||||||
|
@ -424,11 +463,15 @@
|
||||||
#include "stm32f4xx_hal_lptim.h"
|
#include "stm32f4xx_hal_lptim.h"
|
||||||
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
||||||
|
|
||||||
|
#ifdef HAL_MMC_MODULE_ENABLED
|
||||||
|
#include "stm32f4xx_hal_mmc.h"
|
||||||
|
#endif /* HAL_MMC_MODULE_ENABLED */
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
#ifdef USE_FULL_ASSERT
|
#ifdef USE_FULL_ASSERT
|
||||||
/**
|
/**
|
||||||
* @brief The assert_param macro is used for function's parameters check.
|
* @brief The assert_param macro is used for function's parameters check.
|
||||||
* @param expr: If expr is false, it calls assert_failed function
|
* @param expr If expr is false, it calls assert_failed function
|
||||||
* which reports the name of the source file and the source
|
* which reports the name of the source file and the source
|
||||||
* line number of the call that failed.
|
* line number of the call that failed.
|
||||||
* If expr is true, it returns no value.
|
* If expr is true, it returns no value.
|
||||||
|
@ -446,6 +489,3 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __STM32F4xx_HAL_CONF_H */
|
#endif /* __STM32F4xx_HAL_CONF_H */
|
||||||
|
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
|
|
|
@ -80,5 +80,3 @@ void SysTick_Handler(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __STM32F4xx_IT_H */
|
#endif /* __STM32F4xx_IT_H */
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
|
|
|
@ -101,6 +101,93 @@ void HAL_MspInit(void)
|
||||||
/* USER CODE END MspInit 1 */
|
/* USER CODE END MspInit 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC MSP Initialization
|
||||||
|
* This function configures the hardware resources used in this example
|
||||||
|
* @param hadc: ADC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if(hadc->Instance==ADC1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADC1_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_ADC1_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**ADC1 GPIO Configuration
|
||||||
|
PC0 ------> ADC1_IN10
|
||||||
|
PC1 ------> ADC1_IN11
|
||||||
|
PA0-WKUP ------> ADC1_IN0
|
||||||
|
PA1 ------> ADC1_IN1
|
||||||
|
PA4 ------> ADC1_IN4
|
||||||
|
PB0 ------> ADC1_IN8
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_0;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN ADC1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ADC MSP De-Initialization
|
||||||
|
* This function freeze the hardware resources used in this example
|
||||||
|
* @param hadc: ADC handle pointer
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
|
||||||
|
{
|
||||||
|
if(hadc->Instance==ADC1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN ADC1_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_ADC1_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**ADC1 GPIO Configuration
|
||||||
|
PC0 ------> ADC1_IN10
|
||||||
|
PC1 ------> ADC1_IN11
|
||||||
|
PA0-WKUP ------> ADC1_IN0
|
||||||
|
PA1 ------> ADC1_IN1
|
||||||
|
PA4 ------> ADC1_IN4
|
||||||
|
PB0 ------> ADC1_IN8
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_1);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_0);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN ADC1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END ADC1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RTC MSP Initialization
|
* @brief RTC MSP Initialization
|
||||||
* This function configures the hardware resources used in this example
|
* This function configures the hardware resources used in this example
|
||||||
|
@ -109,12 +196,22 @@ void HAL_MspInit(void)
|
||||||
*/
|
*/
|
||||||
void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
|
void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
|
||||||
{
|
{
|
||||||
|
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||||
if(hrtc->Instance==RTC)
|
if(hrtc->Instance==RTC)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN RTC_MspInit 0 */
|
/* USER CODE BEGIN RTC_MspInit 0 */
|
||||||
|
|
||||||
/* USER CODE END RTC_MspInit 0 */
|
/* USER CODE END RTC_MspInit 0 */
|
||||||
|
|
||||||
|
/** Initializes the peripherals clock
|
||||||
|
*/
|
||||||
|
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
|
||||||
|
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
|
||||||
|
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
/* Peripheral clock enable */
|
/* Peripheral clock enable */
|
||||||
__HAL_RCC_RTC_ENABLE();
|
__HAL_RCC_RTC_ENABLE();
|
||||||
/* USER CODE BEGIN RTC_MspInit 1 */
|
/* USER CODE BEGIN RTC_MspInit 1 */
|
||||||
|
@ -130,10 +227,8 @@ void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
|
||||||
* @param hrtc: RTC handle pointer
|
* @param hrtc: RTC handle pointer
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
|
void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(hrtc->Instance==RTC)
|
if(hrtc->Instance==RTC)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN RTC_MspDeInit 0 */
|
/* USER CODE BEGIN RTC_MspDeInit 0 */
|
||||||
|
@ -148,86 +243,6 @@ void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SPI MSP Initialization
|
|
||||||
* This function configures the hardware resources used in this example
|
|
||||||
* @param hspi: SPI handle pointer
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
|
|
||||||
{
|
|
||||||
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
||||||
if(hspi->Instance==SPI1)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN SPI1_MspInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END SPI1_MspInit 0 */
|
|
||||||
/* Peripheral clock enable */
|
|
||||||
__HAL_RCC_SPI1_CLK_ENABLE();
|
|
||||||
|
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
|
||||||
/**SPI1 GPIO Configuration
|
|
||||||
PA5 ------> SPI1_SCK
|
|
||||||
PB4 ------> SPI1_MISO
|
|
||||||
PB5 ------> SPI1_MOSI
|
|
||||||
*/
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_5;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
|
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN SPI1_MspInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END SPI1_MspInit 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief SPI MSP De-Initialization
|
|
||||||
* This function freeze the hardware resources used in this example
|
|
||||||
* @param hspi: SPI handle pointer
|
|
||||||
* @retval None
|
|
||||||
*/
|
|
||||||
|
|
||||||
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(hspi->Instance==SPI1)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN SPI1_MspDeInit 0 */
|
|
||||||
|
|
||||||
/* USER CODE END SPI1_MspDeInit 0 */
|
|
||||||
/* Peripheral clock disable */
|
|
||||||
__HAL_RCC_SPI1_CLK_DISABLE();
|
|
||||||
|
|
||||||
/**SPI1 GPIO Configuration
|
|
||||||
PA5 ------> SPI1_SCK
|
|
||||||
PB4 ------> SPI1_MISO
|
|
||||||
PB5 ------> SPI1_MOSI
|
|
||||||
*/
|
|
||||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5);
|
|
||||||
|
|
||||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_4|GPIO_PIN_5);
|
|
||||||
|
|
||||||
/* USER CODE BEGIN SPI1_MspDeInit 1 */
|
|
||||||
|
|
||||||
/* USER CODE END SPI1_MspDeInit 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief TIM_Base MSP Initialization
|
* @brief TIM_Base MSP Initialization
|
||||||
* This function configures the hardware resources used in this example
|
* This function configures the hardware resources used in this example
|
||||||
|
@ -236,8 +251,29 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
|
||||||
*/
|
*/
|
||||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
||||||
{
|
{
|
||||||
|
if(htim_base->Instance==TIM1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM1_MspInit 0 */
|
||||||
|
|
||||||
if(htim_base->Instance==TIM3)
|
/* USER CODE END TIM1_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_TIM1_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN TIM1_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM1_MspInit 1 */
|
||||||
|
}
|
||||||
|
else if(htim_base->Instance==TIM2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM2_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_TIM2_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN TIM2_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspInit 1 */
|
||||||
|
}
|
||||||
|
else if(htim_base->Instance==TIM3)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN TIM3_MspInit 0 */
|
/* USER CODE BEGIN TIM3_MspInit 0 */
|
||||||
|
|
||||||
|
@ -248,45 +284,117 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspInit 1 */
|
/* USER CODE END TIM3_MspInit 1 */
|
||||||
}
|
}
|
||||||
|
else if(htim_base->Instance==TIM4)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM4_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM4_MspInit 0 */
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_TIM4_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN TIM4_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM4_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
||||||
{
|
{
|
||||||
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
if(htim->Instance==TIM3)
|
if(htim->Instance==TIM1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM1_MspPostInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM1_MspPostInit 0 */
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
/**TIM1 GPIO Configuration
|
||||||
|
PA7 ------> TIM1_CH1N
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM1_MspPostInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM1_MspPostInit 1 */
|
||||||
|
}
|
||||||
|
else if(htim->Instance==TIM2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM2_MspPostInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspPostInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**TIM2 GPIO Configuration
|
||||||
|
PB10 ------> TIM2_CH3
|
||||||
|
PB3 ------> TIM2_CH2
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_3;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF1_TIM2;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM2_MspPostInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspPostInit 1 */
|
||||||
|
}
|
||||||
|
else if(htim->Instance==TIM3)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN TIM3_MspPostInit 0 */
|
/* USER CODE BEGIN TIM3_MspPostInit 0 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspPostInit 0 */
|
/* USER CODE END TIM3_MspPostInit 0 */
|
||||||
|
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
|
||||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
/**TIM3 GPIO Configuration
|
/**TIM3 GPIO Configuration
|
||||||
PA6 ------> TIM3_CH1
|
|
||||||
PA7 ------> TIM3_CH2
|
|
||||||
PB0 ------> TIM3_CH3
|
|
||||||
PB1 ------> TIM3_CH4
|
PB1 ------> TIM3_CH4
|
||||||
|
PC7 ------> TIM3_CH2
|
||||||
|
PB4 ------> TIM3_CH1
|
||||||
*/
|
*/
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
|
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
|
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;
|
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
|
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
|
||||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
|
||||||
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
/* USER CODE BEGIN TIM3_MspPostInit 1 */
|
/* USER CODE BEGIN TIM3_MspPostInit 1 */
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspPostInit 1 */
|
/* USER CODE END TIM3_MspPostInit 1 */
|
||||||
}
|
}
|
||||||
|
else if(htim->Instance==TIM4)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM4_MspPostInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM4_MspPostInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||||
|
/**TIM4 GPIO Configuration
|
||||||
|
PB6 ------> TIM4_CH1
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF2_TIM4;
|
||||||
|
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM4_MspPostInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM4_MspPostInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -295,11 +403,31 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
||||||
* @param htim_base: TIM_Base handle pointer
|
* @param htim_base: TIM_Base handle pointer
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
||||||
{
|
{
|
||||||
|
if(htim_base->Instance==TIM1)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM1_MspDeInit 0 */
|
||||||
|
|
||||||
if(htim_base->Instance==TIM3)
|
/* USER CODE END TIM1_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_TIM1_CLK_DISABLE();
|
||||||
|
/* USER CODE BEGIN TIM1_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM1_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
else if(htim_base->Instance==TIM2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM2_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_TIM2_CLK_DISABLE();
|
||||||
|
/* USER CODE BEGIN TIM2_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
else if(htim_base->Instance==TIM3)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN TIM3_MspDeInit 0 */
|
/* USER CODE BEGIN TIM3_MspDeInit 0 */
|
||||||
|
|
||||||
|
@ -310,6 +438,17 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
||||||
|
|
||||||
/* USER CODE END TIM3_MspDeInit 1 */
|
/* USER CODE END TIM3_MspDeInit 1 */
|
||||||
}
|
}
|
||||||
|
else if(htim_base->Instance==TIM4)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM4_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM4_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_TIM4_CLK_DISABLE();
|
||||||
|
/* USER CODE BEGIN TIM4_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM4_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +460,6 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
||||||
*/
|
*/
|
||||||
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||||
{
|
{
|
||||||
|
|
||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
if(huart->Instance==USART2)
|
if(huart->Instance==USART2)
|
||||||
{
|
{
|
||||||
|
@ -338,7 +476,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||||
*/
|
*/
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
|
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
|
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
@ -362,7 +500,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||||
*/
|
*/
|
||||||
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
|
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
GPIO_InitStruct.Alternate = GPIO_AF8_USART6;
|
GPIO_InitStruct.Alternate = GPIO_AF8_USART6;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
@ -380,10 +518,8 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||||
* @param huart: UART handle pointer
|
* @param huart: UART handle pointer
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(huart->Instance==USART2)
|
if(huart->Instance==USART2)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN USART2_MspDeInit 0 */
|
/* USER CODE BEGIN USART2_MspDeInit 0 */
|
||||||
|
@ -426,5 +562,3 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
/* USER CODE END 0 */
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
/* External variables --------------------------------------------------------*/
|
/* External variables --------------------------------------------------------*/
|
||||||
|
|
||||||
/* USER CODE BEGIN EV */
|
/* USER CODE BEGIN EV */
|
||||||
|
|
||||||
/* USER CODE END EV */
|
/* USER CODE END EV */
|
||||||
|
@ -214,4 +215,3 @@ void SysTick_Handler(void)
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
/* USER CODE END 1 */
|
/* USER CODE END 1 */
|
||||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
||||||
|
|
|
@ -8,6 +8,35 @@ config SOC_STM32F411RE
|
||||||
default y
|
default y
|
||||||
|
|
||||||
menu "Onboard Peripheral Drivers"
|
menu "Onboard Peripheral Drivers"
|
||||||
|
config BSP_USING_STLINK_TO_USART
|
||||||
|
bool "Enable STLINK TO USART (uart2)"
|
||||||
|
select BSP_USING_UART
|
||||||
|
select BSP_USING_UART2
|
||||||
|
default y
|
||||||
|
|
||||||
|
config BSP_USING_ARDUINO
|
||||||
|
bool "Compatible with Arduino Ecosystem (RTduino)"
|
||||||
|
select PKG_USING_RTDUINO
|
||||||
|
select BSP_USING_STLINK_TO_USART
|
||||||
|
select BSP_USING_GPIO
|
||||||
|
select BSP_USING_ADC
|
||||||
|
select BSP_USING_ADC1
|
||||||
|
select BSP_USING_PWM
|
||||||
|
select BSP_USING_PWM1
|
||||||
|
select BSP_USING_PWM4
|
||||||
|
select BSP_USING_PWM3
|
||||||
|
select BSP_USING_PWM2
|
||||||
|
select BSP_USING_PWM2_CH2
|
||||||
|
select BSP_USING_PWM3_CH1
|
||||||
|
select BSP_USING_PWM2_CH3
|
||||||
|
select BSP_USING_PWM3_CH2
|
||||||
|
select BSP_USING_PWM4_CH1
|
||||||
|
select BSP_USING_PWM1_CH1
|
||||||
|
select BSP_USING_I2C
|
||||||
|
select BSP_USING_I2C1
|
||||||
|
imply RTDUINO_USING_SERVO
|
||||||
|
imply RTDUINO_USING_WIRE
|
||||||
|
default n
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
|
@ -42,6 +71,16 @@ menu "On-chip Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
menuconfig BSP_USING_ADC
|
||||||
|
bool "Enable ADC"
|
||||||
|
default n
|
||||||
|
select RT_USING_ADC
|
||||||
|
if BSP_USING_ADC
|
||||||
|
config BSP_USING_ADC1
|
||||||
|
bool "Enable ADC1"
|
||||||
|
default n
|
||||||
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_I2C1
|
menuconfig BSP_USING_I2C1
|
||||||
bool "Enable I2C1 BUS (software simulation)"
|
bool "Enable I2C1 BUS (software simulation)"
|
||||||
default n
|
default n
|
||||||
|
@ -60,50 +99,57 @@ menu "On-chip Peripheral Drivers"
|
||||||
default 25
|
default 25
|
||||||
endif
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_SPI
|
|
||||||
bool "Enable SPI BUS"
|
|
||||||
default n
|
|
||||||
select RT_USING_SPI
|
|
||||||
if BSP_USING_SPI
|
|
||||||
config BSP_USING_SPI1
|
|
||||||
bool "Enable SPI1 BUS"
|
|
||||||
default n
|
|
||||||
|
|
||||||
config BSP_SPI1_TX_USING_DMA
|
|
||||||
bool "Enable SPI1 TX DMA"
|
|
||||||
depends on BSP_USING_SPI1
|
|
||||||
default n
|
|
||||||
|
|
||||||
config BSP_SPI1_RX_USING_DMA
|
|
||||||
bool "Enable SPI1 RX DMA"
|
|
||||||
depends on BSP_USING_SPI1
|
|
||||||
select BSP_SPI1_TX_USING_DMA
|
|
||||||
default n
|
|
||||||
endif
|
|
||||||
|
|
||||||
menuconfig BSP_USING_PWM
|
menuconfig BSP_USING_PWM
|
||||||
bool "Enable PWM"
|
bool "Enable PWM"
|
||||||
default n
|
default n
|
||||||
select RT_USING_PWM
|
select RT_USING_PWM
|
||||||
|
|
||||||
if BSP_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
|
||||||
|
|
||||||
|
menuconfig BSP_USING_PWM2
|
||||||
|
bool "Enable timer2 output PWM"
|
||||||
|
default n
|
||||||
|
if BSP_USING_PWM2
|
||||||
|
config BSP_USING_PWM2_CH2
|
||||||
|
bool "Enable PWM2 channel2"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_PWM2_CH3
|
||||||
|
bool "Enable PWM2 channel3"
|
||||||
|
default n
|
||||||
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_PWM3
|
menuconfig BSP_USING_PWM3
|
||||||
bool "Enable timer3 output PWM"
|
bool "Enable timer3 output PWM"
|
||||||
default n
|
default n
|
||||||
if BSP_USING_PWM3
|
if BSP_USING_PWM3
|
||||||
config BSP_USING_PWM3_CH1
|
config BSP_USING_PWM3_CH1
|
||||||
bool "Enable PWM3 channel1 (PA6)"
|
bool "Enable PWM3 channel1"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_PWM3_CH2
|
config BSP_USING_PWM3_CH2
|
||||||
bool "Enable PWM3 channel2 (PA7)"
|
bool "Enable PWM3 channel2"
|
||||||
default n
|
|
||||||
|
|
||||||
config BSP_USING_PWM3_CH3
|
|
||||||
bool "Enable PWM3 channel3 (PB0)"
|
|
||||||
default n
|
default n
|
||||||
|
|
||||||
config BSP_USING_PWM3_CH4
|
config BSP_USING_PWM3_CH4
|
||||||
bool "Enable PWM3 channel4 (PB1)"
|
bool "Enable PWM3 channel4"
|
||||||
|
default n
|
||||||
|
endif
|
||||||
|
|
||||||
|
menuconfig BSP_USING_PWM4
|
||||||
|
bool "Enable timer4 output PWM"
|
||||||
|
default n
|
||||||
|
if BSP_USING_PWM4
|
||||||
|
config BSP_USING_PWM4_CH1
|
||||||
|
bool "Enable PWM4 channel1"
|
||||||
default n
|
default n
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -128,6 +174,12 @@ menu "On-chip Peripheral Drivers"
|
||||||
config BSP_USING_ON_CHIP_FLASH
|
config BSP_USING_ON_CHIP_FLASH
|
||||||
bool "Enable on-chip FLASH"
|
bool "Enable on-chip FLASH"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_WDT
|
||||||
|
bool "Enable Watchdog Timer"
|
||||||
|
select RT_USING_WDT
|
||||||
|
default n
|
||||||
|
|
||||||
source "../libraries/HAL_Drivers/Kconfig"
|
source "../libraries/HAL_Drivers/Kconfig"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
Loading…
Reference in New Issue