[arduino] update (#5895)
This commit is contained in:
parent
7692eb18b9
commit
0e66f3f833
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -60,4 +60,9 @@ Hardware Drivers Config --->
|
||||
|
||||
## 3 I2C总线
|
||||
|
||||
STM32F401 Nucleo板的I2C总线是板上丝印的 `SCL/D15` 和 `SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
|
||||
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的编程标准,用户需要自行控制片选信号。
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 函数后续也支持了真模拟输出功能。
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user