Adapt RTduino package for stm32f469-st-disco BSP (#6139)
* Adapt RTdunio package for stm32f469-st-disco BSP
This commit is contained in:
parent
74a802b445
commit
d3139706e4
|
@ -8,6 +8,9 @@ main.c
|
|||
lcd_init.c
|
||||
""")
|
||||
|
||||
if GetDepend(['PKG_USING_RTDUINO']) and not GetDepend(['RTDUINO_NO_SETUP_LOOP']):
|
||||
src += ['arduino_main.cpp']
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
list = os.listdir(cwd)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-12-10 Meco Man first version
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
uint8_t led = LED_BUILTIN;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
/* put your setup code here, to run once: */
|
||||
pinMode(led, OUTPUT);
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
/* put your main code here, to run repeatedly: */
|
||||
digitalWrite(led, !digitalRead(led));
|
||||
delay(100);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
# STM32F69 Discovery开发板的Arduino生态兼容说明
|
||||
|
||||
## 1 RTduino - RT-Thread的Arduino生态兼容层
|
||||
|
||||
STM32F469 Discovery开发板已经完整适配了[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 --->
|
||||
[*] Support Arduino
|
||||
```
|
||||
|
||||
## 2 Arduino引脚排布
|
||||
|
||||
![disco-f469-pinout](disco-f469-pinout.png)
|
||||
|
||||
该BSP遵照Arduino UNO板的引脚排列方式。详见 `pins_arduino.c`
|
||||
|
||||
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
|
||||
| --------------- | ------------- | ------ | ------------------------------------------------------------ |
|
||||
| 0 (D0) | -- | | 该引脚在UNO板中为串口RX引脚,不可当做普通IO |
|
||||
| 1 (D1) | -- | | 该引脚在UNO板中为串口TX引脚,不可当做普通IO |
|
||||
| 2 (D2) | PG13 | 是 | |
|
||||
| 3 (D3) | PA1 | 是 | PWM(定时器2发生) |
|
||||
| 4 (D4) | PG12 | 是 | |
|
||||
| 5 (D5) | PA2 | 是 | PWM(定时器2发生) |
|
||||
| 6 (D6) | PA6 | 是 | PWM(定时器3发生) |
|
||||
| 7 (D7) | PG11 | 是 | |
|
||||
| 8 (D8) | PG10 | 是 | |
|
||||
| 9 (D9) | PA7 | 是 | PWM(定时器3发生) |
|
||||
| 10 (D10) | PH6 | 是 | PWM(定时器12发生) |
|
||||
| 11 (D11) | PB15 | 是 | PWM(定时器12发生) |
|
||||
| 12 (D12) | PB14 | 是 | |
|
||||
| 13 (D13) | PD3 | 是 | RTduino LED |
|
||||
| 14 (D14) | PB9 | 是 | I2C1-SDA,被RT-Thread的I2C设备框架i2c1总线接管,不可当做普通IO |
|
||||
| 15 (D15) | PB8 | 是 | I2C1_SCL,被RT-Thread的I2C设备框架i2c1总线接管,不可当做普通IO |
|
||||
| 16 (D16) | PA0 | 是 | Discovery板载用户按键(蓝色) |
|
||||
| 17(D17) | PG6 | 是 | user LED1(用户LED) |
|
||||
| 18(D18) | PD4 | 是 | user LED2(用户LED) |
|
||||
| 19(D19) | PD5 | 是 | user LED3(用户LED) |
|
||||
| 20(D20) | PK3 | 是 | user LED4(用户LED) |
|
||||
| A0 | PB1 | 是 | ADC Channel_9 |
|
||||
| A1 | PC2 | 是 | ADC Channel_12 |
|
||||
| A2 | PC3 | 是 | ADC Channel_13 |
|
||||
| A3 | PC4 | 是 | ADC Channel_14 |
|
||||
| A4 | PC5 | 是 | ADC Channel_15 |
|
||||
| A5 | PA4 | 是 | ADC Channel_4 |
|
||||
| A6 | -- | | 芯片内部参考电压 ADC |
|
||||
| A7 | -- | | 芯片内部温度 ADC |
|
||||
|
||||
> 注意:
|
||||
>
|
||||
> - 暂无
|
||||
|
||||
> 参考资料
|
||||
>
|
||||
> 【1】[STM32F469 Discovery官方资料](https://www.st.com/en/evaluation-tools/32f469idiscovery.html#documentation)
|
||||
|
||||
## 3 I2C总线
|
||||
|
||||
STM32F469 Discovery板的I2C总线是板上丝印的 `SCL/D15` 和 `SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
|
|
@ -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: 138 KiB |
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-07-04 solar first version
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
#include <board.h>
|
||||
#include "pins_arduino.h"
|
||||
|
||||
/*
|
||||
{Arduino Pin, RT-Thread Pin [, Device Name(PWM or ADC), 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}, /* RX */
|
||||
{D1}, /* TX */
|
||||
{D2, GET_PIN(G,13)},
|
||||
{D3, GET_PIN(A,1), "pwm2", 2}, /* PWM */
|
||||
{D4, GET_PIN(G,12)},
|
||||
{D5, GET_PIN(A,2), "pwm2", 3}, /* PWM */
|
||||
{D6, GET_PIN(A,6), "pwm3", 1}, /* PWM */
|
||||
{D7, GET_PIN(G,11)},
|
||||
{D8, GET_PIN(G,10)},
|
||||
{D9, GET_PIN(A,7), "pwm3", 2}, /* PWM */
|
||||
{D10, GET_PIN(H,6),"pwm12", 1}, /* PWM */
|
||||
{D11, GET_PIN(B,15),"pwm12", 2}, /* PWM */
|
||||
{D12, GET_PIN(B,14)},
|
||||
{D13, GET_PIN(D,3)},
|
||||
{D14}, /* I2C1-SDA */
|
||||
{D15}, /* I2C1-SCL */
|
||||
{D16, GET_PIN(A,0)}, /* user button */
|
||||
{D17, GET_PIN(G,6)}, /* user LED */
|
||||
{D18, GET_PIN(D,4)}, /* user LED */
|
||||
{D19, GET_PIN(D,5)}, /* user LED */
|
||||
{D20, GET_PIN(K,3)}, /* user LED */
|
||||
{A0, GET_PIN(B,1), "adc1", 9}, /* ADC */
|
||||
{A1, GET_PIN(C,2), "adc1", 12}, /* ADC */
|
||||
{A2, GET_PIN(C,3), "adc1", 13}, /* ADC */
|
||||
{A3, GET_PIN(C,4), "adc1", 14}, /* ADC */
|
||||
{A4, GET_PIN(C,5), "adc1", 15}, /* ADC */
|
||||
{A5, GET_PIN(A,4), "adc1", 4}, /* 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,50 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-07-04 solar 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 D17 (17)
|
||||
#define D18 (18)
|
||||
#define D19 (19)
|
||||
#define D20 (20)
|
||||
#define A0 (21)
|
||||
#define A1 (22)
|
||||
#define A2 (23)
|
||||
#define A3 (24)
|
||||
#define A4 (25)
|
||||
#define A5 (26)
|
||||
#define A6 (27)
|
||||
#define A7 (28)
|
||||
|
||||
#define F_CPU 180000000L /* CPU: 180MHz */
|
||||
#define LED_BUILTIN D13 /* Default Built-in LED */
|
||||
|
||||
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,10 @@
|
|||
#MicroXplorer Configuration settings - do not modify
|
||||
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_9
|
||||
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
|
||||
DSIHOST_CKN.Mode=DSIHost_Video
|
||||
DSIHOST_CKN.Signal=DSIHOST_CKN
|
||||
DSIHOST_CKP.Mode=DSIHost_Video
|
||||
|
@ -38,28 +44,41 @@ I2S3.Standard=I2S_STANDARD_LSB
|
|||
I2S3.VirtualMode=I2S_MODE_MASTER
|
||||
KeepUserPlacement=false
|
||||
Mcu.Family=STM32F4
|
||||
Mcu.IP0=CRC
|
||||
Mcu.IP1=DMA2D
|
||||
Mcu.IP0=ADC1
|
||||
Mcu.IP1=CRC
|
||||
Mcu.IP10=RCC
|
||||
Mcu.IP11=SDIO
|
||||
Mcu.IP12=SYS
|
||||
Mcu.IP13=TIM4
|
||||
Mcu.IP14=USART3
|
||||
Mcu.IP15=USB_OTG_FS
|
||||
Mcu.IP2=DSIHOST
|
||||
Mcu.IP3=FMC
|
||||
Mcu.IP4=GFXSIMULATOR
|
||||
Mcu.IP13=TIM2
|
||||
Mcu.IP14=TIM3
|
||||
Mcu.IP15=TIM4
|
||||
Mcu.IP16=TIM12
|
||||
Mcu.IP17=USART3
|
||||
Mcu.IP18=USB_OTG_FS
|
||||
Mcu.IP2=DMA2D
|
||||
Mcu.IP3=DSIHOST
|
||||
Mcu.IP4=FMC
|
||||
Mcu.IP5=I2S3
|
||||
Mcu.IP6=LTDC
|
||||
Mcu.IP7=NVIC
|
||||
Mcu.IP8=PDM2PCM
|
||||
Mcu.IP9=QUADSPI
|
||||
Mcu.IPNb=16
|
||||
Mcu.IPNb=19
|
||||
Mcu.Name=STM32F469NIHx
|
||||
Mcu.Package=TFBGA216
|
||||
Mcu.Pin0=PE1
|
||||
Mcu.Pin1=PE0
|
||||
Mcu.Pin10=PD0
|
||||
Mcu.Pin100=PB15
|
||||
Mcu.Pin101=VP_CRC_VS_CRC
|
||||
Mcu.Pin102=VP_DMA2D_VS_DMA2D
|
||||
Mcu.Pin103=VP_LTDC_DSIMode
|
||||
Mcu.Pin104=VP_PDM2PCM_VS_PDM2PCM
|
||||
Mcu.Pin105=VP_SYS_VS_Systick
|
||||
Mcu.Pin106=VP_TIM2_VS_ClockSourceINT
|
||||
Mcu.Pin107=VP_TIM3_VS_ClockSourceINT
|
||||
Mcu.Pin108=VP_TIM4_VS_ControllerModeClock
|
||||
Mcu.Pin109=VP_TIM12_VS_ClockSourceINT
|
||||
Mcu.Pin11=PC11
|
||||
Mcu.Pin12=PC10
|
||||
Mcu.Pin13=PA12
|
||||
|
@ -111,48 +130,53 @@ Mcu.Pin54=PD10
|
|||
Mcu.Pin55=PF10
|
||||
Mcu.Pin56=PF9
|
||||
Mcu.Pin57=PF8
|
||||
Mcu.Pin58=PD14
|
||||
Mcu.Pin59=PD9
|
||||
Mcu.Pin58=PC3
|
||||
Mcu.Pin59=PD14
|
||||
Mcu.Pin6=PA13
|
||||
Mcu.Pin60=PD8
|
||||
Mcu.Pin61=PC0
|
||||
Mcu.Pin62=PF12
|
||||
Mcu.Pin63=PG1
|
||||
Mcu.Pin64=PF15
|
||||
Mcu.Pin65=PD12
|
||||
Mcu.Pin66=PD13
|
||||
Mcu.Pin67=PH12
|
||||
Mcu.Pin68=PF13
|
||||
Mcu.Pin69=PG0
|
||||
Mcu.Pin60=PD9
|
||||
Mcu.Pin61=PD8
|
||||
Mcu.Pin62=PC0
|
||||
Mcu.Pin63=PC2
|
||||
Mcu.Pin64=PF12
|
||||
Mcu.Pin65=PG1
|
||||
Mcu.Pin66=PF15
|
||||
Mcu.Pin67=PD12
|
||||
Mcu.Pin68=PD13
|
||||
Mcu.Pin69=PH12
|
||||
Mcu.Pin7=PB6
|
||||
Mcu.Pin70=PE8
|
||||
Mcu.Pin71=PG5
|
||||
Mcu.Pin72=PG4
|
||||
Mcu.Pin73=PH9
|
||||
Mcu.Pin74=PH11
|
||||
Mcu.Pin75=PF14
|
||||
Mcu.Pin76=PF11
|
||||
Mcu.Pin77=PE9
|
||||
Mcu.Pin78=PE11
|
||||
Mcu.Pin79=PE14
|
||||
Mcu.Pin70=PA1
|
||||
Mcu.Pin71=PA4
|
||||
Mcu.Pin72=PC4
|
||||
Mcu.Pin73=PF13
|
||||
Mcu.Pin74=PG0
|
||||
Mcu.Pin75=PE8
|
||||
Mcu.Pin76=PG5
|
||||
Mcu.Pin77=PG4
|
||||
Mcu.Pin78=PH9
|
||||
Mcu.Pin79=PH11
|
||||
Mcu.Pin8=PG15
|
||||
Mcu.Pin80=PB10
|
||||
Mcu.Pin81=PH8
|
||||
Mcu.Pin82=PH10
|
||||
Mcu.Pin83=PE7
|
||||
Mcu.Pin84=PE10
|
||||
Mcu.Pin85=PE12
|
||||
Mcu.Pin86=PE15
|
||||
Mcu.Pin87=PE13
|
||||
Mcu.Pin88=PB11
|
||||
Mcu.Pin89=VP_CRC_VS_CRC
|
||||
Mcu.Pin80=PA2
|
||||
Mcu.Pin81=PA6
|
||||
Mcu.Pin82=PC5
|
||||
Mcu.Pin83=PF14
|
||||
Mcu.Pin84=PF11
|
||||
Mcu.Pin85=PE9
|
||||
Mcu.Pin86=PE11
|
||||
Mcu.Pin87=PE14
|
||||
Mcu.Pin88=PB10
|
||||
Mcu.Pin89=PH6
|
||||
Mcu.Pin9=PD6
|
||||
Mcu.Pin90=VP_DMA2D_VS_DMA2D
|
||||
Mcu.Pin91=VP_LTDC_DSIMode
|
||||
Mcu.Pin92=VP_PDM2PCM_VS_PDM2PCM
|
||||
Mcu.Pin93=VP_SYS_VS_Systick
|
||||
Mcu.Pin94=VP_TIM4_VS_ControllerModeClock
|
||||
Mcu.PinsNb=95
|
||||
Mcu.Pin90=PH8
|
||||
Mcu.Pin91=PH10
|
||||
Mcu.Pin92=PA7
|
||||
Mcu.Pin93=PB1
|
||||
Mcu.Pin94=PE7
|
||||
Mcu.Pin95=PE10
|
||||
Mcu.Pin96=PE12
|
||||
Mcu.Pin97=PE15
|
||||
Mcu.Pin98=PE13
|
||||
Mcu.Pin99=PB11
|
||||
Mcu.PinsNb=110
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F469NIHx
|
||||
|
@ -160,6 +184,7 @@ MxCube.Version=5.1.0
|
|||
MxDb.Version=DB.5.0.10
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
|
@ -170,6 +195,8 @@ NVIC.SPI3_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
|||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||
PA1.Locked=true
|
||||
PA1.Signal=S_TIM2_CH2
|
||||
PA11.Mode=Device_Only
|
||||
PA11.Signal=USB_OTG_FS_DM
|
||||
PA12.Mode=Device_Only
|
||||
|
@ -182,6 +209,15 @@ PA15.GPIOParameters=GPIO_Speed
|
|||
PA15.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||
PA15.Mode=Half_Duplex_Master
|
||||
PA15.Signal=I2S3_WS
|
||||
PA2.Signal=S_TIM2_CH3
|
||||
PA4.Locked=true
|
||||
PA4.Signal=ADCx_IN4
|
||||
PA6.Locked=true
|
||||
PA6.Signal=S_TIM3_CH1
|
||||
PA7.Locked=true
|
||||
PA7.Signal=S_TIM3_CH2
|
||||
PB1.Locked=true
|
||||
PB1.Signal=ADCx_IN9
|
||||
PB10.GPIOParameters=GPIO_PuPd
|
||||
PB10.GPIO_PuPd=GPIO_PULLUP
|
||||
PB10.Mode=Asynchronous
|
||||
|
@ -190,6 +226,8 @@ PB11.GPIOParameters=GPIO_PuPd
|
|||
PB11.GPIO_PuPd=GPIO_PULLUP
|
||||
PB11.Mode=Asynchronous
|
||||
PB11.Signal=USART3_RX
|
||||
PB15.Locked=true
|
||||
PB15.Signal=S_TIM12_CH2
|
||||
PB3.GPIOParameters=GPIO_Speed
|
||||
PB3.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||
PB3.Mode=Half_Duplex_Master
|
||||
|
@ -208,18 +246,18 @@ PC14/OSC32_IN.Mode=LSE-External-Oscillator
|
|||
PC14/OSC32_IN.Signal=RCC_OSC32_IN
|
||||
PC15/OSC32_OUT.Mode=LSE-External-Oscillator
|
||||
PC15/OSC32_OUT.Signal=RCC_OSC32_OUT
|
||||
PC2.Locked=true
|
||||
PC2.Signal=ADCx_IN12
|
||||
PC3.Locked=true
|
||||
PC3.Signal=ADCx_IN13
|
||||
PC4.Locked=true
|
||||
PC4.Signal=ADCx_IN14
|
||||
PC5.Locked=true
|
||||
PC5.Signal=ADCx_IN15
|
||||
PC8.Mode=SD_4_bits_Wide_bus
|
||||
PC8.Signal=SDIO_D0
|
||||
PC9.Mode=SD_4_bits_Wide_bus
|
||||
PC9.Signal=SDIO_D1
|
||||
PCC.Checker=false
|
||||
PCC.Line=STM32F469/479
|
||||
PCC.MCU=STM32F469NIHx
|
||||
PCC.PartNumber=STM32F469NIHx
|
||||
PCC.Seq0=0
|
||||
PCC.Series=STM32F4
|
||||
PCC.Temperature=25
|
||||
PCC.Vdd=3.3
|
||||
PD0.Signal=FMC_D2_DA2
|
||||
PD1.Signal=FMC_D3_DA3
|
||||
PD10.Signal=FMC_D15_DA15
|
||||
|
@ -296,6 +334,8 @@ PH2.Mode=SdramChipSelect1_1
|
|||
PH2.Signal=FMC_SDCKE0
|
||||
PH3.Mode=SdramChipSelect1_1
|
||||
PH3.Signal=FMC_SDNE0
|
||||
PH6.Locked=true
|
||||
PH6.Signal=S_TIM12_CH1
|
||||
PH8.Signal=FMC_D16
|
||||
PH9.Signal=FMC_D17
|
||||
PI0.Signal=FMC_D24
|
||||
|
@ -332,11 +372,12 @@ ProjectManager.PreviousToolchain=
|
|||
ProjectManager.ProjectBuild=false
|
||||
ProjectManager.ProjectFileName=CubeMX_Config.ioc
|
||||
ProjectManager.ProjectName=CubeMX_Config
|
||||
ProjectManager.RegisterCallBack=
|
||||
ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=MDK-ARM V5
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_USART3_UART_Init-USART3-false-HAL-true,3-MX_FMC_Init-FMC-false-HAL-true,4-MX_QUADSPI_Init-QUADSPI-false-HAL-true,5-MX_GFXSIMULATOR_Init-GFXSIMULATOR-false-HAL-true,6-MX_CRC_Init-CRC-false-HAL-true,7-MX_I2S3_Init-I2S3-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_PDM2PCM_Init-PDM2PCM-false-HAL-true,10-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true,11-SystemClock_Config-RCC-false-HAL-false,12-MX_LTDC_Init-LTDC-false-HAL-true,13-MX_DMA2D_Init-DMA2D-false-HAL-true,14-MX_DSIHOST_DSI_Init-DSIHOST-false-HAL-true,15-MX_SDIO_SD_Init-SDIO-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_USART3_UART_Init-USART3-false-HAL-true,3-MX_FMC_Init-FMC-false-HAL-true,4-MX_QUADSPI_Init-QUADSPI-false-HAL-true,5-MX_CRC_Init-CRC-false-HAL-true,6-MX_I2S3_Init-I2S3-false-HAL-true,7-MX_TIM4_Init-TIM4-false-HAL-true,8-MX_PDM2PCM_Init-PDM2PCM-false-HAL-false,9-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true,10-SystemClock_Config-RCC-false-HAL-false,11-MX_LTDC_Init-LTDC-false-HAL-true,12-MX_DMA2D_Init-DMA2D-false-HAL-true,13-MX_DSIHOST_DSI_Init-DSIHOST-false-HAL-true,14-MX_SDIO_SD_Init-SDIO-false-HAL-true
|
||||
QUADSPI.ChipSelectHighTime=QSPI_CS_HIGH_TIME_5_CYCLE
|
||||
QUADSPI.ClockPrescaler=1
|
||||
QUADSPI.FifoThreshold=4
|
||||
|
@ -393,6 +434,18 @@ RCC.VCOI2SOutputFreq_Value=192000000
|
|||
RCC.VCOInputFreq_Value=1000000
|
||||
RCC.VCOOutputFreq_Value=360000000
|
||||
RCC.VCOSAIOutputFreq_Value=192000000
|
||||
SH.ADCx_IN12.0=ADC1_IN12,IN12
|
||||
SH.ADCx_IN12.ConfNb=1
|
||||
SH.ADCx_IN13.0=ADC1_IN13,IN13
|
||||
SH.ADCx_IN13.ConfNb=1
|
||||
SH.ADCx_IN14.0=ADC1_IN14,IN14
|
||||
SH.ADCx_IN14.ConfNb=1
|
||||
SH.ADCx_IN15.0=ADC1_IN15,IN15
|
||||
SH.ADCx_IN15.ConfNb=1
|
||||
SH.ADCx_IN4.0=ADC1_IN4,IN4
|
||||
SH.ADCx_IN4.ConfNb=1
|
||||
SH.ADCx_IN9.0=ADC1_IN9,IN9
|
||||
SH.ADCx_IN9.ConfNb=1
|
||||
SH.FMC_A0.0=FMC_A0,12b-sda1
|
||||
SH.FMC_A0.ConfNb=1
|
||||
SH.FMC_A1.0=FMC_A1,12b-sda1
|
||||
|
@ -501,10 +554,31 @@ SH.FMC_SDNRAS.0=FMC_SDNRAS,12b-sda1
|
|||
SH.FMC_SDNRAS.ConfNb=1
|
||||
SH.FMC_SDNWE.0=FMC_SDNWE,12b-sda1
|
||||
SH.FMC_SDNWE.ConfNb=1
|
||||
SH.S_TIM12_CH1.0=TIM12_CH1,Forced Output1 CH1
|
||||
SH.S_TIM12_CH1.ConfNb=1
|
||||
SH.S_TIM12_CH2.0=TIM12_CH2,PWM Generation2 CH2
|
||||
SH.S_TIM12_CH2.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.ConfNb=1
|
||||
SH.S_TIM3_CH2.0=TIM3_CH2,PWM Generation2 CH2
|
||||
SH.S_TIM3_CH2.ConfNb=1
|
||||
SH.S_TIM4_CH1.0=TIM4_CH1,TriggerSource_TI1FP1
|
||||
SH.S_TIM4_CH1.ConfNb=1
|
||||
SH.S_TIM4_CH2.0=TIM4_CH2,PWM Generation2 CH2
|
||||
SH.S_TIM4_CH2.ConfNb=1
|
||||
TIM12.Channel-Forced\ Output1\ CH1=TIM_CHANNEL_1
|
||||
TIM12.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||
TIM12.IPParameters=Channel-Forced Output1 CH1,Channel-PWM Generation2 CH2
|
||||
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\ Generation2\ CH2=TIM_CHANNEL_2
|
||||
TIM3.IPParameters=Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2
|
||||
TIM4.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||
TIM4.IPParameters=Channel-PWM Generation2 CH2,Prescaler,Period,Slave_TriggerPolarity,Pulse-PWM Generation2 CH2
|
||||
TIM4.Period=1
|
||||
|
@ -525,6 +599,12 @@ VP_PDM2PCM_VS_PDM2PCM.Mode=PDM2PCM_Channel
|
|||
VP_PDM2PCM_VS_PDM2PCM.Signal=PDM2PCM_VS_PDM2PCM
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
VP_TIM12_VS_ClockSourceINT.Mode=Internal
|
||||
VP_TIM12_VS_ClockSourceINT.Signal=TIM12_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.Signal=TIM3_VS_ClockSourceINT
|
||||
VP_TIM4_VS_ControllerModeClock.Mode=Clock Mode
|
||||
VP_TIM4_VS_ControllerModeClock.Signal=TIM4_VS_ControllerModeClock
|
||||
board=custom
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
/* Global variables ---------------------------------------------------------*/
|
||||
extern PDM_Filter_Handler_t PDM1_filter_handler;
|
||||
extern PDM_Filter_Config_t PDM1_filter_config;
|
||||
extern PDM_Filter_Handler_t PDM2_filter_handler;
|
||||
extern PDM_Filter_Config_t PDM2_filter_config;
|
||||
|
||||
/* USER CODE BEGIN 1 */
|
||||
/* USER CODE END 1 */
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f4xx_hal_conf.h
|
||||
* @brief HAL configuration file.
|
||||
* @brief HAL configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
|
||||
* <h2><center>© COPYRIGHT(c) 2022 STMicroelectronics</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -30,7 +30,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F4xx_HAL_CONF_H
|
||||
|
@ -45,11 +45,11 @@
|
|||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
* @brief This is the list of modules to be used in the HAL driver
|
||||
*/
|
||||
#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_CAN_MODULE_ENABLED */
|
||||
#define HAL_CRC_MODULE_ENABLED
|
||||
|
@ -103,9 +103,9 @@
|
|||
/**
|
||||
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (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 */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
|
@ -116,7 +116,7 @@
|
|||
/**
|
||||
* @brief Internal High Speed oscillator (HSI) value.
|
||||
* This value is used by the RCC HAL module to compute the system frequency
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
* (when HSI is used as system clock source, directly or through the PLL).
|
||||
*/
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
|
||||
|
@ -125,7 +125,7 @@
|
|||
/**
|
||||
* @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*/
|
||||
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
|
||||
The real value may vary depending on the variations
|
||||
|
@ -143,8 +143,8 @@
|
|||
|
||||
/**
|
||||
* @brief External clock source for I2S peripheral
|
||||
* This value is used by the I2S HAL module to compute the I2S clock source
|
||||
* frequency, this source is inserted directly through I2S_CKIN pad.
|
||||
* This value is used by the I2S HAL module to compute the I2S clock source
|
||||
* frequency, this source is inserted directly through I2S_CKIN pad.
|
||||
*/
|
||||
#if !defined (EXTERNAL_CLOCK_VALUE)
|
||||
#define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/
|
||||
|
@ -157,16 +157,16 @@
|
|||
/**
|
||||
* @brief This is the HAL system configuration section
|
||||
*/
|
||||
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
|
||||
#define USE_RTOS 0U
|
||||
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
|
||||
#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
|
||||
#define USE_RTOS 0U
|
||||
#define PREFETCH_ENABLE 1U
|
||||
#define INSTRUCTION_CACHE_ENABLE 1U
|
||||
#define DATA_CACHE_ENABLE 1U
|
||||
|
||||
/* ########################## 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
|
||||
* HAL drivers code
|
||||
*/
|
||||
/* #define USE_FULL_ASSERT 1U */
|
||||
|
@ -183,7 +183,7 @@
|
|||
#define MAC_ADDR4 0U
|
||||
#define MAC_ADDR5 0U
|
||||
|
||||
/* 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_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 */
|
||||
|
@ -191,9 +191,9 @@
|
|||
|
||||
/* Section 2: PHY configuration section */
|
||||
|
||||
/* DP83848_PHY_ADDRESS Address*/
|
||||
/* DP83848_PHY_ADDRESS Address*/
|
||||
#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)
|
||||
/* PHY Configuration delay */
|
||||
#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
|
||||
|
@ -205,7 +205,7 @@
|
|||
|
||||
#define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */
|
||||
#define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */
|
||||
|
||||
|
||||
#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
|
||||
#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
|
||||
#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
|
||||
|
@ -220,7 +220,7 @@
|
|||
#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
|
||||
#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
|
||||
#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
|
||||
|
||||
|
||||
/* Section 4: Extended PHY Registers */
|
||||
#define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
|
||||
|
||||
|
@ -238,7 +238,7 @@
|
|||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Include module's header file
|
||||
* @brief Include module's header file
|
||||
*/
|
||||
|
||||
#ifdef HAL_RCC_MODULE_ENABLED
|
||||
|
@ -246,7 +246,7 @@
|
|||
#endif /* HAL_RCC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_EXTI_MODULE_ENABLED
|
||||
#include "stm32f4xx_ll_exti.h"
|
||||
#include "stm32f4xx_hal_exti.h"
|
||||
#endif /* HAL_EXTI_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_GPIO_MODULE_ENABLED
|
||||
|
@ -256,7 +256,7 @@
|
|||
#ifdef HAL_DMA_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_dma.h"
|
||||
#endif /* HAL_DMA_MODULE_ENABLED */
|
||||
|
||||
|
||||
#ifdef HAL_CORTEX_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_cortex.h"
|
||||
#endif /* HAL_CORTEX_MODULE_ENABLED */
|
||||
|
@ -274,7 +274,7 @@
|
|||
#endif /* HAL_CRC_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_CRYP_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_cryp.h"
|
||||
#include "stm32f4xx_hal_cryp.h"
|
||||
#endif /* HAL_CRYP_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_DMA2D_MODULE_ENABLED
|
||||
|
@ -296,7 +296,7 @@
|
|||
#ifdef HAL_FLASH_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_flash.h"
|
||||
#endif /* HAL_FLASH_MODULE_ENABLED */
|
||||
|
||||
|
||||
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_sram.h"
|
||||
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||
|
@ -311,11 +311,11 @@
|
|||
|
||||
#ifdef HAL_PCCARD_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_pccard.h"
|
||||
#endif /* HAL_PCCARD_MODULE_ENABLED */
|
||||
|
||||
#endif /* HAL_PCCARD_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_SDRAM_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_sdram.h"
|
||||
#endif /* HAL_SDRAM_MODULE_ENABLED */
|
||||
#endif /* HAL_SDRAM_MODULE_ENABLED */
|
||||
|
||||
#ifdef HAL_HASH_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_hash.h"
|
||||
|
@ -396,7 +396,7 @@
|
|||
#ifdef HAL_HCD_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_hcd.h"
|
||||
#endif /* HAL_HCD_MODULE_ENABLED */
|
||||
|
||||
|
||||
#ifdef HAL_DSI_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_dsi.h"
|
||||
#endif /* HAL_DSI_MODULE_ENABLED */
|
||||
|
@ -424,14 +424,14 @@
|
|||
#ifdef HAL_LPTIM_MODULE_ENABLED
|
||||
#include "stm32f4xx_hal_lptim.h"
|
||||
#endif /* HAL_LPTIM_MODULE_ENABLED */
|
||||
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
#ifdef USE_FULL_ASSERT
|
||||
/**
|
||||
* @brief The assert_param macro is used for function's parameters check.
|
||||
* @param expr: If expr is false, it calls assert_failed function
|
||||
* 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.
|
||||
* @retval None
|
||||
*/
|
||||
|
@ -440,13 +440,12 @@
|
|||
void assert_failed(uint8_t* file, uint32_t line);
|
||||
#else
|
||||
#define assert_param(expr) ((void)0U)
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
#endif /* USE_FULL_ASSERT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F4xx_HAL_CONF_H */
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
/* USER CODE END 0 */
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
||||
/**
|
||||
/**
|
||||
* Initializes the Global MSP.
|
||||
*/
|
||||
void HAL_MspInit(void)
|
||||
|
@ -79,6 +79,93 @@ void HAL_MspInit(void)
|
|||
/* 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
|
||||
PC3 ------> ADC1_IN13
|
||||
PC2 ------> ADC1_IN12
|
||||
PA4 ------> ADC1_IN4
|
||||
PC4 ------> ADC1_IN14
|
||||
PC5 ------> ADC1_IN15
|
||||
PB1 ------> ADC1_IN9
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_4|GPIO_PIN_5;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = 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_1;
|
||||
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
|
||||
PC3 ------> ADC1_IN13
|
||||
PC2 ------> ADC1_IN12
|
||||
PA4 ------> ADC1_IN4
|
||||
PC4 ------> ADC1_IN14
|
||||
PC5 ------> ADC1_IN15
|
||||
PB1 ------> ADC1_IN9
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_4|GPIO_PIN_5);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_1);
|
||||
|
||||
/* USER CODE BEGIN ADC1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END ADC1_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief CRC MSP Initialization
|
||||
* This function configures the hardware resources used in this example
|
||||
|
@ -532,7 +619,29 @@ void HAL_SD_MspDeInit(SD_HandleTypeDef* hsd)
|
|||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(htim_base->Instance==TIM4)
|
||||
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 END TIM3_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_TIM3_CLK_ENABLE();
|
||||
/* USER CODE BEGIN TIM3_MspInit 1 */
|
||||
|
||||
/* USER CODE END TIM3_MspInit 1 */
|
||||
}
|
||||
else if(htim_base->Instance==TIM4)
|
||||
{
|
||||
/* USER CODE BEGIN TIM4_MspInit 0 */
|
||||
|
||||
|
@ -555,13 +664,67 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base)
|
|||
|
||||
/* USER CODE END TIM4_MspInit 1 */
|
||||
}
|
||||
else if(htim_base->Instance==TIM12)
|
||||
{
|
||||
/* USER CODE BEGIN TIM12_MspInit 0 */
|
||||
|
||||
/* USER CODE END TIM12_MspInit 0 */
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_TIM12_CLK_ENABLE();
|
||||
/* USER CODE BEGIN TIM12_MspInit 1 */
|
||||
|
||||
/* USER CODE END TIM12_MspInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(htim->Instance==TIM4)
|
||||
if(htim->Instance==TIM2)
|
||||
{
|
||||
/* USER CODE BEGIN TIM2_MspPostInit 0 */
|
||||
|
||||
/* USER CODE END TIM2_MspPostInit 0 */
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
/**TIM2 GPIO Configuration
|
||||
PA1 ------> TIM2_CH2
|
||||
PA2 ------> TIM2_CH3
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2;
|
||||
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(GPIOA, &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 END TIM3_MspPostInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
/**TIM3 GPIO Configuration
|
||||
PA6 ------> TIM3_CH1
|
||||
PA7 ------> TIM3_CH2
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6|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(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN TIM3_MspPostInit 1 */
|
||||
|
||||
/* USER CODE END TIM3_MspPostInit 1 */
|
||||
}
|
||||
else if(htim->Instance==TIM4)
|
||||
{
|
||||
/* USER CODE BEGIN TIM4_MspPostInit 0 */
|
||||
|
||||
|
@ -582,6 +745,36 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
|||
|
||||
/* USER CODE END TIM4_MspPostInit 1 */
|
||||
}
|
||||
else if(htim->Instance==TIM12)
|
||||
{
|
||||
/* USER CODE BEGIN TIM12_MspPostInit 0 */
|
||||
|
||||
/* USER CODE END TIM12_MspPostInit 0 */
|
||||
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**TIM12 GPIO Configuration
|
||||
PH6 ------> TIM12_CH1
|
||||
PB15 ------> TIM12_CH2
|
||||
*/
|
||||
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_AF9_TIM12;
|
||||
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_15;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF9_TIM12;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN TIM12_MspPostInit 1 */
|
||||
|
||||
/* USER CODE END TIM12_MspPostInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
|
@ -592,7 +785,29 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim)
|
|||
*/
|
||||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
||||
{
|
||||
if(htim_base->Instance==TIM4)
|
||||
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 END TIM3_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_TIM3_CLK_DISABLE();
|
||||
/* USER CODE BEGIN TIM3_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM3_MspDeInit 1 */
|
||||
}
|
||||
else if(htim_base->Instance==TIM4)
|
||||
{
|
||||
/* USER CODE BEGIN TIM4_MspDeInit 0 */
|
||||
|
||||
|
@ -610,6 +825,17 @@ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base)
|
|||
|
||||
/* USER CODE END TIM4_MspDeInit 1 */
|
||||
}
|
||||
else if(htim_base->Instance==TIM12)
|
||||
{
|
||||
/* USER CODE BEGIN TIM12_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END TIM12_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_TIM12_CLK_DISABLE();
|
||||
/* USER CODE BEGIN TIM12_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM12_MspDeInit 1 */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
|||
/* USER CODE END EV */
|
||||
|
||||
/******************************************************************************/
|
||||
/* Cortex-M4 Processor Interruption and Exception Handlers */
|
||||
/* Cortex-M4 Processor Interruption and Exception Handlers */
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @brief This function handles Non maskable interrupt.
|
||||
|
|
|
@ -15,6 +15,31 @@ menu "Onboard Peripheral Drivers"
|
|||
select BSP_USING_TOUCH
|
||||
default n
|
||||
|
||||
config BSP_USING_ARDUINO
|
||||
bool "Support Arduino"
|
||||
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_PWM2
|
||||
select BSP_USING_PWM2_CH2
|
||||
select BSP_USING_PWM2_CH3
|
||||
select BSP_USING_PWM3
|
||||
select BSP_USING_PWM3_CH1
|
||||
select BSP_USING_PWM3_CH2
|
||||
select BSP_USING_PWM12
|
||||
select BSP_USING_PWM12_CH1
|
||||
select BSP_USING_PWM12_CH2
|
||||
select BSP_USING_I2C
|
||||
select BSP_USING_I2C1
|
||||
imply RTDUINO_USING_SERVO
|
||||
imply RTDUINO_USING_WIRE
|
||||
imply RTDUINO_USING_ADAFRUIT
|
||||
imply RTDUINO_USING_MSTIMER2
|
||||
default n
|
||||
|
||||
if BSP_USING_LVGL
|
||||
config BSP_USING_LVGL_DEMO
|
||||
bool "Enable LVGL demo"
|
||||
|
@ -103,6 +128,62 @@ menu "On-chip Peripheral Drivers"
|
|||
select RT_USING_PIN
|
||||
default y
|
||||
|
||||
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_PWM
|
||||
bool "Enable PWM"
|
||||
default n
|
||||
select RT_USING_PWM
|
||||
if BSP_USING_PWM
|
||||
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
|
||||
endif
|
||||
if BSP_USING_PWM2
|
||||
config BSP_USING_PWM2_CH3
|
||||
bool "Enable PWM2 channel3"
|
||||
default n
|
||||
endif
|
||||
menuconfig BSP_USING_PWM3
|
||||
bool "Enable timer3 output PWM"
|
||||
default n
|
||||
if BSP_USING_PWM3
|
||||
config BSP_USING_PWM3_CH1
|
||||
bool "Enable PWM3 channel1"
|
||||
default n
|
||||
endif
|
||||
if BSP_USING_PWM3
|
||||
config BSP_USING_PWM3_CH2
|
||||
bool "Enable PWM3 channel2"
|
||||
default n
|
||||
endif
|
||||
menuconfig BSP_USING_PWM12
|
||||
bool "Enable timer12 output PWM"
|
||||
default n
|
||||
if BSP_USING_PWM12
|
||||
config BSP_USING_PWM12_CH1
|
||||
bool "Enable PWM12 channel1"
|
||||
default n
|
||||
endif
|
||||
if BSP_USING_PWM12
|
||||
config BSP_USING_PWM12_CH2
|
||||
bool "Enable PWM12 channel2"
|
||||
default n
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_UART
|
||||
bool "Enable UART"
|
||||
select RT_USING_SERIAL
|
||||
|
|
Loading…
Reference in New Issue