summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2023-05-21 02:06:19 -0400
committerMan, Jianting (Meco) <[email protected]>2023-05-21 15:37:18 -0400
commit1f4f495da64543a5fd1aa04c6b9cea9f626c263d (patch)
tree857d2660d2523a96d5f393b5b0d5fd6cdcbb7bd4
parentdf839d5fdb02a4a2470ac0503e0000594c15a417 (diff)
[rtduino][stm32] support SPI LCD
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/README.md4
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.c4
-rw-r--r--bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.h28
3 files changed, 31 insertions, 5 deletions
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 03dbb1f7f6..cbb72ef12e 100644
--- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/README.md
+++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/README.md
@@ -60,6 +60,10 @@ Hardware Drivers Config --->
| 33 (D33) | PC6 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 34 (D34) | PA2 | | Serial2-Tx,默认被RT-Thread的UART设备框架uart2接管 |
| 35 (D35) | PA3 | | Serial2-Rx,默认被RT-Thread的UART设备框架uart2接管 |
+| 36 (D36) | PD7 | 是 | LCD 片选 CS |
+| 37 (D37) | PB6 | 是 | LCD 复位 RESET |
+| 38 (D38) | PB4 | 是 | LCD D/C 数据命令选择 即RW读写选择 |
+| 39 (D39) | PB7 | 是 | LCD 背光电源,PWM4-CH2,默认被RT-Thread的PWM设备框架pwm4接管 |
| A0 | PC2 | 是(但不建议) | ADC1-CH3,默认被RT-Thread的ADC设备框架adc1接管 |
| A1 | PC4 | 是(但不建议) | ADC1-CH13,默认被RT-Thread的ADC设备框架adc1接管 |
| A2 | -- | | 芯片内部参考电压 ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 |
diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.c b/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.c
index 8110aad8f6..4237ed284f 100644
--- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.c
+++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino_pinout/pins_arduino.c
@@ -57,6 +57,10 @@ const pin_map_t pin_map_table[]=
{D33, GET_PIN(C,6), "i2c1"}, /* I2C-SCL (Wire) */
{D34, GET_PIN(A,2), "uart2"}, /* Serial2-Tx */
{D35, GET_PIN(A,3), "uart2"}, /* Serial2-Rx */
+ {D36, GET_PIN(D,7)}, /* BSP: LCD CS */
+ {D37, GET_PIN(B,6)}, /* BSP: LCD RESET */
+ {D38, GET_PIN(B,4)}, /* BSP: LCD RW/DC (data or command) */
+ {D39, GET_PIN(B,7), "pwm4", 2}, /* BSP: LCD POWER */
{A0, GET_PIN(C,2), "adc1", 3}, /* ADC */
{A1, GET_PIN(C,4), "adc1", 13}, /* ADC */
{A2, RT_NULL, "adc1", RT_ADC_INTERN_CH_VREF}, /* ADC, On-Chip: internal reference voltage */
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 15f999b938..0a14f52394 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
@@ -49,11 +49,15 @@
#define D33 (33)
#define D34 (34)
#define D35 (35)
-#define A0 (36)
-#define A1 (37)
-#define A2 (38)
-#define A3 (39)
-#define DAC0 (40)
+#define D36 (36)
+#define D37 (37)
+#define D38 (38)
+#define D39 (39)
+#define A0 (40)
+#define A1 (41)
+#define A2 (42)
+#define A3 (43)
+#define DAC0 (44)
#define F_CPU 80000000L /* CPU:80MHz */
@@ -70,6 +74,20 @@
#define SS D28 /* Chip select pin of default spi */
#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi2"
+#ifndef RTDUINO_DEFAULT_SPI_BUS_NAME
+/*
+ * SPI LCD ST7789 (spi3)
+ * LCD-SPI-SDA PB5
+ * LCD-SPI-SCK PB3
+ * LCD-SPI-CS PD7
+ * LCD-POWER PB7
+ * LCD-RESET PB6
+ * LCD-WR/DC PB4
+ */
+#define SS D36 /* LCD-SPI-CS PD7 */
+#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi3" /* LCD SPI Bus */
+#endif
+
/* Serial2 - PA2-TX PA3-RX */
#define RTDUINO_SERIAL2_DEVICE_NAME "uart2"