优化中,生成HEX文件

This commit is contained in:
2021-10-24 11:04:21 +08:00
parent 230f928a0f
commit b8bf07f4cf
27 changed files with 3005 additions and 3072 deletions
+12 -64
View File
@@ -5,6 +5,7 @@
* Author: wuwenfeng
*/
#include "my_code.h"
#include "gpio.h"
#include "button.h"
#include "ht1621.h"
#include "flash.h"
@@ -43,27 +44,10 @@ struct
}moto;
void ds_in_or_out(char a)//change the io function
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = HC595_DLK_Pin;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
if(a==0)
{
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
}
if(a==1)
{
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
}
HAL_GPIO_Init(HC595_DLK_GPIO_Port, &GPIO_InitStruct);
}
uint8_t Read_Ds()
{
ds_in_or_out(0);
change_io_function(HC595_DLK_GPIO_Port,HC595_DLK_Pin,1);
if(READ_HC595_DCK){return 0;}else{return 1;}
//return READ_HC595_DCK;
}
@@ -71,7 +55,7 @@ uint8_t Read_Ds()
//send data to 959
void Sand_Byte_to_595_2(uint8_t h)
{
ds_in_or_out(1);
change_io_function(HC595_DLK_GPIO_Port,HC595_DLK_Pin,0);
HC595_DCK(0);
HC595_SCK2(0);
HC595_RCK(0);
@@ -225,8 +209,8 @@ const unsigned char LED_Tab[]=
#define H 0x01
void HT1621_Display_GetButton(void)
{
unsigned char send_buff[8]={0,0,0,0,0,0,0,0,0};
unsigned char lcd_buff[4]={0,0,0,0};
unsigned char send_buff[8];
unsigned char lcd_buff[4];
//WritenDataHT1621(0,send_buff,8);
@@ -277,22 +261,6 @@ void my_code()
long countdown_set=15000;
dis_buff.moto1a=0;
dis_buff.moto1b=0;
dis_buff.moto2a=0;
dis_buff.moto2b=0;
moto.moto_run=0;
moto.pwm_run=0;
moto.moto1a=0;
moto.moto1b=0;
moto.moto2a=0;
moto.moto2b=0;
moto.moto1a_=0;
moto.moto1b_=0;
moto.moto2a_=0;
moto.moto2b_=0;
HT1621_Init();
r480_init();
@@ -352,7 +320,13 @@ void my_code()
moto.moto1b=0;
moto.moto2a=0;
moto.moto2b=0;
dis_buff.d_num[0]=16;
dis_buff.d_num[1]=16;
dis_buff.d_num[2]=16;
dis_buff.d_num[3]=16;
dis_buff.dot1=0;
dis_buff.dot2=0;
dis_buff.dot3=0;
if(HAL_GetTick()>runtime)
{
runtime+=1000;
@@ -367,14 +341,7 @@ void my_code()
dis_buff.dot4=0;
}
}
dis_buff.d_num[0]=16;
dis_buff.d_num[1]=16;
dis_buff.d_num[2]=16;
dis_buff.d_num[3]=16;
dis_buff.dot1=0;
dis_buff.dot2=0;
dis_buff.dot3=0;
overload_times=0;
if(key2.code!=0)
@@ -562,26 +529,7 @@ void my_code()
}
break;
case 6:
//debug
if(HAL_GetTick()>runtime)
{
runtime+=1000;
if(dis_buff.led_run==1)
{
dis_buff.led_run=0;
dis_buff.dot4=1;
}else
{
dis_buff.led_run=1;
dis_buff.dot4=0;
}
}
dis_buff.d_num[3]=(r480.times/100)%10;
dis_buff.d_num[2]=(r480.times/1000)%10;
dis_buff.d_num[1]=((r480.times/10000)%10);
break;
}
if(ADCC.adc_value[0]>600||ADCC.adc_value[1]>600)