diff --git a/bsp/stm32/stm32f072-st-nucleo/applications/arduino/pins_arduino.c b/bsp/stm32/stm32f072-st-nucleo/applications/arduino/pins_arduino.c index 3453369b8f1e18c55e73cfe2ea9eafd56a1e10c1..9f71da8711f97f7890af87b62f0b5310e96a7775 100644 --- a/bsp/stm32/stm32f072-st-nucleo/applications/arduino/pins_arduino.c +++ b/bsp/stm32/stm32f072-st-nucleo/applications/arduino/pins_arduino.c @@ -20,11 +20,11 @@ */ const pin_map_t pin_map_table[]= { - {D0, GET_PIN(A,3)}, /* RX */ - {D1, GET_PIN(A,2)}, /* TX */ + {D0}, /* RX */ + {D1}, /* TX */ {D2, GET_PIN(A,10)}, {D3, GET_PIN(B,3), "pwm2", 2}, /* PWM */ - {D4, GET_PIN(B,5)}, /* D4 */ + {D4, GET_PIN(B,5)}, {D5, GET_PIN(B,4), "pwm3", 1}, /* PWM */ {D6, GET_PIN(B,10), "pwm2", 3}, /* PWM */ {D7, GET_PIN(A,8)}, @@ -36,12 +36,12 @@ const pin_map_t pin_map_table[]= {D13, GET_PIN(A,5)}, {D14, GET_PIN(B,9)}, {D15, GET_PIN(B,8)}, - {A0, GET_PIN(A,0), "adc1", 0}, - {A1, GET_PIN(A,1), "adc1", 1}, - {A2, GET_PIN(A,4), "adc1", 4}, - {A3, GET_PIN(B,0), "adc1", 8}, - {A4, GET_PIN(C,1), "adc1", 11}, - {A5, GET_PIN(C,0), "adc1", 10} + {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 */ }; /* initialization for BSP; maybe a blank function */ diff --git a/bsp/stm32/stm32f072-st-nucleo/applications/arduino/pins_arduino.h b/bsp/stm32/stm32f072-st-nucleo/applications/arduino/pins_arduino.h index 2b8022e333e92ad597ff052dca6c797350186810..e62cec663542a7ad70dd4d53f5861880d09f3607 100644 --- a/bsp/stm32/stm32f072-st-nucleo/applications/arduino/pins_arduino.h +++ b/bsp/stm32/stm32f072-st-nucleo/applications/arduino/pins_arduino.h @@ -36,7 +36,6 @@ #define LED_BUILTIN D13 /* Built-in LED */ -#define ARDUINO_PINOUT_PWM_MAX 5 /* This Arduino variant has 5 PWM pins */ #define ARDUINO_PWM_HZ 500 /* Arduino UNO's PWM is around 500Hz */ #define ARDUINO_DEFAULT_IIC_BUS_NAME "i2c4" diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.c b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.c index 6fb99d4898c76c40bf6170a0530212684024c485..796db0cd2dfc557a950cae26196e1ac0ef7eb985 100644 --- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.c +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.c @@ -44,12 +44,10 @@ const pin_map_t pin_map_table[]= {D21, GET_PIN(E,7)}, /* BSP: RED-LED */ {D22, GET_PIN(E,8)}, /* LED_BUILTIN, BSP: GREEN-LED */ {D23, GET_PIN(E,9), "pwm1", 1}, /* PWM, BSP: BLUE-LED */ - {A0, GET_PIN(C,2), "adc1", 3}, - {A1, GET_PIN(C,4), "adc1", 13}, - {A2}, - {A3}, - {A4}, - {A5} + {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 */ + {A3, RT_NULL, "adc1", 17} /* ADC, On-Chip: internal temperature sensor */ }; /* initialization for BSP; maybe a blank function */ diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.h b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.h index e0d619ba512dea613942a9f1a48a681ba7901256..d21b5394b50252f89fb2e11b39fa41162597d968 100644 --- a/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.h +++ b/bsp/stm32/stm32l475-atk-pandora/applications/arduino/pins_arduino.h @@ -39,12 +39,9 @@ #define A1 (25) #define A2 (26) #define A3 (27) -#define A4 (28) -#define A5 (29) #define LED_BUILTIN D22 /* Built-in LED */ -#define ARDUINO_PINOUT_PWM_MAX 6 /* This Arduino variant has 6 PWM pins */ #define ARDUINO_PWM_HZ 500 /* Arduino UNO's PWM is around 500Hz */ #define ARDUINO_DEFAULT_IIC_BUS_NAME "i2c4" diff --git a/bsp/stm32/stm32l475-atk-pandora/board/CubeMX_Config/STM32L475VE.ioc b/bsp/stm32/stm32l475-atk-pandora/board/CubeMX_Config/STM32L475VE.ioc index 9077e5943688b9ed0974c6dd567b77e9c9c5a3d3..d70a8ee43fb02be4fc9a6a853996d63e1bf53eee 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/CubeMX_Config/STM32L475VE.ioc +++ b/bsp/stm32/stm32l475-atk-pandora/board/CubeMX_Config/STM32L475VE.ioc @@ -78,24 +78,26 @@ Mcu.Pin43=PB3 (JTDO-TRACESWO) Mcu.Pin44=PB5 Mcu.Pin45=PB7 Mcu.Pin46=PB8 -Mcu.Pin47=VP_IWDG_VS_IWDG -Mcu.Pin48=VP_LPTIM1_VS_LPTIM_counterModeInternalClock -Mcu.Pin49=VP_RTC_VS_RTC_Activate +Mcu.Pin47=VP_ADC1_TempSens_Input +Mcu.Pin48=VP_ADC1_Vref_Input +Mcu.Pin49=VP_IWDG_VS_IWDG Mcu.Pin5=PC14-OSC32_IN (PC14) -Mcu.Pin50=VP_SAI1_VP_$IpInstance_SAIA_SAI_BASIC -Mcu.Pin51=VP_SAI1_VP_$IpInstance_SAIB_SAI_BASIC -Mcu.Pin52=VP_SYS_VS_Systick -Mcu.Pin53=VP_TIM1_VS_ClockSourceINT -Mcu.Pin54=VP_TIM2_VS_ClockSourceINT -Mcu.Pin55=VP_TIM4_VS_ClockSourceINT -Mcu.Pin56=VP_TIM15_VS_ClockSourceINT -Mcu.Pin57=VP_TIM16_VS_ClockSourceINT -Mcu.Pin58=VP_TIM17_VS_ClockSourceINT +Mcu.Pin50=VP_LPTIM1_VS_LPTIM_counterModeInternalClock +Mcu.Pin51=VP_RTC_VS_RTC_Activate +Mcu.Pin52=VP_SAI1_VP_$IpInstance_SAIA_SAI_BASIC +Mcu.Pin53=VP_SAI1_VP_$IpInstance_SAIB_SAI_BASIC +Mcu.Pin54=VP_SYS_VS_Systick +Mcu.Pin55=VP_TIM1_VS_ClockSourceINT +Mcu.Pin56=VP_TIM2_VS_ClockSourceINT +Mcu.Pin57=VP_TIM4_VS_ClockSourceINT +Mcu.Pin58=VP_TIM15_VS_ClockSourceINT +Mcu.Pin59=VP_TIM16_VS_ClockSourceINT Mcu.Pin6=PC15-OSC32_OUT (PC15) +Mcu.Pin60=VP_TIM17_VS_ClockSourceINT Mcu.Pin7=PH0-OSC_IN (PH0) Mcu.Pin8=PH1-OSC_OUT (PH1) Mcu.Pin9=PC2 -Mcu.PinsNb=59 +Mcu.PinsNb=61 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32L475VETx @@ -369,6 +371,10 @@ USART2.IPParameters=VirtualMode-Asynchronous USART2.VirtualMode-Asynchronous=VM_ASYNC USB_OTG_FS.IPParameters=VirtualMode USB_OTG_FS.VirtualMode=Device_Only +VP_ADC1_TempSens_Input.Mode=IN-TempSens +VP_ADC1_TempSens_Input.Signal=ADC1_TempSens_Input +VP_ADC1_Vref_Input.Mode=IN-Vrefint +VP_ADC1_Vref_Input.Signal=ADC1_Vref_Input VP_IWDG_VS_IWDG.Mode=IWDG_Activate VP_IWDG_VS_IWDG.Signal=IWDG_VS_IWDG VP_LPTIM1_VS_LPTIM_counterModeInternalClock.Mode=Counts__internal_clock_event_00 diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/demo/lcd_sample.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/demo/lcd_sample.c index 336a494fcae250502a5e8e3592ca0008974e2eb6..ddcb64d564f9bd4d54b47210b367f80b0e3d1b10 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/demo/lcd_sample.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/demo/lcd_sample.c @@ -12,8 +12,10 @@ #include #include #include -#include #include "rttlogo.h" +#ifdef BSP_USING_LCD_QRCODE +#include +#endif /* BSP_USING_LCD_QRCODE */ static int lcd_sample(void) { @@ -24,7 +26,8 @@ static int lcd_sample(void) lcd_draw_line(0, 69+24, 240, 69+24); #ifdef BSP_USING_LCD_QRCODE lcd_show_qrcode(54, 69+24+6, 4, ECC_LOW, "https://www.rt-thread.org/", 4); -#endif +#endif /* BSP_USING_LCD_QRCODE */ + return RT_EOK; } INIT_APP_EXPORT(lcd_sample); 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 3dcc2ae982d076ecf1409a366e633bae1ca90482..02f2b6927ef650dd6ca5bb0e2091a87be8a26bdb 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 @@ -238,10 +238,15 @@ void lcd_display_brightness(rt_uint8_t percent) { struct rt_device_pwm *pwm_dev; + if(percent > 100) + { + percent = 100; + } + pwm_dev = (struct rt_device_pwm*)rt_device_find("pwm4"); if(pwm_dev != RT_NULL) { - rt_pwm_set(pwm_dev, 2, 1000000, percent*10000); /* PWM4 CH2 with 1000Hz */ + rt_pwm_set(pwm_dev, 2, 1000000, percent*10000); /* PB7, PWM4 CH2 with 1000Hz */ rt_pwm_enable(pwm_dev, 2); } } diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c index 2f58bbe966c64059c2dab07566fa9a56fc077d9b..aebc36b679defe9efbcef507db20989b164f9551 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.c @@ -105,7 +105,7 @@ static void show_qrcode_by_line(rt_uint16_t x, rt_uint16_t y, rt_uint8_t size, r * * @param x x position * @param y y position - * @param version version of qrcode + * @param version version of qrcode (ECC_LOW, ECC_MEDIUM, ECC_QUARTILE or ECC_HIGH) * @param ecc level of error correction * @param data string * @param enlargement enlargement_factor diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h index 320cbb8aa624271ae5b547ebdda80f5b7aa4a168..c9c0de99c50788e6ead066d0dfc1f31316a6106a 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/lcd/lcd_qrcode.h @@ -5,7 +5,9 @@ #ifdef BSP_USING_LCD_QRCODE #include +#include + rt_err_t lcd_show_qrcode(rt_uint16_t x, rt_uint16_t y, rt_uint8_t version, rt_uint8_t ecc, const char *data, rt_uint8_t enlargement); -#endif +#endif /* BSP_USING_LCD_QRCODE */ #endif