update bootloader

This commit is contained in:
不吃油炸鸡
2025-10-09 17:27:45 +08:00
parent 5521c44695
commit af81e3a0dc
6 changed files with 26 additions and 26 deletions

View File

@@ -4,7 +4,7 @@
#include "delay.h"
#include "spi.h"
#define OFFSET_Y 0
#define OFFSET_Y 80
/******************************************************************************
函数说明:在指定区域填充颜色
@@ -60,7 +60,7 @@ void LCD_Fill(u16 xsta,u16 ysta,u16 xend,u16 yend,u16 color)
******************************************************************************/
void LCD_DrawPoint(u16 x,u16 y,u16 color)
{
LCD_Address_Set(x,y,x,y);//设置光标位置
LCD_Address_Set(x,y+OFFSET_Y,x,y+OFFSET_Y);//设置光标位置
LCD_WR_DATA(color);
}
@@ -201,7 +201,7 @@ void LCD_ShowChinese12x12(u16 x,u16 y,u8 *s,u16 fc,u16 bc,u8 sizey,u8 mode)
{
if((tfont12[k].Index[0]==*(s))&&(tfont12[k].Index[1]==*(s+1)))
{
LCD_Address_Set(x,y,x+sizey-1,y+sizey-1);
LCD_Address_Set(x,y+OFFSET_Y,x+sizey-1,y+sizey-1+OFFSET_Y);
for(i=0;i<TypefaceNum;i++)
{
for(j=0;j<8;j++)
@@ -258,7 +258,7 @@ void LCD_ShowChinese16x16(u16 x,u16 y,u8 *s,u16 fc,u16 bc,u8 sizey,u8 mode)
{
if ((tfont16[k].Index[0]==*(s))&&(tfont16[k].Index[1]==*(s+1)))
{
LCD_Address_Set(x,y,x+sizey-1,y+sizey-1);
LCD_Address_Set(x,y+OFFSET_Y,x+sizey-1,y+sizey-1+OFFSET_Y);
for(i=0;i<TypefaceNum;i++)
{
for(j=0;j<8;j++)
@@ -316,7 +316,7 @@ void LCD_ShowChinese24x24(u16 x,u16 y,u8 *s,u16 fc,u16 bc,u8 sizey,u8 mode)
{
if ((tfont24[k].Index[0]==*(s))&&(tfont24[k].Index[1]==*(s+1)))
{
LCD_Address_Set(x,y,x+sizey-1,y+sizey-1);
LCD_Address_Set(x,y+OFFSET_Y,x+sizey-1,y+sizey-1+OFFSET_Y);
for(i=0;i<TypefaceNum;i++)
{
for(j=0;j<8;j++)
@@ -373,7 +373,7 @@ void LCD_ShowChinese32x32(u16 x,u16 y,u8 *s,u16 fc,u16 bc,u8 sizey,u8 mode)
{
if ((tfont32[k].Index[0]==*(s))&&(tfont32[k].Index[1]==*(s+1)))
{
LCD_Address_Set(x,y,x+sizey-1,y+sizey-1);
LCD_Address_Set(x,y+OFFSET_Y,x+sizey-1,y+sizey-1+OFFSET_Y);
for(i=0;i<TypefaceNum;i++)
{
for(j=0;j<8;j++)
@@ -426,7 +426,7 @@ void LCD_ShowChar(u16 x,u16 y,u8 num,u16 fc,u16 bc,u8 sizey,u8 mode)
sizex=sizey/2;
TypefaceNum=(sizex/8+((sizex%8)?1:0))*sizey;
num=num-' '; //得到偏移后的值
LCD_Address_Set(x,y,x+sizex-1,y+sizey-1); //设置光标位置
LCD_Address_Set(x,y+OFFSET_Y,x+sizex-1,y+sizey-1+OFFSET_Y); //设置光标位置
for(i=0;i<TypefaceNum;i++)
{
if(sizey==12)temp=ascii_1206[num][i]; //调用6x12字体
@@ -571,7 +571,7 @@ void LCD_ShowPicture(u16 x,u16 y,u16 length,u16 width,const u8 pic[])
{
u16 i,j;
u32 k=0;
LCD_Address_Set(x,y,x+length-1,y+width-1);
LCD_Address_Set(x,y+OFFSET_Y,x+length-1,y+width-1+OFFSET_Y);
for(i=0;i<length;i++)
{
for(j=0;j<width;j++)

View File

@@ -3,15 +3,15 @@
#include "sys.h"
#define USE_HORIZONTAL 0 //设置横屏或者竖屏显示 0或1为竖屏 2或3为横屏
#define USE_HORIZONTAL 1 //设置横屏或者竖屏显示 0或1为竖屏 2或3为横屏
#if USE_HORIZONTAL==0||USE_HORIZONTAL==1
#define LCD_W 240
#define LCD_H 280
#define LCD_H 240
#else
#define LCD_W 280
#define LCD_W 240
#define LCD_H 240
#endif

View File

@@ -109,7 +109,7 @@ int main(void)
//key_boot
Key_Port_Init();
//PWM Start
// PWM Start for LCD backlight
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
//lcd
@@ -125,7 +125,7 @@ int main(void)
delay_ms(500);
if(HAL_GPIO_ReadPin(KEYB_PORT, KEYB_PIN) == 0)
{
LCD_ShowString(72, LCD_H/2, (uint8_t*)"Bootload", WHITE, BLACK, 24, 0);//12*6,16*8,24*12,32*16
LCD_ShowString(72, LCD_H/3, (uint8_t*)"Bootload", WHITE, BLACK, 24, 0);//12*6,16*8,24*12,32*16
//menu
FLASH_If_Init();
Main_Menu();
@@ -179,8 +179,8 @@ int main(void)
// no legal APP
else
{
LCD_ShowString(74, LCD_H/2, (uint8_t*)"No App!", WHITE, BLACK, 24, 0);//12*6,16*8,24*12,32*16
LCD_ShowString(32, LCD_H/2+48, (uint8_t*)"Please Download", WHITE, BLACK, 24, 0);
LCD_ShowString(74, LCD_H/3, (uint8_t*)"No App!", WHITE, BLACK, 24, 0);//12*6,16*8,24*12,32*16
LCD_ShowString(32, LCD_H/3+48, (uint8_t*)"Please Download", WHITE, BLACK, 24, 0);
HAL_Delay(1000);
}
}

View File

@@ -39,7 +39,7 @@ void MX_USART6_UART_Init(void)
/* USER CODE END USART6_Init 1 */
huart6.Instance = USART6;
huart6.Init.BaudRate = 115200;
huart6.Init.BaudRate = 1500000;
huart6.Init.WordLength = UART_WORDLENGTH_8B;
huart6.Init.StopBits = UART_STOPBITS_1;
huart6.Init.Parity = UART_PARITY_NONE;

View File

@@ -1,6 +1,6 @@
/**
******************************************************************************
* @file STM32F4xx_IAP/src/common.c
* @file STM32F4xx_IAP/src/common.c
* @author MCD Application Team
* @version V1.0.0
* @date 10-October-2011
@@ -17,7 +17,7 @@
*
* <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
******************************************************************************
*/
*/
/** @addtogroup STM32F4xx_IAP
* @{
@@ -191,7 +191,7 @@ uint32_t SerialKeyPressed(uint8_t *key)
{
if (__HAL_UART_GET_FLAG(&huart6, UART_FLAG_RXNE) != RESET)
{
*key = (uint16_t)((&huart6)->Instance->DR & (uint16_t)0x01FF);
*key = (uint16_t)((&huart6)->Instance->DR & (uint16_t)0x01FF);
return 1;
}
else
@@ -227,7 +227,7 @@ uint8_t GetKey(void)
*/
void SerialPutChar(uint8_t c)
{
USART_SendData(USART1, c);
USART_SendData(USART6, c);
while (__HAL_UART_GET_FLAG(&huart6, UART_FLAG_TXE) == RESET)
{
}
@@ -293,8 +293,8 @@ void USART_SendData(USART_TypeDef* USARTx, uint16_t Data)
{
/* Check the parameters */
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_DATA(Data));
assert_param(IS_USART_DATA(Data));
/* Transmit Data */
USARTx->DR = (Data & (uint16_t)0x01FF);
}

View File

@@ -37,10 +37,10 @@
#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbyte */
#define ADDR_FLASH_SECTOR_6 ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbyte */
#define ADDR_FLASH_SECTOR_7 ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbyte */
#define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbyte */
//#define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbyte */
//#define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbyte */
//#define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbyte */
// #define ADDR_FLASH_SECTOR_8 ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbyte */
// #define ADDR_FLASH_SECTOR_9 ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbyte */
// #define ADDR_FLASH_SECTOR_10 ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbyte */
// #define ADDR_FLASH_SECTOR_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbyte */
/* End of the Flash address */
#define USER_FLASH_END_ADDRESS 0x0807FFFF