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 a594733402..78ca20f77b 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 @@ -46,6 +46,10 @@ const pin_map_t pin_map_table[]= {D23, GET_PIN(E,9), "pwm1", 1}, /* PWM, BSP: BLUE-LED */ {D24, GET_PIN(B,0)}, /* INFRARED EMISSION */ {D25, GET_PIN(B,1)}, /* INFRARED RECEPTION */ + {D26, GET_PIN(D,7)}, /* LCD CS */ + {D27, GET_PIN(B,6)}, /* LCD RESET */ + {D28, GET_PIN(B,4)}, /* LCD DC (data or command) */ + {D29, GET_PIN(B,7)}, /* LCD POWER */ {A0, GET_PIN(C,2), "adc1", 3}, /* ADC */ {A1, GET_PIN(C,4), "adc1", 13}, /* ADC */ {A2, RT_NULL, "adc1", 0}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */ 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 8961020cdc..66bdd587aa 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 @@ -38,22 +38,32 @@ #define D23 (23) #define D24 (24) #define D25 (25) -#define A0 (26) -#define A1 (27) -#define A2 (28) -#define A3 (29) -#define DAC0 (30) +#define D26 (26) +#define D27 (27) +#define D28 (28) +#define D29 (29) +#define A0 (30) +#define A1 (31) +#define A2 (32) +#define A3 (33) +#define DAC0 (34) #define F_CPU 80000000L /* CPU: 80MHz */ #define LED_BUILTIN D22 /* Default Built-in LED */ /* - * i2c1 - PC7-SDA PC6-SCL(User I2C) + * i2c1 - PC7-SDA PC6-SCL (User I2C) * i2c3 - ICM20608, AP3216C (On Board) * i2c4 - AHT10 (On Board) */ #define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c4" + +/* + * spi2 - Wireless Interface (User SPI) + * spi3 - LCD ST7789 + */ #define RTDUINO_DEFAULT_SPI_BUS_NAME "spi2" + #define RTDUINO_DEFAULT_HWTIMER_DEVICE_NAME "timer7" #define RTDUINO_SERIAL2_DEVICE_NAME "uart2" diff --git a/bsp/stm32/stm32l475-atk-pandora/board/Kconfig b/bsp/stm32/stm32l475-atk-pandora/board/Kconfig index 9c65d51ce9..877a0d2578 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/Kconfig +++ b/bsp/stm32/stm32l475-atk-pandora/board/Kconfig @@ -39,18 +39,21 @@ menu "Onboard Peripheral Drivers" select BSP_USING_ADC select BSP_USING_ADC1 select BSP_USING_I2C - select BSP_USING_I2C1 - select BSP_USING_I2C3 - select BSP_USING_I2C4 + select BSP_USING_I2C1 # PC7-SDA PC6-SCL (User I2C) + select BSP_USING_I2C3 # ICM20608, AP3216C (On Board) + select BSP_USING_I2C4 # AHT10 (On Board) select BSP_USING_DAC select BSP_USING_DAC1 select BSP_USING_SPI - select BSP_USING_SPI2 + select BSP_USING_SPI2 # Wireless Interface (User SPI) imply BSP_SPI2_TX_USING_DMA imply BSP_SPI2_RX_USING_DMA + select BSP_USING_SPI3 # LCD ST7789 + select BSP_SPI3_TX_USING_DMA imply RTDUINO_USING_SERVO imply RTDUINO_USING_WIRE imply RTDUINO_USING_SPI + imply RTDUINO_USING_USBSERIAL imply RTDUINO_USING_ADAFRUIT imply RTDUINO_USING_MSTIMER2 default n diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c index 02f2b6927e..b9c19dc8f0 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/drv_lcd.c @@ -40,7 +40,7 @@ static int rt_hw_lcd_config(void) /* config spi */ { - struct rt_spi_configuration cfg; + struct rt_spi_configuration cfg = {0}; cfg.data_width = 8; cfg.mode = RT_SPI_MASTER | RT_SPI_MODE_0 | RT_SPI_MSB; cfg.max_hz = 42 * 1000 * 1000; /* 42M,SPI max 42MHz,lcd 4-wire spi */ diff --git a/components/drivers/include/drivers/adc.h b/components/drivers/include/drivers/adc.h index 81565d068b..601e16292e 100644 --- a/components/drivers/include/drivers/adc.h +++ b/components/drivers/include/drivers/adc.h @@ -20,7 +20,7 @@ struct rt_adc_ops rt_err_t (*enabled)(struct rt_adc_device *device, rt_uint32_t channel, rt_bool_t enabled); rt_err_t (*convert)(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value); rt_uint8_t (*get_resolution)(struct rt_adc_device *device); - rt_int16_t (*get_vref) (const struct rt_adc_device *device); + rt_int16_t (*get_vref) (struct rt_adc_device *device); }; struct rt_adc_device diff --git a/components/drivers/include/drivers/rt_drv_pwm.h b/components/drivers/include/drivers/rt_drv_pwm.h index 2b782f7e53..567b368daa 100644 --- a/components/drivers/include/drivers/rt_drv_pwm.h +++ b/components/drivers/include/drivers/rt_drv_pwm.h @@ -23,7 +23,7 @@ struct rt_pwm_configuration { - rt_uint32_t channel; /* 0-n */ + rt_uint32_t channel; /* 1-n or 0-n, which depends on specific MCU requirements */ rt_uint32_t period; /* unit:ns 1ns~4.29s:1Ghz~0.23hz */ rt_uint32_t pulse; /* unit:ns (pulse<=period) */