mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-21 01:07:18 +08:00
[bsp][ch32v307]适配RT-duino框架 (#6669)
为ch32v307适配rt-duino,支持pwm、gpio、uart、iic,暂不支持 spi。 已在ch32v307评估板测试。 测试内容包括串口打印、呼吸灯、AHT10温湿度读取等。
This commit is contained in:
parent
b1763e6903
commit
59f10fd704
@ -1,9 +1,12 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
cwd = GetCurrentDir()
|
||||
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)
|
||||
|
||||
|
24
bsp/wch/risc-v/ch32v307v-r1/applications/arduino_main.cpp
Normal file
24
bsp/wch/risc-v/ch32v307v-r1/applications/arduino_main.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-11-29 hg0720 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,9 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c') + Glob('*.cpp')
|
||||
inc = [cwd]
|
||||
|
||||
group = DefineGroup('RTduino', src, depend = ['PKG_USING_RTDUINO'], CPPPATH = inc)
|
||||
|
||||
Return('group')
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-11-29 hg0720 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,10), "uart1"}, /* Serial-Rx */
|
||||
{D1, GET_PIN(A,9), "uart1"}, /* Serial-Tx */
|
||||
{D2, GET_PIN(A,8), "pwm1", 1}, /* PWM */
|
||||
{D3, GET_PIN(A,7), "pwm3", 2}, /* PWM */
|
||||
{D4, GET_PIN(A,6), "pwm3", 1}, /* PWM */
|
||||
{D5, GET_PIN(B,5)}, /* LED_BUILTIN */
|
||||
{D6, GET_PIN(B,8), "pwm4", 3}, /* PWM */
|
||||
{D7, GET_PIN(B,9), "pwm4", 4}, /* PWM */
|
||||
{D8, GET_PIN(B,1), "pwm3", 4}, /* PWM */
|
||||
{D9, GET_PIN(B,0), "pwm3", 3}, /* PWM */
|
||||
{D10, GET_PIN(B,12)},
|
||||
{D11, GET_PIN(B,15)},
|
||||
{D12, GET_PIN(B,14)},
|
||||
{D13, GET_PIN(B,13)},
|
||||
{D14, GET_PIN(B,11), "i2c1"}, /* I2C-SDA (Wire) */
|
||||
{D15, GET_PIN(B,10), "i2c1"}, /* I2C-SCL (Wire) */
|
||||
{A0, GET_PIN(A,0), "adc1", 0}, /* ADC */
|
||||
{A1, GET_PIN(A,1), "adc1", 1}, /* ADC */
|
||||
{A2, GET_PIN(A,2), "adc1", 2}, /* ADC */
|
||||
{A3, GET_PIN(A,3), "adc1", 3}, /* ADC */
|
||||
{A4, GET_PIN(A,4), "adc1", 4}, /* ADC */
|
||||
{A5, GET_PIN(A,5), "adc1", 5}, /* ADC */
|
||||
};
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-11-29 hg0720 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 A0 (16)
|
||||
#define A1 (17)
|
||||
#define A2 (18)
|
||||
#define A3 (19)
|
||||
#define A4 (20)
|
||||
#define A5 (21)
|
||||
|
||||
#define F_CPU 144000000L /* CPU:144MHz */
|
||||
|
||||
#define LED_BUILTIN D5 /* Default Built-in LED */
|
||||
|
||||
/* i2c1 : PB1-SDA PB10-SCL */
|
||||
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
|
||||
|
||||
#endif /* Pins_Arduino_h */
|
@ -9,12 +9,21 @@
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
/* defined the LED0 pin: PB5 */
|
||||
#define LED0_PIN rt_pin_get("PB.5")
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* set LED0 pin mode to output */
|
||||
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
|
||||
|
||||
while (1)
|
||||
{
|
||||
rt_kprintf("Hello RT-Thread!\n");
|
||||
rt_thread_mdelay(1000);
|
||||
rt_pin_write(LED0_PIN, PIN_HIGH);
|
||||
rt_thread_mdelay(500);
|
||||
rt_pin_write(LED0_PIN, PIN_LOW);
|
||||
rt_thread_mdelay(500);
|
||||
}
|
||||
}
|
||||
|
@ -19,65 +19,65 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
|
||||
if BSP_USING_UART
|
||||
config BSP_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default n
|
||||
config BSP_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default n
|
||||
|
||||
config BSP_USING_UART2
|
||||
bool "Enable UART2"
|
||||
default n
|
||||
config BSP_USING_UART2
|
||||
bool "Enable UART2"
|
||||
default n
|
||||
|
||||
config BSP_USING_UART3
|
||||
bool "Enable UART3"
|
||||
default n
|
||||
config BSP_USING_UART3
|
||||
bool "Enable UART3"
|
||||
default n
|
||||
|
||||
config BSP_USING_UART4
|
||||
bool "Enable UART4"
|
||||
default n
|
||||
config BSP_USING_UART4
|
||||
bool "Enable UART4"
|
||||
default n
|
||||
|
||||
config BSP_USING_UART5
|
||||
bool "Enable UART5"
|
||||
default n
|
||||
config BSP_USING_UART5
|
||||
bool "Enable UART5"
|
||||
default n
|
||||
|
||||
config BSP_USING_UART6
|
||||
bool "Enable UART6"
|
||||
default n
|
||||
config BSP_USING_UART6
|
||||
bool "Enable UART6"
|
||||
default n
|
||||
|
||||
config BSP_USING_UART7
|
||||
bool "Enable UART7"
|
||||
default n
|
||||
config BSP_USING_UART7
|
||||
bool "Enable UART7"
|
||||
default n
|
||||
|
||||
config BSP_USING_UART8
|
||||
bool "Enable UART8"
|
||||
default n
|
||||
config BSP_USING_UART8
|
||||
bool "Enable UART8"
|
||||
default n
|
||||
endif
|
||||
|
||||
|
||||
menuconfig BSP_USING_ADC
|
||||
bool "Enable ADC"
|
||||
select RT_USING_ADC
|
||||
default n
|
||||
|
||||
if BSP_USING_ADC
|
||||
config BSP_USING_ADC1
|
||||
bool "Enable ADC1"
|
||||
default n
|
||||
config BSP_USING_ADC1
|
||||
bool "Enable ADC1"
|
||||
default n
|
||||
|
||||
config BSP_USING_ADC2
|
||||
bool "Enable ADC2"
|
||||
default n
|
||||
config BSP_USING_ADC2
|
||||
bool "Enable ADC2"
|
||||
default n
|
||||
|
||||
config ADC_CHANNEL_16
|
||||
bool "Enable ADC CHANNEL 16 (inside temperature)"
|
||||
default n
|
||||
config ADC_CHANNEL_16
|
||||
bool "Enable ADC CHANNEL 16 (inside temperature)"
|
||||
default n
|
||||
|
||||
config ADC_CHANNEL_17
|
||||
bool "Enable ADC CHANNEL 17 (inside Verf)"
|
||||
default n
|
||||
config ADC_CHANNEL_17
|
||||
bool "Enable ADC CHANNEL 17 (inside Verf)"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_DAC
|
||||
bool "Enable DAC"
|
||||
select RT_USING_DAC
|
||||
select RT_USING_DAC
|
||||
default n
|
||||
|
||||
if BSP_USING_DAC
|
||||
@ -86,8 +86,8 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
config BSP_USING_DAC_CHANNEL2
|
||||
bool "Enable DAC CHANNEL2"
|
||||
default n
|
||||
endif
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_I2C
|
||||
bool "Enable I2C Bus"
|
||||
@ -102,16 +102,16 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
|
||||
if BSP_USING_I2C1
|
||||
comment "Notice: PC7 --> 39; PC6 --> 38"
|
||||
comment "Notice: PB10 --> 26; PB11 --> 27"
|
||||
|
||||
config BSP_I2C1_SCL_PIN
|
||||
int "i2c1 SCL pin number"
|
||||
range 0 79
|
||||
default 38
|
||||
default 26
|
||||
config BSP_I2C1_SDA_PIN
|
||||
int "i2c1 SDA pin number"
|
||||
range 0 79
|
||||
default 39
|
||||
default 27
|
||||
endif
|
||||
|
||||
config BSP_USING_I2C2
|
||||
@ -134,25 +134,26 @@ menu "On-chip Peripheral Drivers"
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI"
|
||||
select RT_USING_SPI
|
||||
|
||||
|
||||
if BSP_USING_SPI
|
||||
config BSP_USING_SPI1
|
||||
bool "Enable SPI1"
|
||||
default n
|
||||
|
||||
|
||||
config BSP_USING_SPI2
|
||||
bool "Enable SPI2"
|
||||
default n
|
||||
|
||||
|
||||
config BSP_USING_SPI3
|
||||
bool "Enable SPI3"
|
||||
default n
|
||||
|
||||
|
||||
if BSP_USING_SPI3
|
||||
config BSP_USING_SPI_FLASH
|
||||
bool "Enable SPI Flash"
|
||||
default n
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SOFT_SPI
|
||||
@ -164,7 +165,7 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Enable SSPI1 Bus (User SPI)"
|
||||
default n
|
||||
if BSP_USING_SOFT_SPI1
|
||||
comment "Notice: PB9 --> 25; PB8 --> 24; PB7 --> 23"
|
||||
comment "Notice: PB9 --> 25; PB8 --> 24; PB7 --> 23"
|
||||
config BSP_S_SPI1_SCK_PIN
|
||||
int "sspi1 SCL pin number"
|
||||
range 1 79
|
||||
@ -176,14 +177,14 @@ menu "On-chip Peripheral Drivers"
|
||||
config BSP_S_SPI1_MISO_PIN
|
||||
int "sspi1 MOSI pin number"
|
||||
range 1 79
|
||||
default 23
|
||||
default 23
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_SOFT_SPI2
|
||||
bool "Enable SSPI2 Bus (soft SPI)"
|
||||
default n
|
||||
if BSP_USING_SOFT_SPI2
|
||||
comment "Notice: PE0 --> 64; PE1 --> 65; PE2 --> 66"
|
||||
comment "Notice: PE0 --> 64; PE1 --> 65; PE2 --> 66"
|
||||
config BSP_S_SPI2_SCK_PIN
|
||||
int "sspi2 SCL pin number"
|
||||
range 1 79
|
||||
@ -195,15 +196,15 @@ menu "On-chip Peripheral Drivers"
|
||||
config BSP_S_SPI2_MISO_PIN
|
||||
int "sspi2 MOSI pin number"
|
||||
range 1 79
|
||||
default 66
|
||||
endif
|
||||
default 66
|
||||
endif
|
||||
endif
|
||||
|
||||
config BSP_USING_RTC
|
||||
bool "Enable RTC"
|
||||
select RT_USING_RTC
|
||||
default n
|
||||
|
||||
|
||||
if BSP_USING_RTC
|
||||
config BSP_USING_RTC_LSI
|
||||
bool "Using LSI clock for rtc, if not, LSE default"
|
||||
@ -220,8 +221,8 @@ menu "On-chip Peripheral Drivers"
|
||||
select RT_USING_WDT
|
||||
select LSI_VALUE
|
||||
default n
|
||||
|
||||
menuconfig BSP_USING_CAN
|
||||
|
||||
menuconfig BSP_USING_CAN
|
||||
bool "Enable CAN"
|
||||
default n
|
||||
select RT_USING_CAN
|
||||
@ -254,18 +255,13 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM1
|
||||
choice
|
||||
prompt "Using TIM1 as hwtimer or PWM mode"
|
||||
default BSP_USING_TIM1_HWTIMER
|
||||
config BSP_USING_TIM1_HWTIMER
|
||||
bool "Using TIM1 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM1_HWTIMER
|
||||
bool "Using TIM1 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM1_PWM
|
||||
bool "Using TIM1 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
endchoice
|
||||
config BSP_USING_TIM1_PWM
|
||||
bool "Using TIM1 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
|
||||
if BSP_USING_TIM1_PWM
|
||||
config BSP_USING_TIM1_PWM_CH1
|
||||
@ -283,6 +279,10 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Using TIM1 channel 4"
|
||||
endif
|
||||
|
||||
if BSP_USING_TIM1_HWTIMER && BSP_USING_TIM1_PWM
|
||||
comment "BSP_USING_TIM1_HWTIMER and BSP_USING_TIM1_PWM can only be chosen for one!"
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
config BSP_USING_TIM2
|
||||
@ -290,18 +290,13 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM2
|
||||
choice
|
||||
prompt "Using TIM2 as hwtimer or PWM mode"
|
||||
default BSP_USING_TIM2_HWTIMER
|
||||
config BSP_USING_TIM2_HWTIMER
|
||||
bool "Using TIM2 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM2_HWTIMER
|
||||
bool "Using TIM2 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM2_PWM
|
||||
bool "Using TIM2 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
endchoice
|
||||
config BSP_USING_TIM2_PWM
|
||||
bool "Using TIM2 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
|
||||
if BSP_USING_TIM2_PWM
|
||||
config BSP_USING_TIM2_PWM_CH1
|
||||
@ -319,6 +314,10 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Using TIM2 channel 4"
|
||||
endif
|
||||
|
||||
if BSP_USING_TIM2_HWTIMER && BSP_USING_TIM2_PWM
|
||||
comment "BSP_USING_TIM2_HWTIMER and BSP_USING_TIM2_PWM can only be chosen for one!"
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
config BSP_USING_TIM3
|
||||
@ -326,18 +325,13 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM3
|
||||
choice
|
||||
prompt "Using TIM3 as hwtimer or PWM mode"
|
||||
default BSP_USING_TIM3_HWTIMER
|
||||
config BSP_USING_TIM3_HWTIMER
|
||||
bool "Using TIM3 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM3_HWTIMER
|
||||
bool "Using TIM3 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM3_PWM
|
||||
bool "Using TIM3 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
endchoice
|
||||
config BSP_USING_TIM3_PWM
|
||||
bool "Using TIM3 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
|
||||
if BSP_USING_TIM3_PWM
|
||||
config BSP_USING_TIM3_PWM_CH1
|
||||
@ -355,6 +349,10 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Using TIM3 channel 4"
|
||||
endif
|
||||
|
||||
if BSP_USING_TIM3_HWTIMER && BSP_USING_TIM3_PWM
|
||||
comment "BSP_USING_TIM3_HWTIMER and BSP_USING_TIM3_PWM can only be chosen for one!"
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
config BSP_USING_TIM4
|
||||
@ -362,18 +360,13 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM4
|
||||
choice
|
||||
prompt "Using TIM4 as hwtimer or PWM mode"
|
||||
default BSP_USING_TIM4_HWTIMER
|
||||
config BSP_USING_TIM4_HWTIMER
|
||||
bool "Using TIM4 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM4_HWTIMER
|
||||
bool "Using TIM4 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM4_PWM
|
||||
bool "Using TIM4 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
endchoice
|
||||
config BSP_USING_TIM4_PWM
|
||||
bool "Using TIM4 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
|
||||
if BSP_USING_TIM4_PWM
|
||||
config BSP_USING_TIM4_PWM_CH1
|
||||
@ -391,25 +384,24 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Using TIM4 channel 4"
|
||||
endif
|
||||
|
||||
if BSP_USING_TIM4_HWTIMER && BSP_USING_TIM4_PWM
|
||||
comment "BSP_USING_TIM4_HWTIMER and BSP_USING_TIM4_PWM can only be chosen for one!"
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_TIM5
|
||||
bool "Using TIM5"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM5
|
||||
choice
|
||||
prompt "Using TIM5 as hwtimer or PWM mode"
|
||||
default BSP_USING_TIM5_HWTIMER
|
||||
config BSP_USING_TIM5_HWTIMER
|
||||
bool "Using TIM5 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM5_HWTIMER
|
||||
bool "Using TIM5 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM5_PWM
|
||||
bool "Using TIM5 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
endchoice
|
||||
config BSP_USING_TIM5_PWM
|
||||
bool "Using TIM5 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
|
||||
if BSP_USING_TIM5_PWM
|
||||
config BSP_USING_TIM5_PWM_CH1
|
||||
@ -427,57 +419,44 @@ menu "On-chip Peripheral Drivers"
|
||||
bool "Using TIM5 channel 4"
|
||||
endif
|
||||
|
||||
if BSP_USING_TIM5_HWTIMER && BSP_USING_TIM5_PWM
|
||||
comment "BSP_USING_TIM5_HWTIMER and BSP_USING_TIM5_PWM can only be chosen for one!"
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_TIM6
|
||||
bool "Using TIM6"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM6
|
||||
choice
|
||||
prompt "Using TIM5 as hwtimer (PWM mode not supported)"
|
||||
default BSP_USING_TIM6_HWTIMER
|
||||
|
||||
config BSP_USING_TIM6_HWTIMER
|
||||
bool "Using TIM6 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
endchoice
|
||||
|
||||
config BSP_USING_TIM6_HWTIMER
|
||||
bool "Using TIM6 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_TIM7
|
||||
bool "Using TIM7"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM7
|
||||
choice
|
||||
prompt "Using TIM7 as hwtimer (PWM mode not supported)"
|
||||
default BSP_USING_TIM7_HWTIMER
|
||||
|
||||
config BSP_USING_TIM7_HWTIMER
|
||||
bool "Using TIM7 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
endchoice
|
||||
|
||||
config BSP_USING_TIM7_HWTIMER
|
||||
bool "Using TIM7 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_TIM8
|
||||
bool "Using TIM8"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM8
|
||||
choice
|
||||
prompt "Using TIM8 as hwtimer or PWM mode"
|
||||
default BSP_USING_TIM8_HWTIMER
|
||||
config BSP_USING_TIM8_HWTIMER
|
||||
bool "Using TIM8 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM8_HWTIMER
|
||||
bool "Using TIM8 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM8_PWM
|
||||
bool "Using TIM8 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
endchoice
|
||||
config BSP_USING_TIM8_PWM
|
||||
bool "Using TIM8 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
|
||||
if BSP_USING_TIM8_PWM
|
||||
config BSP_USING_TIM8_PWM_CH1
|
||||
@ -494,26 +473,25 @@ menu "On-chip Peripheral Drivers"
|
||||
config BSP_USING_TIM8_PWM_CH4
|
||||
bool "Using TIM8 channel 4"
|
||||
endif
|
||||
|
||||
|
||||
if BSP_USING_TIM8_HWTIMER && BSP_USING_TIM8_PWM
|
||||
comment "BSP_USING_TIM8_HWTIMER and BSP_USING_TIM8_PWM can only be chosen for one!"
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_TIM9
|
||||
bool "Using TIM9"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM9
|
||||
choice
|
||||
prompt "Using TIM9 as hwtimer or PWM mode"
|
||||
default BSP_USING_TIM9_HWTIMER
|
||||
config BSP_USING_TIM9_HWTIMER
|
||||
bool "Using TIM9 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM9_HWTIMER
|
||||
bool "Using TIM9 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM9_PWM
|
||||
bool "Using TIM9 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
endchoice
|
||||
config BSP_USING_TIM9_PWM
|
||||
bool "Using TIM9 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
|
||||
if BSP_USING_TIM9_PWM
|
||||
config BSP_USING_TIM9_PWM_CH1
|
||||
@ -530,26 +508,25 @@ menu "On-chip Peripheral Drivers"
|
||||
config BSP_USING_TIM9_PWM_CH4
|
||||
bool "Using TIM9 channel 4"
|
||||
endif
|
||||
|
||||
|
||||
if BSP_USING_TIM9_HWTIMER && BSP_USING_TIM9_PWM
|
||||
comment "BSP_USING_TIM9_HWTIMER and BSP_USING_TIM9_PWM can only be chosen for one!"
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
config BSP_USING_TIM10
|
||||
bool "Using TIM10"
|
||||
default n
|
||||
|
||||
if BSP_USING_TIM10
|
||||
choice
|
||||
prompt "Using TIM10 as hwtimer or PWM mode"
|
||||
default BSP_USING_TIM10_HWTIMER
|
||||
config BSP_USING_TIM10_HWTIMER
|
||||
bool "Using TIM10 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM10_HWTIMER
|
||||
bool "Using TIM10 as hwtimer mode"
|
||||
select BSP_USING_HWTIMER
|
||||
|
||||
config BSP_USING_TIM10_PWM
|
||||
bool "Using TIM10 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
endchoice
|
||||
config BSP_USING_TIM10_PWM
|
||||
bool "Using TIM10 as PWM mode"
|
||||
select BSP_USING_PWM
|
||||
|
||||
if BSP_USING_TIM10_PWM
|
||||
config BSP_USING_TIM10_PWM_CH1
|
||||
@ -566,14 +543,46 @@ menu "On-chip Peripheral Drivers"
|
||||
config BSP_USING_TIM10_PWM_CH4
|
||||
bool "Using TIM10 channel 4"
|
||||
endif
|
||||
|
||||
|
||||
if BSP_USING_TIM10_HWTIMER && BSP_USING_TIM10_PWM
|
||||
comment "BSP_USING_TIM10_HWTIMER and BSP_USING_TIM10_PWM can only be chosen for one!"
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
endif
|
||||
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
config BSP_USING_ARDUINO
|
||||
bool "Compatible with Arduino Ecosystem (RTduino)"
|
||||
select PKG_USING_RTDUINO
|
||||
select BSP_USING_GPIO
|
||||
select BSP_USING_ADC
|
||||
select BSP_USING_ADC1
|
||||
select BSP_USING_TIM
|
||||
select BSP_USING_PWM
|
||||
select BSP_USING_TIM1
|
||||
select BSP_USING_TIM1_PWM
|
||||
select BSP_USING_TIM1_PWM_CH1
|
||||
select BSP_USING_TIM3
|
||||
select BSP_USING_TIM3_PWM
|
||||
select BSP_USING_TIM3_PWM_CH1
|
||||
select BSP_USING_TIM3_PWM_CH2
|
||||
select BSP_USING_TIM3_PWM_CH3
|
||||
select BSP_USING_TIM3_PWM_CH4
|
||||
select BSP_USING_TIM4
|
||||
select BSP_USING_TIM4_PWM
|
||||
select BSP_USING_TIM4_PWM_CH3
|
||||
select BSP_USING_TIM4_PWM_CH4
|
||||
select BSP_USING_TIM6
|
||||
select BSP_USING_TIM6_HWTIMER
|
||||
select BSP_USING_SOFT_I2C
|
||||
select BSP_USING_I2C1
|
||||
imply RTDUINO_USING_SERVO
|
||||
imply RTDUINO_USING_WIRE
|
||||
default n
|
||||
|
||||
endmenu
|
||||
|
||||
@ -582,3 +591,4 @@ menu "Board extended module Drivers"
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
|
||||
|
@ -12,7 +12,10 @@
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "ch32v30x.h"
|
||||
#include "drv_gpio.h"
|
||||
#include "drv_pwm.h"
|
||||
|
||||
/* board configuration */
|
||||
#define SRAM_SIZE 96
|
||||
|
Loading…
x
Reference in New Issue
Block a user