From 70bd55fea5ab07ee08a1ecc3165365c90266b5f8 Mon Sep 17 00:00:00 2001 From: "Man, Jianting (Meco)" <920369182@qq.com> Date: Fri, 17 Jun 2022 02:29:44 -0400 Subject: [PATCH] [arduino] use perf_counter to instead of hwtimer (#6089) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除硬件定时器依赖 取消stm32f401 spi的支持 更换f401 arduino默认例程 --- .../applications/arduino_main.cpp | 7 ++----- .../applications/arduino_pinout/pins_arduino.h | 1 - bsp/stm32/stm32f072-st-nucleo/board/Kconfig | 2 -- .../applications/arduino_pinout/README.md | 13 ++++--------- .../applications/arduino_pinout/pins_arduino.c | 8 ++++---- .../applications/arduino_pinout/pins_arduino.h | 2 -- bsp/stm32/stm32f401-st-nucleo/board/Kconfig | 5 ----- 7 files changed, 10 insertions(+), 28 deletions(-) diff --git a/bsp/stm32/stm32f072-st-nucleo/applications/arduino_main.cpp b/bsp/stm32/stm32f072-st-nucleo/applications/arduino_main.cpp index 873d6b7676..bf0431f83d 100644 --- a/bsp/stm32/stm32f072-st-nucleo/applications/arduino_main.cpp +++ b/bsp/stm32/stm32f072-st-nucleo/applications/arduino_main.cpp @@ -10,17 +10,14 @@ #include -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); + Serial.println("Hello Arduino!\n"); + delay(800); } diff --git a/bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h b/bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h index 22bea30288..f64182b61b 100644 --- a/bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h +++ b/bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h @@ -42,6 +42,5 @@ #define LED_BUILTIN D13 /* Default Built-in LED */ #define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" -#define RTDUINO_DEFAULT_HWTIMER_DEVICE_NAME "timer7" #endif /* Pins_Arduino_h */ diff --git a/bsp/stm32/stm32f072-st-nucleo/board/Kconfig b/bsp/stm32/stm32f072-st-nucleo/board/Kconfig index 11043796b0..fb9f45216c 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/Kconfig +++ b/bsp/stm32/stm32f072-st-nucleo/board/Kconfig @@ -19,8 +19,6 @@ menu "Onboard Peripheral Drivers" select PKG_USING_RTDUINO select BSP_USING_STLINK_TO_USART select BSP_USING_GPIO - select BSP_USING_TIM - select BSP_USING_TIM7 select BSP_USING_ADC select BSP_USING_ADC1 select BSP_USING_PWM diff --git a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md index f87490bf37..22fdda741d 100644 --- a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md +++ b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md @@ -32,10 +32,10 @@ Hardware Drivers Config ---> | 7 (D7) | PA8 | 是 | | | 8 (D8) | PA9 | 是 | | | 9 (D9) | PC7 | 是 | PWM(定时器3发生) | -| 10 (D10) | PB6 | 是 | SPI1-CS,被RT-Thread的SPI设备框架spi1总线接管,不可当做普通IO | -| 11 (D11) | PA7 | 是 | SPI1-MOSI,被RT-Thread的SPI设备框架spi1总线接管,不可当做普通IO | -| 12 (D12) | PA6 | 是 | SPI1-MISO,被RT-Thread的SPI设备框架spi1总线接管,不可当做普通IO | -| 13 (D13) | PA5 | 是 | SPI1-SCK,被RT-Thread的SPI设备框架spi1总线接管,不可当做普通IO | +| 10 (D10) | PB6 | 是 | | +| 11 (D11) | PA7 | 是 | | +| 12 (D12) | PA6 | 是 | | +| 13 (D13) | PA5 | 是 | | | 14 (D14) | PB9 | 是 | I2C1-SDA,被RT-Thread的I2C设备框架i2c1总线接管,不可当做普通IO | | 15 (D15) | PB8 | 是 | I2C1_SCL,被RT-Thread的I2C设备框架i2c1总线接管,不可当做普通IO | | 16 (D16) | PC13 | 是 | Nucleo板载用户按键(左侧蓝色) | @@ -61,8 +61,3 @@ Hardware Drivers Config ---> ## 3 I2C总线 STM32F401 Nucleo板的I2C总线是板上丝印的 `SCL/D15` 和 `SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include `(Arduino官方I2C头文件)即可使用。 - -## 4 SPI总线 - -STM32F401 Nucleo板的SPI总线是板上丝印的 `SCK/D13`、`MISO/D12`、`MOSI/D11`引脚,这3个引脚是被RT-Thread SPI设备框架接管的,不需要直接操控这3个引脚,直接引用`#include `(Arduino官方SPI头文件)即可使用。按照Arduino的编程标准,用户需要自行控制片选信号。 - diff --git a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.c b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.c index b12f5ab0ac..441d33f113 100644 --- a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.c +++ b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.c @@ -30,10 +30,10 @@ const pin_map_t pin_map_table[]= {D7, GET_PIN(A,8)}, {D8, GET_PIN(A,9)}, {D9, GET_PIN(C,7), "pwm3", 2}, /* PWM */ - {D10}, /* SPI1-CS */ - {D11}, /* SPI1-MOSI */ - {D12}, /* SPI1-MISO */ - {D13}, /* SPI1-SCK */ + {D10, GET_PIN(B,6)}, + {D11, GET_PIN(A,7)}, + {D12, GET_PIN(A,6)}, + {D13, GET_PIN(A,5)}, {D14}, /* I2C1-SDA */ {D15}, /* I2C1-SCL */ {D16, GET_PIN(C,13)}, /* user button */ diff --git a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h index e8e396f936..19fb0f754e 100644 --- a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h +++ b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h @@ -42,7 +42,5 @@ #define LED_BUILTIN D13 /* Default Built-in LED */ #define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" -#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1" -#define RTDUINO_DEFAULT_HWTIMER_DEVICE_NAME "timer11" #endif /* Pins_Arduino_h */ diff --git a/bsp/stm32/stm32f401-st-nucleo/board/Kconfig b/bsp/stm32/stm32f401-st-nucleo/board/Kconfig index 553e47e789..0d49866a4c 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/Kconfig +++ b/bsp/stm32/stm32f401-st-nucleo/board/Kconfig @@ -19,8 +19,6 @@ menu "Onboard Peripheral Drivers" select PKG_USING_RTDUINO select BSP_USING_STLINK_TO_USART select BSP_USING_GPIO - select BSP_USING_TIM - select BSP_USING_TIM11 select BSP_USING_ADC select BSP_USING_ADC1 select BSP_USING_PWM @@ -32,11 +30,8 @@ menu "Onboard Peripheral Drivers" select BSP_USING_PWM3_CH2 select BSP_USING_I2C select BSP_USING_I2C1 - select BSP_USING_SPI - select BSP_USING_SPI1 imply RTDUINO_USING_SERVO imply RTDUINO_USING_WIRE - imply RTDUINO_USING_SPI imply RTDUINO_USING_ADAFRUIT imply RTDUINO_USING_MSTIMER2 default n