diff --git a/bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout/README_zh.md b/bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout/README_zh.md index 7039a6e2a68e6add19c170f7c53c507fe705e5e0..2d276bcf55653494c1106c4fbfdd87f8b248be4e 100644 --- a/bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout/README_zh.md +++ b/bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout/README_zh.md @@ -54,8 +54,8 @@ Hardware Drivers Config ---> | 29 (A2) | PA5 | 否 | ADC1-CH5,默认被RT-Thread的ADC设备框架adc1接管 | | 30 (A3) | PA6 | 否 | ADC1-CH6,默认被RT-Thread的ADC设备框架adc1接管 | | 31 (A4) | PA7 | 否 | ADC1-CH7,默认被RT-Thread的ADC设备框架adc1接管 | -| 32 (A5) | -- | | 芯片内部参考电压 ADC,默认被RT-Thread的ADC设备框架adc1接管 | -| 33 (A6) | -- | | 芯片内部温度 ADC | +| 32 (A5) | -- | | 芯片内部参考电压 ADC,默认被RT-Thread的ADC设备框架adc1接管 | +| 33 (A6) | -- | | 芯片内部温度 ADC,默认被RT-Thread的ADC设备框架adc1接管 | > 注意: > 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 3e807524314d7577e779944412f5b06daa8f3eaa..55d5f298f2ce705a38ca0ff2af7bedfeaf9f3bcd 100644 --- a/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md +++ b/bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md @@ -20,33 +20,33 @@ Hardware Drivers Config ---> 该BSP遵照Arduino UNO板的引脚排列方式。详见 `pins_arduino.c` -| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 | -| --------------- | ------------- | ------ | ------------------------------------------------------------ | -| 0 (D0) | -- | | 该引脚在UNO板中为串口RX引脚,不可当做普通IO | -| 1 (D1) | -- | | 该引脚在UNO板中为串口TX引脚,不可当做普通IO | -| 2 (D2) | PA10 | 是 | | -| 3 (D3) | PB3 | 是 | PWM(定时器2发生) | -| 4 (D4) | PB5 | 是 | | -| 5 (D5) | PB4 | 是 | PWM(定时器3发生) | -| 6 (D6) | PB10 | 是 | PWM(定时器2发生) | -| 7 (D7) | PA8 | 是 | | -| 8 (D8) | PA9 | 是 | | -| 9 (D9) | PC7 | 是 | PWM(定时器3发生) | -| 10 (D10) | PB6 | 是 | PWM(定时器4发生) | -| 11 (D11) | PA7 | 是 | PWM(定时器1发生) | -| 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板载用户按键(左侧蓝色) | -| A0 | PA0 | 是 | ADC | -| A1 | PA1 | 是 | ADC | -| A2 | PA4 | 是 | ADC | -| A3 | PB0 | 是 | ADC | -| A4 | PC1 | 是 | ADC | -| A5 | PC0 | 是 | ADC | -| A6 | -- | | 芯片内部参考电压 ADC | -| A7 | -- | | 芯片内部温度 ADC | +| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 | +| --------------- | ------------- | ------ | -------------------------------------------------------- | +| 0 (D0) | -- | | UART2-RX,默认被RT-Thread的UART设备框架uart2接管 | +| 1 (D1) | -- | | UART2-TX,默认被RT-Thread的UART设备框架uart2接管 | +| 2 (D2) | PA10 | 是 | | +| 3 (D3) | PB3 | 是 | PWM2-CH2,默认被RT-Thread的PWM设备框架pwm2接管 | +| 4 (D4) | PB5 | 是 | | +| 5 (D5) | PB4 | 是 | PWM3-CH1,默认被RT-Thread的PWM设备框架pwm3接管 | +| 6 (D6) | PB10 | 是 | PWM2-CH3,默认被RT-Thread的PWM设备框架pwm2接管 | +| 7 (D7) | PA8 | 是 | | +| 8 (D8) | PA9 | 是 | | +| 9 (D9) | PC7 | 是 | PWM3-CH2,默认被RT-Thread的PWM设备框架pwm3接管 | +| 10 (D10) | PB6 | 是 | PWM4-CH1,默认被RT-Thread的PWM设备框架pwm4接管 | +| 11 (D11) | PA7 | 是 | PWM1-CH1N,默认被RT-Thread的PWM设备框架pwm1接管 | +| 12 (D12) | PA6 | 是 | | +| 13 (D13) | PA5 | 是 | | +| 14 (D14) | PB9 | 是 | I2C-SDA,默认被RT-Thread的I2C设备框架i2c1总线接管 | +| 15 (D15) | PB8 | 是 | I2C-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 | +| 16 (D16) | PC13 | 是 | Nucleo板载用户按键(左侧蓝色) | +| A0 | PA0 | 是 | ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 | +| A1 | PA1 | 是 | ADC1-CH1,默认被RT-Thread的ADC设备框架adc1接管 | +| A2 | PA4 | 是 | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 | +| A3 | PB0 | 是 | ADC1-CH8,默认被RT-Thread的ADC设备框架adc1接管 | +| A4 | PC1 | 是 | ADC1-CH11,默认被RT-Thread的ADC设备框架adc1接管 | +| A5 | PC0 | 是 | ADC1-CH10,默认被RT-Thread的ADC设备框架adc1接管 | +| A6 | -- | | 芯片内部参考电压 ADC,默认被RT-Thread的ADC设备框架adc1接管 | +| A7 | -- | | 芯片内部温度 ADC,默认被RT-Thread的ADC设备框架adc1接管 | > 注意: > 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 fc47742a945a320f06a64e84ca93962822c3f02d..906407c0a327b07d9b980d36c07a5105f7057b1d 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 @@ -5,45 +5,45 @@ * * Change Logs: * Date Author Notes - * 2022-04-19 Meco Man first version - * 2022-07-26 liYony Perfect PWM (docking of complementary outputs) + * 2022-09-18 liYony first version */ + #include #include #include "pins_arduino.h" /* - {Arduino Pin, RT-Thread Pin [, Device Name(PWM or ADC), 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. -*/ + * {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}, /* RX */ - {D1}, /* TX */ + {D0, GET_PIN(A,3), "uart2"}, /* Serial */ + {D1, GET_PIN(A,2), "uart2"}, /* Serial */ {D2, GET_PIN(A,10)}, - {D3, GET_PIN(B,3), "pwm2", 2}, /* PWM2-CH2 */ + {D3, GET_PIN(B,3), "pwm2", 2}, /* PWM */ {D4, GET_PIN(B,5)}, - {D5, GET_PIN(B,4), "pwm3", 1}, /* PWM3-CH1 */ - {D6, GET_PIN(B,10), "pwm2", 3}, /* PWM2-CH3 */ + {D5, GET_PIN(B,4), "pwm3", 1}, /* PWM */ + {D6, GET_PIN(B,10), "pwm2", 3}, /* PWM */ {D7, GET_PIN(A,8)}, {D8, GET_PIN(A,9)}, - {D9, GET_PIN(C,7), "pwm3", 2}, /* PWM3-CH2 */ - {D10, GET_PIN(B,6), "pwm4", 1}, /* PWM4-CH1 */ - {D11, GET_PIN(A,7), "pwm1", -1}, /* PWM1-CH1N */ + {D9, GET_PIN(C,7), "pwm3", 2}, /* PWM */ + {D10, GET_PIN(B,6), "pwm4", 1}, /* PWM */ + {D11, GET_PIN(A,7), "pwm1", -1}, /* PWM */ {D12, GET_PIN(A,6)}, - {D13, GET_PIN(A,5)}, - {D14}, /* I2C1-SDA */ - {D15}, /* I2C1-SCL */ - {D16, GET_PIN(C,13)}, /* user button */ - {A0, GET_PIN(A,0), "adc1", 0}, /* ADC */ - {A1, GET_PIN(A,1), "adc1", 1}, /* ADC */ - {A2, GET_PIN(A,4), "adc1", 4}, /* ADC */ - {A3, GET_PIN(B,0), "adc1", 8}, /* ADC */ - {A4, GET_PIN(C,1), "adc1", 11}, /* ADC */ - {A5, GET_PIN(C,0), "adc1", 10}, /* ADC */ - {A6, RT_NULL, "adc1", 17}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */ - {A7, RT_NULL, "adc1", 16} /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */ + {D13, GET_PIN(A,5)}, /* LED_BUILTIN */ + {D14, GET_PIN(B,9), "i2c1"}, /* I2C (Wire) */ + {D15, GET_PIN(B,8), "i2c1"}, /* I2C (Wire) */ + {D16, GET_PIN(C,13)}, + {A0, GET_PIN(A,0), "adc1", 0}, /* ADC */ + {A1, GET_PIN(A,1), "adc1", 1}, /* ADC */ + {A2, GET_PIN(A,4), "adc1", 4}, /* ADC */ + {A3, GET_PIN(B,0), "adc1", 8}, /* ADC */ + {A4, GET_PIN(C,1), "adc1", 11}, /* ADC */ + {A5, GET_PIN(C,0), "adc1", 10}, /* ADC */ + {A6, RT_NULL, "adc1", 17}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */ + {A7, RT_NULL, "adc1", 16}, /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */ }; 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 19fb0f754ea26ab14d6e4bce618398335712c533..3d4cff8712114d2432ecc825ebda24332370f547 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 @@ -1,46 +1,48 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2022-04-19 Meco Man first version + * 2022-09-18 liYony 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 D16 (16) -#define A0 (17) -#define A1 (18) -#define A2 (19) -#define A3 (20) -#define A4 (21) -#define A5 (22) -#define A6 (23) -#define A7 (24) +#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 D16 (16) +#define A0 (17) +#define A1 (18) +#define A2 (19) +#define A3 (20) +#define A4 (21) +#define A5 (22) +#define A6 (23) +#define A7 (24) -#define F_CPU 84000000L /* CPU: 84MHz */ -#define LED_BUILTIN D13 /* Default Built-in LED */ +#define F_CPU 84000000L /* CPU:84MHz */ -#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" +#define LED_BUITIN D13 /* Default Built-in LED */ + +/* i2c1 - PB9-SDA PB8-SCL */ +#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" #endif /* Pins_Arduino_h */