Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
2022-04-28 15:08:12 +08:00
parent 0e275a0c18
commit 34e444d832
69 changed files with 2553 additions and 2216 deletions
+7
View File
@@ -53,3 +53,10 @@ void GEI_BUTTON_CODE(button *bt)
}
int GET_ENCODE(encoder *e)
{
int buff;
buff=e->code;
e->code=0;
return buff;
}
+1 -1
View File
@@ -22,5 +22,5 @@ typedef struct
} encoder;
void GEI_BUTTON_CODE(button *bt);
int GET_ENCODE(encoder *e);
#endif /* ENCODER_H_ */
@@ -17,6 +17,9 @@ extern TIM_HandleTypeDef htim2;
#define MUTE(x) HAL_GPIO_WritePin(mute_GPIO_Port, mute_Pin, x)
#define tack_a() HAL_GPIO_ReadPin(tack_a_GPIO_Port, tack_a_Pin)
#define tack_b() HAL_GPIO_ReadPin(tack_b_GPIO_Port, tack_b_Pin)
#define RUNLED_TICK() HAL_GPIO_TogglePin(run_led_GPIO_Port, run_led_Pin)
void IIC_SAND_DATE(uint16_t DEVICE_ADD,uint16_t IN_DEVICE_ADD,uint8_t *DATAS,uint16_t LONG);
+50 -9
View File
@@ -167,20 +167,26 @@ char getmorsecode(uint8_t len,uint8_t code)
}
button B1;
button B1;//创建一个按钮
encoder E1;//创建一个编码器
int mode=0;
uint32_t run_tick=0;
char str[16];
uint16_t fps=0,fps_=0;
int encode_c=0;
void mymain()
{
int mode=0;
uint32_t run_tick=0;
char str[16];
uint16_t fps=0,fps_=0;
//按钮定义接口
B1.GPIOx=en_c_GPIO_Port;
B1.GPIO_Pin=en_c_Pin;
OLED_Init();
OLED_Init();//屏幕初始化
HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_3);//启动n通道的pwm
MUTE(1);
//add_a_note(1000,50,1000);
MUTE(1);//静音
//add_a_note(1000,50,1000);//开机响一声
while(1)
@@ -196,6 +202,14 @@ void mymain()
break;
case 1:
//主界面
sprintf(str,"BUTTON:%d",B1.code);
OLED_Str(0,0,8,str,1);
encode_c+=GET_ENCODE(&E1);
sprintf(str,"ENCODE:%d",encode_c);
OLED_Str(0,8,8,str,1);
fps_++;
sprintf(str,"FPS:%d",fps);
OLED_Str(0,56,8,str,1);
@@ -208,7 +222,7 @@ void mymain()
GEI_BUTTON_CODE(&B1);//循环更新按钮
OLED_Cache_to_hardware();//刷新屏幕
buzzer_play_server();
if(HAL_GetTick()>run_tick)
@@ -221,3 +235,30 @@ void mymain()
}
}
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
switch (GPIO_Pin)
{
case en_a_Pin:
switch(HAL_GPIO_ReadPin(en_b_GPIO_Port,en_b_Pin))
{
case 1:
E1.code+=1;
E1.move_flag=1;
break;
case 0:
E1.code-=1;
E1.move_flag=1;
break;
}
break;
default:
break;
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
}
}
-7
View File
@@ -1105,10 +1105,3 @@ void OLED_square(int Start_x, int Start_y, int End_x, int End_y, char type)
}
}
+4
View File
@@ -17,6 +17,10 @@
#define Y_WIDTH 64
#define Y_WIDTH_ 8
void OLED_Init(void);
void OLED_Cache_to_hardware();
File diff suppressed because one or more lines are too long
+16 -4
View File
@@ -183,7 +183,7 @@
<Group>
<GroupName>Application/MDK-ARM</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@@ -203,7 +203,7 @@
<Group>
<GroupName>Application/User/Core</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@@ -247,7 +247,7 @@
<Group>
<GroupName>Drivers/STM32F1xx_HAL_Driver</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@@ -423,7 +423,7 @@
<Group>
<GroupName>Drivers/CMSIS</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
@@ -507,6 +507,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>25</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\MYDEIVERS\encode.c</PathWithFileName>
<FilenameWithoutPath>encode.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
@@ -523,6 +523,11 @@
<FileType>1</FileType>
<FilePath>.\MYDEIVERS\buzzer.c</FilePath>
</File>
<File>
<FileName>encode.c</FileName>
<FileType>1</FileType>
<FilePath>.\MYDEIVERS\encode.c</FilePath>
</File>
</Files>
</Group>
<Group>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,31 @@
f103c8t6_keil\encode.o: MYDEIVERS\encode.c
f103c8t6_keil\encode.o: MYDEIVERS\encode.h
f103c8t6_keil\encode.o: ../Core/Inc/main.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
f103c8t6_keil\encode.o: ../Core/Inc/stm32f1xx_hal_conf.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h
f103c8t6_keil\encode.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h
f103c8t6_keil\encode.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h
f103c8t6_keil\encode.o: ../Drivers/CMSIS/Include/core_cm3.h
f103c8t6_keil\encode.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
f103c8t6_keil\encode.o: ../Drivers/CMSIS/Include/cmsis_version.h
f103c8t6_keil\encode.o: ../Drivers/CMSIS/Include/cmsis_compiler.h
f103c8t6_keil\encode.o: ../Drivers/CMSIS/Include/cmsis_armcc.h
f103c8t6_keil\encode.o: ../Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h
f103c8t6_keil\encode.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stddef.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_exti.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_i2c.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h
f103c8t6_keil\encode.o: ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h
Binary file not shown.
@@ -22,27 +22,31 @@ Dialog DLL: TCM.DLL V1.53.0.0
<h2>Project:</h2>
C:\Users\kevin\Desktop\morse_code_trainer\f103c8t6_keil\MDK-ARM\f103c8t6_KEIL.uvprojx
Project File Date: 04/19/2022
Project File Date: 04/28/2022
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'f103c8t6_KEIL'
compiling mymain.c...
MYDEIVERS\oled.h(22): warning: #1295-D: Deprecated declaration OLED_Cache_to_hardware - give arg types
MYDEIVERS\oled.h(26): warning: #1295-D: Deprecated declaration OLED_Cache_to_hardware - give arg types
void OLED_Cache_to_hardware();
MYDEIVERS\buzzer.h(16): warning: #1295-D: Deprecated declaration buzzer_play_server - give arg types
char buzzer_play_server();
MYDEIVERS\mymain.h(23): warning: #1295-D: Deprecated declaration mymain - give arg types
void mymain();
MYDEIVERS\mymain.c(182): warning: #188-D: enumerated type mixed with another type
MUTE(1);
MYDEIVERS\mymain.c(200): warning: #223-D: function "sprintf" declared implicitly
sprintf(str,"FPS:%d",fps);
MYDEIVERS\mymain.c: 5 warnings, 0 errors
MYDEIVERS\mymain.c(188): warning: #188-D: enumerated type mixed with another type
MUTE(1);//é™éŸ³
MYDEIVERS\mymain.c(206): warning: #223-D: function "sprintf" declared implicitly
sprintf(str,"BUTTON:%d",B1.code);
MYDEIVERS\mymain.c(262): warning: #111-D: statement is unreachable
__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
MYDEIVERS\mymain.c(264): warning: #1-D: last line of file ends without a newline
}
MYDEIVERS\mymain.c: 7 warnings, 0 errors
linking...
Program Size: Code=9140 RO-data=3712 RW-data=28 ZI-data=3836
Program Size: Code=9508 RO-data=3712 RW-data=52 ZI-data=3876
FromELF: creating hex file...
"f103c8t6_KEIL\f103c8t6_KEIL.axf" - 0 Error(s), 5 Warning(s).
"f103c8t6_KEIL\f103c8t6_KEIL.axf" - 0 Error(s), 7 Warning(s).
<h2>Software Packages used:</h2>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -23,6 +23,7 @@
"f103c8t6_keil\oled.o"
"f103c8t6_keil\fonts.o"
"f103c8t6_keil\buzzer.o"
"f103c8t6_keil\encode.o"
--strict --scatter "f103c8t6_KEIL\f103c8t6_KEIL.sct"
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
--info sizes --info totals --info unused --info veneers
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.