mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-18 13:03:31 +08:00
[stm32 pandora] fix the bug when using LCD demo (#5692)
* [stm32 pandora] fix the bug when using LCD demo * arduino 增加内部温度传感器和参考电压通道 * remove ARDUINO_PINOUT_PWM_MAX
This commit is contained in:
parent
f3b72aa179
commit
fba060e550
@ -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 */
|
||||
|
@ -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"
|
||||
|
@ -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 */
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -12,8 +12,10 @@
|
||||
#include <rtdevice.h>
|
||||
#include <board.h>
|
||||
#include <drv_lcd.h>
|
||||
#include <lcd_qrcode.h>
|
||||
#include "rttlogo.h"
|
||||
#ifdef BSP_USING_LCD_QRCODE
|
||||
#include <lcd_qrcode.h>
|
||||
#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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -5,7 +5,9 @@
|
||||
|
||||
#ifdef BSP_USING_LCD_QRCODE
|
||||
#include <rtdef.h>
|
||||
#include <qrcode.h>
|
||||
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user