1.新增ST-f103、f407系列BSP。
2.提高ST-ADC驱动可移植性。
This commit is contained in:
@@ -4,12 +4,12 @@
|
||||
|
||||
注:
|
||||
|
||||
- 此`BSP`仅支持`HAL`库,暂不支持标准库或`LL`库需求。
|
||||
- 此`BSP`仅支持`HAL`库,暂不支持`标准`库(可使用`WCH`驱动,自行配置即可)或`LL`库需求。
|
||||
- 此`BSP`需与`CubeMx`结合使用。
|
||||
|
||||
## 创建工程
|
||||
|
||||
使用`CubeMx`创建对应芯片的工程。使能需要使用的功能(仅需要配置管脚映射关系,不需要设置具体参数值)。
|
||||
使用`CubeMx`创建对应芯片的工程。使能需要使用的功能(配置管脚映射关系等)。
|
||||
|
||||
注:禁止使能中断,否则会报重复定义错误(`MR`框架已接管中断)。
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
## 移植驱动
|
||||
|
||||
参考上一步中`stm32xxx/driver`路径下`Kconfig`和`mr_board.h`,修改参数,完成移植与裁剪。
|
||||
参考上一步中`stm32xxx/driver`路径下`Kconfig`和`mr_board.h`,修改参数,完成移植与裁剪(请注意,`BSP`是按同一系列中最高型号进行移植的,
|
||||
在选择和使用外设时请先查阅芯片手册核对当前芯片是否有此外设)。
|
||||
|
||||
## 继续按仓库目录下`README`,添加 mr-library
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
Note:
|
||||
|
||||
- This `BSP` only supports the `HAL` library, and does not currently support `standard` library or `LL` library requirements.
|
||||
- This `BSP` only supports the `HAL` library, and does not currently support `standard` library(`WCH` driver can be used, you can configure yourself) or `LL` library requirements.
|
||||
- This `BSP` needs to be used together with `CubeMx`.
|
||||
|
||||
## Create project
|
||||
|
||||
Use `CubeMx` to create a project for the corresponding chip. Enable the required functions (only need to configure pin
|
||||
mapping relationships, no need to set specific parameter values).
|
||||
Use `CubeMx` to create a project for the corresponding chip. Enable the required functions(Configure pin mapping, etc).
|
||||
|
||||
Note: Do not enable interrupts, otherwise it will report redefinition errors (the `MR` framework has taken over
|
||||
interrupts).
|
||||
@@ -22,6 +21,7 @@ Copy `bsp/st/driver` and `stm32xxx/driver` files to `driver`.
|
||||
## Port driver
|
||||
|
||||
Refer to the `stm32xxx/driver` path `Kconfig` and `mr_board.h` in the previous step to modify parameters and complete
|
||||
the migration and tailoring.
|
||||
the migration and tailoring(Note that the `BSP` is ported to the highest model in the same series,
|
||||
When selecting and using peripherals, please refer to the chip manual to check whether the current chip has additional devices).
|
||||
|
||||
## Continue to add mr-library by pressing `README` in the repository directory
|
||||
|
||||
@@ -71,23 +71,22 @@ static int drv_adc_configure(struct mr_adc *adc, int state)
|
||||
if (state == ENABLE)
|
||||
{
|
||||
/* Configure ADC */
|
||||
adc_data->handle.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
|
||||
#if defined(ADC_RESOLUTION_12B)
|
||||
adc_data->handle.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
#elif defined(ADC_RESOLUTION_10B)
|
||||
adc_data->handle.Init.Resolution = ADC_RESOLUTION_10B;
|
||||
#else
|
||||
#elif defined(ADC_RESOLUTION_8B)
|
||||
adc_data->handle.Init.Resolution = ADC_RESOLUTION_8B;
|
||||
#endif /* defined(ADC_RESOLUTION_12B) */
|
||||
adc_data->handle.Init.ScanConvMode = DISABLE;
|
||||
adc_data->handle.Init.ContinuousConvMode = DISABLE;
|
||||
adc_data->handle.Init.DiscontinuousConvMode = DISABLE;
|
||||
adc_data->handle.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
|
||||
adc_data->handle.Init.ExternalTrigConv = ADC_SOFTWARE_START;
|
||||
adc_data->handle.Init.DataAlign = ADC_DATAALIGN_RIGHT;
|
||||
adc_data->handle.Init.NbrOfConversion = 1;
|
||||
adc_data->handle.Init.DMAContinuousRequests = DISABLE;
|
||||
#if defined(ADC_EOC_SINGLE_CONV)
|
||||
adc_data->handle.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
|
||||
#endif /* defined(ADC_EOC_SINGLE_CONV) */
|
||||
HAL_ADC_Init(&adc_data->handle);
|
||||
} else
|
||||
{
|
||||
@@ -117,7 +116,25 @@ static uint32_t drv_adc_read(struct mr_adc *adc, int channel)
|
||||
/* Read data */
|
||||
sConfig.Channel = adc_channel_data->channel;
|
||||
sConfig.Rank = 1;
|
||||
#if defined(ADC_SAMPLETIME_55CYCLES_5)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_55CYCLES_5;
|
||||
#elif defined(ADC_SAMPLETIME_56CYCLES)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_56CYCLES;
|
||||
#elif defined(ADC_SAMPLETIME_71CYCLES_5)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_71CYCLES_5;
|
||||
#elif defined(ADC_SAMPLETIME_84CYCLES)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_84CYCLES;
|
||||
#elif defined(ADC_SAMPLETIME_112CYCLES)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_112CYCLES;
|
||||
#elif defined(ADC_SAMPLETIME_144CYCLES)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_144CYCLES;
|
||||
#elif defined(ADC_SAMPLETIME_239CYCLES_5)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_239CYCLES_5;
|
||||
#elif defined(ADC_SAMPLETIME_247CYCLES_5)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_247CYCLES_5;
|
||||
#elif defined(ADC_SAMPLETIME_480CYCLES)
|
||||
sConfig.SamplingTime = ADC_SAMPLETIME_480CYCLES;
|
||||
#endif /* defined(ADC_SAMPLETIME_55CYCLES_5) */
|
||||
HAL_ADC_ConfigChannel(&adc_data->handle, &sConfig);
|
||||
HAL_ADC_Start(&adc_data->handle);
|
||||
HAL_ADC_PollForConversion(&adc_data->handle, UINT16_MAX);
|
||||
|
||||
@@ -383,7 +383,7 @@ static struct mr_drv spi_bus_drv[] =
|
||||
|
||||
int drv_spi_bus_init(void)
|
||||
{
|
||||
for (size_t i = 0; index < MR_ARRAY_NUM(spi_bus_dev); i++)
|
||||
for (size_t i = 0; i < MR_ARRAY_NUM(spi_bus_dev); i++)
|
||||
{
|
||||
mr_spi_bus_register(&spi_bus_dev[i], spi_bus_name[i], &spi_bus_drv[i]);
|
||||
}
|
||||
|
||||
169
bsp/st/stm32f103/driver/Kconfig
Normal file
169
bsp/st/stm32f103/driver/Kconfig
Normal file
@@ -0,0 +1,169 @@
|
||||
menu "Driver configure"
|
||||
|
||||
menu "ADC"
|
||||
config MR_USING_ADC1
|
||||
bool "Enable ADC1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_ADC2
|
||||
bool "Enable ADC2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_ADC3
|
||||
bool "Enable ADC3 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "PWM"
|
||||
config MR_USING_PWM1
|
||||
bool "Enable PWM1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM2
|
||||
bool "Enable PWM2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM3
|
||||
bool "Enable PWM3 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM4
|
||||
bool "Enable PWM4 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM5
|
||||
bool "Enable PWM5 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM6
|
||||
bool "Enable PWM6 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM7
|
||||
bool "Enable PWM7 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM8
|
||||
bool "Enable PWM8 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM9
|
||||
bool "Enable PWM9 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM10
|
||||
bool "Enable PWM10 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM11
|
||||
bool "Enable PWM11 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM12
|
||||
bool "Enable PWM12 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM13
|
||||
bool "Enable PWM13 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM14
|
||||
bool "Enable PWM14 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "UART"
|
||||
config MR_USING_UART1
|
||||
bool "Enable UART1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART2
|
||||
bool "Enable UART2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART3
|
||||
bool "Enable UART3 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART4
|
||||
bool "Enable UART4 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART5
|
||||
bool "Enable UART5 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "SPI"
|
||||
config MR_USING_SPI1
|
||||
bool "Enable SPI1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_SPI2
|
||||
bool "Enable SPI2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_SPI3
|
||||
bool "Enable SPI3 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "Timer"
|
||||
config MR_USING_TIMER1
|
||||
bool "Enable Timer1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER2
|
||||
bool "Enable Timer2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER3
|
||||
bool "Enable Timer3 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER4
|
||||
bool "Enable Timer4 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER5
|
||||
bool "Enable Timer5 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER6
|
||||
bool "Enable Timer6 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER7
|
||||
bool "Enable Timer7 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER8
|
||||
bool "Enable Timer8 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER9
|
||||
bool "Enable Timer9 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER10
|
||||
bool "Enable Timer10 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER11
|
||||
bool "Enable Timer11 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER12
|
||||
bool "Enable Timer12 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER13
|
||||
bool "Enable Timer13 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER14
|
||||
bool "Enable Timer14 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
174
bsp/st/stm32f103/driver/mr_board.h
Normal file
174
bsp/st/stm32f103/driver/mr_board.h
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* @copyright (c) 2023-2024, MR Development Team
|
||||
*
|
||||
* @license SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* @date 2023-12-12 MacRsh First version
|
||||
*/
|
||||
|
||||
#ifndef _MR_BOARD_H_
|
||||
#define _MR_BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "stm32f1xx.h"
|
||||
|
||||
#define DRV_ADC_CHANNEL_CONFIG \
|
||||
{ \
|
||||
{ADC_CHANNEL_0}, \
|
||||
{ADC_CHANNEL_1}, \
|
||||
{ADC_CHANNEL_2}, \
|
||||
{ADC_CHANNEL_3}, \
|
||||
{ADC_CHANNEL_4}, \
|
||||
{ADC_CHANNEL_5}, \
|
||||
{ADC_CHANNEL_6}, \
|
||||
{ADC_CHANNEL_7}, \
|
||||
{ADC_CHANNEL_8}, \
|
||||
{ADC_CHANNEL_9}, \
|
||||
{ADC_CHANNEL_10}, \
|
||||
{ADC_CHANNEL_11}, \
|
||||
{ADC_CHANNEL_12}, \
|
||||
{ADC_CHANNEL_13}, \
|
||||
{ADC_CHANNEL_14}, \
|
||||
{ADC_CHANNEL_15}, \
|
||||
{ADC_CHANNEL_16}, \
|
||||
{ADC_CHANNEL_17}, \
|
||||
}
|
||||
|
||||
#define DRV_PIN_IRQ_MAP_CONFIG \
|
||||
{ \
|
||||
EXTI0_IRQn, \
|
||||
EXTI1_IRQn, \
|
||||
EXTI2_IRQn, \
|
||||
EXTI3_IRQn, \
|
||||
EXTI4_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
}
|
||||
|
||||
#ifdef GPIOD
|
||||
#define DRV_PIN_PORT_D GPIOD,
|
||||
#else
|
||||
#define DRV_PIN_PORT_D
|
||||
#endif /* GPIOD */
|
||||
#ifdef GPIOE
|
||||
#define DRV_PIN_PORT_E GPIOE,
|
||||
#else
|
||||
#define DRV_PIN_PORT_E
|
||||
#endif /* GPIOE */
|
||||
#ifdef GPIOF
|
||||
#define DRV_PIN_PORT_F GPIOF,
|
||||
#else
|
||||
#define DRV_PIN_PORT_F
|
||||
#endif /* GPIOF */
|
||||
#ifdef GPIOG
|
||||
#define DRV_PIN_PORT_G GPIOG,
|
||||
#else
|
||||
#define DRV_PIN_PORT_G
|
||||
#endif /* GPIOG */
|
||||
|
||||
#define DRV_PIN_PORT_CONFIG \
|
||||
{ \
|
||||
GPIOA, \
|
||||
GPIOB, \
|
||||
GPIOC, \
|
||||
DRV_PIN_PORT_D \
|
||||
DRV_PIN_PORT_E \
|
||||
DRV_PIN_PORT_F \
|
||||
DRV_PIN_PORT_G \
|
||||
}
|
||||
|
||||
#define DRV_PIN_CONFIG \
|
||||
{ \
|
||||
GPIO_PIN_0, \
|
||||
GPIO_PIN_1, \
|
||||
GPIO_PIN_2, \
|
||||
GPIO_PIN_3, \
|
||||
GPIO_PIN_4, \
|
||||
GPIO_PIN_5, \
|
||||
GPIO_PIN_6, \
|
||||
GPIO_PIN_7, \
|
||||
GPIO_PIN_8, \
|
||||
GPIO_PIN_9, \
|
||||
GPIO_PIN_10, \
|
||||
GPIO_PIN_11, \
|
||||
GPIO_PIN_12, \
|
||||
GPIO_PIN_13, \
|
||||
GPIO_PIN_14, \
|
||||
GPIO_PIN_15, \
|
||||
}
|
||||
|
||||
#define DRV_PWM1_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM2_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM3_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM4_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM5_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM6_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM7_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM8_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM9_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM10_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM11_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM12_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM13_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM14_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
|
||||
#define DRV_TIMER1_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER2_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER3_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER4_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER5_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER6_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER7_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER8_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER9_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER10_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER11_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER12_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER13_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER14_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _MR_BOARD_H_ */
|
||||
173
bsp/st/stm32f407/driver/Kconfig
Normal file
173
bsp/st/stm32f407/driver/Kconfig
Normal file
@@ -0,0 +1,173 @@
|
||||
menu "Driver configure"
|
||||
|
||||
menu "ADC"
|
||||
config MR_USING_ADC1
|
||||
bool "Enable ADC1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_ADC2
|
||||
bool "Enable ADC2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_ADC3
|
||||
bool "Enable ADC3 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "PWM"
|
||||
config MR_USING_PWM1
|
||||
bool "Enable PWM1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM2
|
||||
bool "Enable PWM2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM3
|
||||
bool "Enable PWM3 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM4
|
||||
bool "Enable PWM4 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM5
|
||||
bool "Enable PWM5 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM6
|
||||
bool "Enable PWM6 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM7
|
||||
bool "Enable PWM7 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM8
|
||||
bool "Enable PWM8 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM9
|
||||
bool "Enable PWM9 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM10
|
||||
bool "Enable PWM10 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM11
|
||||
bool "Enable PWM11 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM12
|
||||
bool "Enable PWM12 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM13
|
||||
bool "Enable PWM13 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_PWM14
|
||||
bool "Enable PWM14 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "UART"
|
||||
config MR_USING_UART1
|
||||
bool "Enable UART1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART2
|
||||
bool "Enable UART2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART3
|
||||
bool "Enable UART3 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART4
|
||||
bool "Enable UART4 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART5
|
||||
bool "Enable UART5 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_UART6
|
||||
bool "Enable UART6 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "SPI"
|
||||
config MR_USING_SPI1
|
||||
bool "Enable SPI1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_SPI2
|
||||
bool "Enable SPI2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_SPI3
|
||||
bool "Enable SPI3 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "Timer"
|
||||
config MR_USING_TIMER1
|
||||
bool "Enable Timer1 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER2
|
||||
bool "Enable Timer2 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER3
|
||||
bool "Enable Timer3 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER4
|
||||
bool "Enable Timer4 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER5
|
||||
bool "Enable Timer5 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER6
|
||||
bool "Enable Timer6 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER7
|
||||
bool "Enable Timer7 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER8
|
||||
bool "Enable Timer8 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER9
|
||||
bool "Enable Timer9 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER10
|
||||
bool "Enable Timer10 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER11
|
||||
bool "Enable Timer11 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER12
|
||||
bool "Enable Timer12 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER13
|
||||
bool "Enable Timer13 driver"
|
||||
default n
|
||||
|
||||
config MR_USING_TIMER14
|
||||
bool "Enable Timer14 driver"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
174
bsp/st/stm32f407/driver/mr_board.h
Normal file
174
bsp/st/stm32f407/driver/mr_board.h
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* @copyright (c) 2023-2024, MR Development Team
|
||||
*
|
||||
* @license SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* @date 2023-12-12 MacRsh First version
|
||||
*/
|
||||
|
||||
#ifndef _MR_BOARD_H_
|
||||
#define _MR_BOARD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "stm32f4xx.h"
|
||||
|
||||
#define DRV_ADC_CHANNEL_CONFIG \
|
||||
{ \
|
||||
{ADC_CHANNEL_0}, \
|
||||
{ADC_CHANNEL_1}, \
|
||||
{ADC_CHANNEL_2}, \
|
||||
{ADC_CHANNEL_3}, \
|
||||
{ADC_CHANNEL_4}, \
|
||||
{ADC_CHANNEL_5}, \
|
||||
{ADC_CHANNEL_6}, \
|
||||
{ADC_CHANNEL_7}, \
|
||||
{ADC_CHANNEL_8}, \
|
||||
{ADC_CHANNEL_9}, \
|
||||
{ADC_CHANNEL_10}, \
|
||||
{ADC_CHANNEL_11}, \
|
||||
{ADC_CHANNEL_12}, \
|
||||
{ADC_CHANNEL_13}, \
|
||||
{ADC_CHANNEL_14}, \
|
||||
{ADC_CHANNEL_15}, \
|
||||
{ADC_CHANNEL_16}, \
|
||||
{ADC_CHANNEL_17}, \
|
||||
}
|
||||
|
||||
#define DRV_PIN_IRQ_MAP_CONFIG \
|
||||
{ \
|
||||
EXTI0_IRQn, \
|
||||
EXTI1_IRQn, \
|
||||
EXTI2_IRQn, \
|
||||
EXTI3_IRQn, \
|
||||
EXTI4_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI9_5_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
EXTI15_10_IRQn, \
|
||||
}
|
||||
|
||||
#ifdef GPIOD
|
||||
#define DRV_PIN_PORT_D GPIOD,
|
||||
#else
|
||||
#define DRV_PIN_PORT_D
|
||||
#endif /* GPIOD */
|
||||
#ifdef GPIOE
|
||||
#define DRV_PIN_PORT_E GPIOE,
|
||||
#else
|
||||
#define DRV_PIN_PORT_E
|
||||
#endif /* GPIOE */
|
||||
#ifdef GPIOF
|
||||
#define DRV_PIN_PORT_F GPIOF,
|
||||
#else
|
||||
#define DRV_PIN_PORT_F
|
||||
#endif /* GPIOF */
|
||||
#ifdef GPIOG
|
||||
#define DRV_PIN_PORT_G GPIOG,
|
||||
#else
|
||||
#define DRV_PIN_PORT_G
|
||||
#endif /* GPIOG */
|
||||
|
||||
#define DRV_PIN_PORT_CONFIG \
|
||||
{ \
|
||||
GPIOA, \
|
||||
GPIOB, \
|
||||
GPIOC, \
|
||||
DRV_PIN_PORT_D \
|
||||
DRV_PIN_PORT_E \
|
||||
DRV_PIN_PORT_F \
|
||||
DRV_PIN_PORT_G \
|
||||
}
|
||||
|
||||
#define DRV_PIN_CONFIG \
|
||||
{ \
|
||||
GPIO_PIN_0, \
|
||||
GPIO_PIN_1, \
|
||||
GPIO_PIN_2, \
|
||||
GPIO_PIN_3, \
|
||||
GPIO_PIN_4, \
|
||||
GPIO_PIN_5, \
|
||||
GPIO_PIN_6, \
|
||||
GPIO_PIN_7, \
|
||||
GPIO_PIN_8, \
|
||||
GPIO_PIN_9, \
|
||||
GPIO_PIN_10, \
|
||||
GPIO_PIN_11, \
|
||||
GPIO_PIN_12, \
|
||||
GPIO_PIN_13, \
|
||||
GPIO_PIN_14, \
|
||||
GPIO_PIN_15, \
|
||||
}
|
||||
|
||||
#define DRV_PWM1_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM2_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT32_MAX}
|
||||
#define DRV_PWM3_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM4_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM5_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT32_MAX}
|
||||
#define DRV_PWM6_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM7_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM8_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM9_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM10_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM11_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM12_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM13_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_PWM14_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
|
||||
#define DRV_TIMER1_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT32_MAX}
|
||||
#define DRV_TIMER2_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER3_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER4_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER5_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT32_MAX}
|
||||
#define DRV_TIMER6_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER7_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER8_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER9_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER10_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER11_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER12_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER13_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
#define DRV_TIMER14_INFO_CONFIG \
|
||||
{0, UINT16_MAX, UINT16_MAX}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _MR_BOARD_H_ */
|
||||
@@ -57,31 +57,37 @@ extern "C" {
|
||||
EXTI15_10_IRQn, \
|
||||
}
|
||||
|
||||
#if !defined(GPIOD) && !defined(GPIOE)
|
||||
#define DRV_PIN_PORT_CONFIG \
|
||||
{ \
|
||||
GPIOA, \
|
||||
GPIOB, \
|
||||
GPIOC, \
|
||||
}
|
||||
#elif defined(GPIOE)
|
||||
#define DRV_PIN_PORT_CONFIG \
|
||||
{ \
|
||||
GPIOA, \
|
||||
GPIOB, \
|
||||
GPIOC, \
|
||||
GPIOD, \
|
||||
}
|
||||
#ifdef GPIOD
|
||||
#define DRV_PIN_PORT_D GPIOD,
|
||||
#else
|
||||
#define DRV_PIN_PORT_D
|
||||
#endif /* GPIOD */
|
||||
#ifdef GPIOE
|
||||
#define DRV_PIN_PORT_E GPIOE,
|
||||
#else
|
||||
#define DRV_PIN_PORT_E
|
||||
#endif /* GPIOE */
|
||||
#ifdef GPIOF
|
||||
#define DRV_PIN_PORT_F GPIOF,
|
||||
#else
|
||||
#define DRV_PIN_PORT_F
|
||||
#endif /* GPIOF */
|
||||
#ifdef GPIOG
|
||||
#define DRV_PIN_PORT_G GPIOG,
|
||||
#else
|
||||
#define DRV_PIN_PORT_G
|
||||
#endif /* GPIOG */
|
||||
|
||||
#define DRV_PIN_PORT_CONFIG \
|
||||
{ \
|
||||
GPIOA, \
|
||||
GPIOB, \
|
||||
GPIOC, \
|
||||
GPIOD, \
|
||||
GPIOE, \
|
||||
DRV_PIN_PORT_D \
|
||||
DRV_PIN_PORT_E \
|
||||
DRV_PIN_PORT_F \
|
||||
DRV_PIN_PORT_G \
|
||||
}
|
||||
#endif /* GPIOD */
|
||||
|
||||
#define DRV_PIN_CONFIG \
|
||||
{ \
|
||||
|
||||
Reference in New Issue
Block a user