summaryrefslogtreecommitdiff
path: root/bsp
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2022-05-01 00:24:35 -0400
committerGitHub <[email protected]>2022-05-01 12:24:35 +0800
commit0e66f3f8337ad9790c9ac4e5c186b4da68ae92b2 (patch)
tree9510128af99c6991771c52dbb76026a82bc33386 /bsp
parent7692eb18b9f6c16348e2df8ec4fce7a0a6e886a3 (diff)
[arduino] update (#5895)
Diffstat (limited to 'bsp')
-rw-r--r--bsp/stm32/stm32f072-st-nucleo/applications/arduino_pinout/pins_arduino.h2
-rw-r--r--bsp/stm32/stm32f072-st-nucleo/board/Kconfig2
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/applications/arduino_main.cpp2
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md7
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/pins_arduino.h3
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/applications/main.c2
-rw-r--r--bsp/stm32/stm32f401-st-nucleo/board/Kconfig5
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/README.md12
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.h6
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/board/Kconfig3
10 files changed, 28 insertions, 16 deletions
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 eb2c08b4fd..1d0856ce4d 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
@@ -40,6 +40,6 @@
#define LED_BUILTIN D13 /* Default Built-in LED */
-#define ARDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
+#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
#endif /* Pins_Arduino_h */
diff --git a/bsp/stm32/stm32f072-st-nucleo/board/Kconfig b/bsp/stm32/stm32f072-st-nucleo/board/Kconfig
index 31f4976b0d..b8b46f478a 100644
--- a/bsp/stm32/stm32f072-st-nucleo/board/Kconfig
+++ b/bsp/stm32/stm32f072-st-nucleo/board/Kconfig
@@ -17,6 +17,7 @@ menu "Onboard Peripheral Drivers"
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
@@ -36,7 +37,6 @@ menu "Onboard Peripheral Drivers"
imply RTDUINO_USING_SERVO
imply RTDUINO_USING_WIRE
imply RTDUINO_USING_ADAFRUIT
- imply RTUSING_USING_SPI
default n
endmenu
diff --git a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_main.cpp b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_main.cpp
index a4c7f4ec92..39391c9650 100644
--- a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_main.cpp
+++ b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_main.cpp
@@ -18,6 +18,6 @@ void setup(void)
void loop(void)
{
/* put your main code here, to run repeatedly: */
- Serial.println("Hello RT-Thread from arduino_main.cpp\n");
+ Serial.println("Hello Arduino!\n");
delay(800);
}
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 f905fdfe93..f24c2d5fdd 100644
--- a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md
+++ b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md
@@ -60,4 +60,9 @@ Hardware Drivers Config --->
## 3 I2C总线
-STM32F401 Nucleo板的I2C总线是板上丝印的 `SCL/D15` 和 `SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。 \ No newline at end of file
+STM32F401 Nucleo板的I2C总线是板上丝印的 `SCL/D15` 和 `SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
+
+## 4 SPI总线
+
+STM32F401 Nucleo板的SPI总线是板上丝印的 `SCK/D13`、`MISO/D12`、`MOSI/D11`引脚,这3个引脚是被RT-Thread SPI设备框架接管的,不需要直接操控这3个引脚,直接引用`#include <SPI.h>`(Arduino官方SPI头文件)即可使用。按照Arduino的编程标准,用户需要自行控制片选信号。
+
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 036b3901a7..aa996f203a 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
@@ -40,6 +40,7 @@
#define LED_BUILTIN D13 /* Default Built-in LED */
-#define ARDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
+#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
+#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1"
#endif /* Pins_Arduino_h */
diff --git a/bsp/stm32/stm32f401-st-nucleo/applications/main.c b/bsp/stm32/stm32f401-st-nucleo/applications/main.c
index 21ef91406d..ec1936eb15 100644
--- a/bsp/stm32/stm32f401-st-nucleo/applications/main.c
+++ b/bsp/stm32/stm32f401-st-nucleo/applications/main.c
@@ -15,7 +15,7 @@ int main(void)
{
while (1)
{
- rt_kprintf("Hello RT-Thread from main.c\n");
+ rt_kprintf("Hello RT-Thread!\n");
rt_thread_mdelay(1000);
}
}
diff --git a/bsp/stm32/stm32f401-st-nucleo/board/Kconfig b/bsp/stm32/stm32f401-st-nucleo/board/Kconfig
index 3b81523828..bc1f2d76e7 100644
--- a/bsp/stm32/stm32f401-st-nucleo/board/Kconfig
+++ b/bsp/stm32/stm32f401-st-nucleo/board/Kconfig
@@ -17,6 +17,7 @@ menu "Onboard Peripheral Drivers"
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
@@ -30,11 +31,11 @@ menu "Onboard Peripheral Drivers"
select BSP_USING_I2C
select BSP_USING_I2C1
select BSP_USING_SPI
- # select BSP_USING_SPI1
+ select BSP_USING_SPI1
imply RTDUINO_USING_SERVO
imply RTDUINO_USING_WIRE
imply RTDUINO_USING_ADAFRUIT
- imply RTUSING_USING_SPI
+ imply RTDUINO_USING_SPI
default n
endmenu
diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/README.md b/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/README.md
index 4c3e06a1b8..74907ff3c5 100644
--- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/README.md
+++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/README.md
@@ -94,7 +94,7 @@ Hardware Drivers Config --->
## 3 I2C总线
-潘多拉Arduino支持三条I2C总线,分别是:i2c1、i2c3 和 i2c4。你可以通过`pins_arduino.h`文件中的 `ARDUINO_DEFAULT_IIC_BUS_NAME` 宏来设定Arduino的I2C总线,**默认为 i2c4 总线**。其中:
+潘多拉Arduino支持三条I2C总线,分别是:i2c1、i2c3 和 i2c4。你可以通过`pins_arduino.h`文件中的 `RTDUINO_DEFAULT_IIC_BUS_NAME` 宏来设定Arduino的I2C总线,**默认为 i2c4 总线**。其中:
- i2c1 为用户总线,PC7 为 SDA,PC6 为 SCL。用户可以通过杜邦线连接其他 I2C 传感器/芯片。
- i2c3 为板载 I2C 外设总线,连接板载 ICM20608(陀螺仪和加速度传感器) 和 AP3216C(距离和光亮度传感器) 芯片
@@ -102,9 +102,13 @@ Hardware Drivers Config --->
I2C的引脚都是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
-## 4 特殊功能说明
+## 4 SPI总线
-### 4.1 芯片内部ADC通道
+潘多拉板的Arduino SPI总线是spi2总线,位置为板上左上角的`WIRELESS`插槽。 `SCK`、`MISO`、`MOSI`引脚是被RT-Thread SPI设备框架接管的,不需要直接操控这3个引脚,直接引用`#include <SPI.h>`(Arduino官方SPI头文件)即可使用。按照Arduino的编程标准,用户需要自行控制片选信号。
+
+## 5 特殊功能说明
+
+### 5.1 芯片内部ADC通道
本BSP适配了STM32的两个芯片内部ADC通道,可以通过 analogRead 函数来分别获取如下功能:
@@ -113,7 +117,7 @@ I2C的引脚都是被RT-Thread I2C设备框架接管的,不需要直接操控�
| 芯片内部参考电压 ADC | A2 | -- |
| 芯片内部温度 ADC | A3 | -- |
-### 4.2 真模拟输出功能 (True Analog Output)
+### 5.2 真模拟输出功能 (True Analog Output)
Arduino的 analogWrite 函数虽为模拟写,但是实际输出的是PWM数字信号,并非真正的模拟信号。这是由于Arduino早期使用的AVR单片机并不支持DAC的功能,因此这个习惯就被保留了下来。但是随着Arduino支持芯片的丰富,部分高级芯片已经内建了DAC(例如Arduino官方板MKR、Zero等),因此Arduino的 analogWrite 函数后续也支持了真模拟输出功能。
diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.h b/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.h
index 1a6edf1322..0666847611 100644
--- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.h
+++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.h
@@ -51,8 +51,8 @@
* i2c3 - ICM20608, AP3216C (On Board)
* i2c4 - AHT10 (On Board)
*/
-#define ARDUINO_DEFAULT_IIC_BUS_NAME "i2c4"
-
-#define ARDUINO_DEFAULT_SPI_BUS_NAME "spi2"
+#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c4"
+#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi2"
+#define RTDUINO_SERIAL2_DEVICE_NAME "uart2"
#endif /* Pins_Arduino_h */
diff --git a/bsp/stm32/stm32l475-atk-pandora/board/Kconfig b/bsp/stm32/stm32l475-atk-pandora/board/Kconfig
index d96b52ee13..41cd393e59 100644
--- a/bsp/stm32/stm32l475-atk-pandora/board/Kconfig
+++ b/bsp/stm32/stm32l475-atk-pandora/board/Kconfig
@@ -22,6 +22,7 @@ menu "Onboard Peripheral Drivers"
config BSP_USING_ARDUINO
bool "Support Arduino"
select PKG_USING_RTDUINO
+ select BSP_USING_STLINK_TO_USART
select BSP_USING_GPIO
select BSP_USING_PWM
select BSP_USING_PWM1
@@ -47,8 +48,8 @@ menu "Onboard Peripheral Drivers"
imply BSP_SPI2_RX_USING_DMA
imply RTDUINO_USING_SERVO
imply RTDUINO_USING_WIRE
- imply RTDUINO_USING_SPI
imply RTDUINO_USING_ADAFRUIT
+ imply RTDUINO_USING_SPI
default n
config BSP_USING_KEY