[rtduino][stm32] support SPI LCD

This commit is contained in:
Meco Man 2023-05-21 02:06:19 -04:00 committed by Man, Jianting (Meco)
parent df839d5fdb
commit 1f4f495da6
3 changed files with 31 additions and 5 deletions

View File

@ -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接管 |

View File

@ -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 */

View File

@ -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"