mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
update bootloader
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
#include "delay.h"
|
#include "delay.h"
|
||||||
#include "spi.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)
|
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);
|
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)))
|
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(i=0;i<TypefaceNum;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<8;j++)
|
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)))
|
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(i=0;i<TypefaceNum;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<8;j++)
|
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)))
|
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(i=0;i<TypefaceNum;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<8;j++)
|
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)))
|
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(i=0;i<TypefaceNum;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<8;j++)
|
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;
|
sizex=sizey/2;
|
||||||
TypefaceNum=(sizex/8+((sizex%8)?1:0))*sizey;
|
TypefaceNum=(sizex/8+((sizex%8)?1:0))*sizey;
|
||||||
num=num-' '; //得到偏移后的值
|
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++)
|
for(i=0;i<TypefaceNum;i++)
|
||||||
{
|
{
|
||||||
if(sizey==12)temp=ascii_1206[num][i]; //调用6x12字体
|
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;
|
u16 i,j;
|
||||||
u32 k=0;
|
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(i=0;i<length;i++)
|
||||||
{
|
{
|
||||||
for(j=0;j<width;j++)
|
for(j=0;j<width;j++)
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
|
|
||||||
#include "sys.h"
|
#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
|
#if USE_HORIZONTAL==0||USE_HORIZONTAL==1
|
||||||
#define LCD_W 240
|
#define LCD_W 240
|
||||||
#define LCD_H 280
|
#define LCD_H 240
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define LCD_W 280
|
#define LCD_W 240
|
||||||
#define LCD_H 240
|
#define LCD_H 240
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ int main(void)
|
|||||||
//key_boot
|
//key_boot
|
||||||
Key_Port_Init();
|
Key_Port_Init();
|
||||||
|
|
||||||
//PWM Start
|
// PWM Start for LCD backlight
|
||||||
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
|
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
|
||||||
|
|
||||||
//lcd
|
//lcd
|
||||||
@@ -125,7 +125,7 @@ int main(void)
|
|||||||
delay_ms(500);
|
delay_ms(500);
|
||||||
if(HAL_GPIO_ReadPin(KEYB_PORT, KEYB_PIN) == 0)
|
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
|
//menu
|
||||||
FLASH_If_Init();
|
FLASH_If_Init();
|
||||||
Main_Menu();
|
Main_Menu();
|
||||||
@@ -179,8 +179,8 @@ int main(void)
|
|||||||
// no legal APP
|
// no legal APP
|
||||||
else
|
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(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/2+48, (uint8_t*)"Please Download", WHITE, BLACK, 24, 0);
|
LCD_ShowString(32, LCD_H/3+48, (uint8_t*)"Please Download", WHITE, BLACK, 24, 0);
|
||||||
HAL_Delay(1000);
|
HAL_Delay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ void MX_USART6_UART_Init(void)
|
|||||||
|
|
||||||
/* USER CODE END USART6_Init 1 */
|
/* USER CODE END USART6_Init 1 */
|
||||||
huart6.Instance = USART6;
|
huart6.Instance = USART6;
|
||||||
huart6.Init.BaudRate = 115200;
|
huart6.Init.BaudRate = 1500000;
|
||||||
huart6.Init.WordLength = UART_WORDLENGTH_8B;
|
huart6.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
huart6.Init.StopBits = UART_STOPBITS_1;
|
huart6.Init.StopBits = UART_STOPBITS_1;
|
||||||
huart6.Init.Parity = UART_PARITY_NONE;
|
huart6.Init.Parity = UART_PARITY_NONE;
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ uint8_t GetKey(void)
|
|||||||
*/
|
*/
|
||||||
void SerialPutChar(uint8_t c)
|
void SerialPutChar(uint8_t c)
|
||||||
{
|
{
|
||||||
USART_SendData(USART1, c);
|
USART_SendData(USART6, c);
|
||||||
while (__HAL_UART_GET_FLAG(&huart6, UART_FLAG_TXE) == RESET)
|
while (__HAL_UART_GET_FLAG(&huart6, UART_FLAG_TXE) == RESET)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#define ADDR_FLASH_SECTOR_5 ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbyte */
|
#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_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_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_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_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_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_11 ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbyte */
|
||||||
|
|||||||
Reference in New Issue
Block a user