Merge branch 'dev' of https://gitee.com/xiaoma_gitee_1/ciu32_-l051_-m307-r into dev
This commit is contained in:
commit
3475d83584
|
@ -193,7 +193,7 @@
|
||||||
"<virtual_root>/drivers/src/driver_usart.c",
|
"<virtual_root>/drivers/src/driver_usart.c",
|
||||||
"<virtual_root>/drivers/src/common.c"
|
"<virtual_root>/drivers/src/common.c"
|
||||||
],
|
],
|
||||||
"toolchain": "AC6",
|
"toolchain": "AC5",
|
||||||
"compileConfig": {
|
"compileConfig": {
|
||||||
"cpuType": "Cortex-M0+",
|
"cpuType": "Cortex-M0+",
|
||||||
"floatingPointHardware": "none",
|
"floatingPointHardware": "none",
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"mem": {
|
"mem": {
|
||||||
"startAddr": "0x20000000",
|
"startAddr": "0x20000000",
|
||||||
"size": "0x4000"
|
"size": "0x5000"
|
||||||
},
|
},
|
||||||
"isChecked": true,
|
"isChecked": true,
|
||||||
"noInit": false
|
"noInit": false
|
||||||
|
@ -227,12 +227,14 @@
|
||||||
},
|
},
|
||||||
"options": "null"
|
"options": "null"
|
||||||
},
|
},
|
||||||
"uploader": "OpenOCD",
|
"uploader": "pyOCD",
|
||||||
"uploadConfig": {
|
"uploadConfig": {
|
||||||
"bin": "",
|
"bin": "",
|
||||||
"target": "stm32f1x",
|
"targetName": "cortex_m",
|
||||||
"interface": "stlink",
|
"baseAddr": "0x08000000",
|
||||||
"baseAddr": "0x08000000"
|
"speed": "4M",
|
||||||
|
"config": ".eide/usart1_interrupt.pyocd.yaml",
|
||||||
|
"otherCmds": ""
|
||||||
},
|
},
|
||||||
"uploadConfigMap": {
|
"uploadConfigMap": {
|
||||||
"JLink": {
|
"JLink": {
|
||||||
|
@ -294,10 +296,8 @@
|
||||||
"bsp/inc",
|
"bsp/inc",
|
||||||
"LIB/LwUtil",
|
"LIB/LwUtil",
|
||||||
"LIB/perf_counter",
|
"LIB/perf_counter",
|
||||||
"LIB/agile_led",
|
"LIB/AT-Command-master/AT-Command-master/include",
|
||||||
"LIB/FlexibleButton-master",
|
"LIB/agile_led"
|
||||||
"RTOS/components/net/at/inc",
|
|
||||||
"LIB/AT-Command-master/AT-Command-master/include"
|
|
||||||
],
|
],
|
||||||
"libList": [],
|
"libList": [],
|
||||||
"defineList": [
|
"defineList": [
|
||||||
|
@ -314,6 +314,12 @@
|
||||||
"command": "cd .\\MDK && copy \"${OutDir}\\${ProjectName}.axf\" \"Objects\\${ProjectName}.axf\"",
|
"command": "cd .\\MDK && copy \"${OutDir}\\${ProjectName}.axf\" \"Objects\\${ProjectName}.axf\"",
|
||||||
"disable": false,
|
"disable": false,
|
||||||
"abortAfterFailed": true
|
"abortAfterFailed": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "\"D:\\SXDT\\Official_information\\HDDZ\\demo\\CIU32_L051_PROJECT\\USART1_Interrupt - RT-Thread\\keil5_disp_size_bar\\keil5_disp_size_bar.exe\"",
|
||||||
|
"command": "cd .\\MDK && \"D:\\SXDT\\Official_information\\HDDZ\\demo\\CIU32_L051_PROJECT\\USART1_Interrupt - RT-Thread\\keil5_disp_size_bar\\keil5_disp_size_bar.exe\"",
|
||||||
|
"disable": false,
|
||||||
|
"abortAfterFailed": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"global": {
|
"global": {
|
||||||
|
@ -339,23 +345,15 @@
|
||||||
"AC6": {
|
"AC6": {
|
||||||
"version": 3,
|
"version": 3,
|
||||||
"beforeBuildTasks": [],
|
"beforeBuildTasks": [],
|
||||||
"afterBuildTasks": [
|
"afterBuildTasks": [],
|
||||||
{
|
|
||||||
"name": "\"D:\\SXDT\\Official_information\\HDDZ\\demo\\CIU32_L051_PROJECT\\USART1_Interrupt - RT-Thread\\keil5_disp_size_bar\\keil5_disp_size_bar.exe\"",
|
|
||||||
"disable": false,
|
|
||||||
"abortAfterFailed": true,
|
|
||||||
"command": "cd .\\MDK && \"D:\\SXDT\\Official_information\\HDDZ\\demo\\CIU32_L051_PROJECT\\USART1_Interrupt - RT-Thread\\keil5_disp_size_bar\\keil5_disp_size_bar.exe\""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"global": {
|
"global": {
|
||||||
"output-debug-info": "enable"
|
"output-debug-info": "enable"
|
||||||
},
|
},
|
||||||
"c/cpp-compiler": {
|
"c/cpp-compiler": {
|
||||||
"optimization": "level-image-size",
|
"optimization": "level-image-size",
|
||||||
"language-c": "gnu99",
|
"language-c": "c99",
|
||||||
"language-cpp": "gnu++98",
|
"language-cpp": "c++98",
|
||||||
"warnings": "ac5-like-warnings",
|
"warnings": "ac5-like-warnings"
|
||||||
"link-time-optimization": true
|
|
||||||
},
|
},
|
||||||
"asm-compiler": {
|
"asm-compiler": {
|
||||||
"$use": "asm-auto"
|
"$use": "asm-auto"
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
||||||
|
[project_search_path]: ./
|
||||||
|
[map_search_path]: ./
|
||||||
|
[project_file_path]: .//USART1_Interrupt.uvprojx
|
||||||
|
[ map_file_path]: .//Listings/CIU32_L051_M307R.map
|
||||||
|
[parse_keil_map start]:
|
||||||
|
[Found keyword]: ----------Execution Region----------
|
||||||
|
[name]: ER_IROM1
|
||||||
|
[Exec base]: 0x8000000
|
||||||
|
[Size]: 0xd758
|
||||||
|
[Max]: 0x10000
|
||||||
|
[Found keyword]: ----------Execution Region----------
|
||||||
|
[name]: RW_IRAM1
|
||||||
|
[Exec base]: 0x20000000
|
||||||
|
[Size]: 0x2e58
|
||||||
|
[Max]: 0x4000
|
||||||
|
[parse_keil_map over printf bar]:
|
||||||
|
RW_IRAM1 :0x20000000
|
||||||
|
16.00 KB :|¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö______| 72.41 % ( 11.59 KB / 16.00 KB) [4520 B]
|
||||||
|
ER_IROM1 :0x8000000
|
||||||
|
64.00 KB :|¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö¡ö____| 84.12 % ( 53.84 KB / 64.00 KB) [10408 B]
|
||||||
|
[export csv]: ./_sort_by_flash.csv
|
||||||
|
[export csv]: ./_sort_by_ram.csv
|
||||||
|
[export xlsx]: _analysis.xlsx
|
Binary file not shown.
|
@ -0,0 +1,106 @@
|
||||||
|
File_name,flash percent,flash,ram,Code,RO_data,RW_data,ZI_data
|
||||||
|
mc_p.l,9.801146%,6161,4,6024,133,4,0
|
||||||
|
cmd.o,7.115813%,4473,0,2872,1601,0,0
|
||||||
|
bsp_flash.o,5.674515%,3567,4,2660,907,0,4
|
||||||
|
ipc.o,5.049316%,3174,0,2160,1014,0,0
|
||||||
|
at_chat.o,4.877506%,3066,8,3050,16,0,8
|
||||||
|
printfa.o,3.643016%,2290,0,2290,0,0,0
|
||||||
|
thread.o,3.426662%,2154,12,1912,242,0,12
|
||||||
|
ulog.o,3.412345%,2145,333,1934,211,0,333
|
||||||
|
kservice.o,3.363029%,2114,140,1858,256,0,140
|
||||||
|
drv_uart.o,3.281896%,2063,1508,2046,17,0,1508
|
||||||
|
main.o,3.132358%,1969,1036,1764,205,0,1036
|
||||||
|
mem.o,2.990773%,1880,72,1512,368,0,72
|
||||||
|
shell.o,2.861915%,1799,153,1768,31,0,153
|
||||||
|
agile_led.o,2.418072%,1520,708,1320,200,0,708
|
||||||
|
mf_p.l,2.370347%,1490,0,1490,0,0,0
|
||||||
|
bsp_history.o,2.123767%,1335,1180,1256,79,0,1180
|
||||||
|
timer.o,1.840598%,1157,20,1002,155,0,20
|
||||||
|
object.o,1.697423%,1067,148,832,107,128,20
|
||||||
|
drv_gpio.o,1.660834%,1044,0,244,800,0,0
|
||||||
|
bsp_button.o,1.646516%,1035,684,644,391,0,684
|
||||||
|
device.o,1.562202%,982,0,670,312,0,0
|
||||||
|
msh.o,1.503341%,945,0,784,161,0,0
|
||||||
|
bsp_sensor.o,1.430162%,899,1256,882,17,0,1256
|
||||||
|
scanf_fp.o,1.428571%,898,0,898,0,0,0
|
||||||
|
_scanf.o,1.310850%,824,0,824,0,0,0
|
||||||
|
bsp_adc.o,1.310850%,824,748,812,12,0,748
|
||||||
|
bsp_rtc.o,1.111995%,699,6,600,99,0,6
|
||||||
|
completion.o,1.049952%,660,0,572,88,0,0
|
||||||
|
lwrb.o,1.008590%,634,0,634,0,0,0
|
||||||
|
bsp_net.o,0.992682%,624,1268,424,200,0,1268
|
||||||
|
flexible_button.o,0.859052%,540,16,540,0,0,16
|
||||||
|
scheduler.o,0.817690%,514,280,496,18,0,280
|
||||||
|
dev_pin.o,0.773147%,486,76,448,38,0,76
|
||||||
|
dadd.o,0.566338%,356,0,356,0,0,0
|
||||||
|
ciu32l051_std_lpuart.o,0.528158%,332,0,332,0,0,0
|
||||||
|
_scanf_int.o,0.524976%,330,0,330,0,0,0
|
||||||
|
cpuport.o,0.489978%,308,12,308,0,0,12
|
||||||
|
board.o,0.442253%,278,0,278,0,0,0
|
||||||
|
idle.o,0.429526%,270,416,248,22,0,416
|
||||||
|
components.o,0.388164%,244,0,228,16,0,0
|
||||||
|
ddiv.o,0.381801%,240,0,240,0,0,0
|
||||||
|
depilogue.o,0.375437%,236,0,236,0,0,0
|
||||||
|
ciu32l051_std_rtc.o,0.375437%,236,0,236,0,0,0
|
||||||
|
_scanf_str.o,0.369074%,232,0,232,0,0,0
|
||||||
|
bsp_wdg.o,0.369074%,232,656,220,12,0,656
|
||||||
|
startup_ciu32l051.o,0.349984%,220,1024,28,192,0,1024
|
||||||
|
context_rvds.o,0.343621%,216,0,216,0,0,0
|
||||||
|
ciu32l051_std_rcc.o,0.343621%,216,0,216,0,0,0
|
||||||
|
dmul.o,0.330894%,208,0,208,0,0,0
|
||||||
|
drv_common.o,0.324531%,204,0,204,0,0,0
|
||||||
|
system_ciu32l051.o,0.318167%,200,4,164,32,4,0
|
||||||
|
ciu32l051_std_flash.o,0.299077%,188,0,188,0,0,0
|
||||||
|
ciu32l051_std_usart.o,0.295896%,186,0,186,0,0,0
|
||||||
|
strtod.o,0.286351%,180,0,180,0,0,0
|
||||||
|
_strtoul.o,0.264079%,166,0,166,0,0,0
|
||||||
|
ciu32l051_std_gpio.o,0.244989%,154,0,154,0,0,0
|
||||||
|
ciu32l051_std_adc.o,0.235444%,148,0,148,0,0,0
|
||||||
|
ctype_o.o,0.224308%,141,0,8,133,0,0
|
||||||
|
fepilogue.o,0.206809%,130,0,130,0,0,0
|
||||||
|
strtol.o,0.178174%,112,0,112,0,0,0
|
||||||
|
ciu32l051_std_dma.o,0.159084%,100,0,100,0,0,0
|
||||||
|
uldiv.o,0.152720%,96,0,96,0,0,0
|
||||||
|
console_be.o,0.143175%,90,48,86,4,0,48
|
||||||
|
bsp_io_dev.o,0.141584%,89,16,76,13,0,16
|
||||||
|
irq.o,0.139994%,88,12,88,0,0,12
|
||||||
|
_sgetc.o,0.108177%,68,0,68,0,0,0
|
||||||
|
dfixul.o,0.101814%,64,0,64,0,0,0
|
||||||
|
uidiv_div0.o,0.098632%,62,0,62,0,0,0
|
||||||
|
__0sscanf.o,0.095450%,60,0,60,0,0,0
|
||||||
|
d2f.o,0.089087%,56,0,56,0,0,0
|
||||||
|
clock.o,0.085905%,54,4,54,0,0,4
|
||||||
|
llmul.o,0.076360%,48,0,48,0,0,0
|
||||||
|
init.o,0.076360%,48,0,48,0,0,0
|
||||||
|
m_ps.l,0.069997%,44,0,44,0,0,0
|
||||||
|
dcmplt.o,0.069997%,44,0,44,0,0,0
|
||||||
|
dcmple.o,0.069997%,44,0,44,0,0,0
|
||||||
|
dcmpge.o,0.069997%,44,0,44,0,0,0
|
||||||
|
scanf_char.o,0.069997%,44,0,44,0,0,0
|
||||||
|
atof.o,0.069997%,44,0,44,0,0,0
|
||||||
|
cdrcmple.o,0.063633%,40,0,40,0,0,0
|
||||||
|
strstr.o,0.063633%,40,0,40,0,0,0
|
||||||
|
strcasecmp.o,0.060452%,38,0,38,0,0,0
|
||||||
|
llsshr.o,0.060452%,38,0,38,0,0,0
|
||||||
|
memseta.o,0.057270%,36,0,36,0,0,0
|
||||||
|
memcpya.o,0.057270%,36,0,36,0,0,0
|
||||||
|
errno.o,0.057270%,36,4,32,0,4,0
|
||||||
|
llushr.o,0.054088%,34,0,34,0,0,0
|
||||||
|
llshl.o,0.050907%,32,0,32,0,0,0
|
||||||
|
strncmp.o,0.047725%,30,0,30,0,0,0
|
||||||
|
handlers.o,0.047725%,30,0,30,0,0,0
|
||||||
|
_chval.o,0.047725%,30,0,30,0,0,0
|
||||||
|
dfltul.o,0.044543%,28,0,28,0,0,0
|
||||||
|
strncpy.o,0.041362%,26,0,26,0,0,0
|
||||||
|
memcmp.o,0.041362%,26,0,26,0,0,0
|
||||||
|
atoi.o,0.041362%,26,0,26,0,0,0
|
||||||
|
ciu32l051_std.o,0.038180%,24,0,24,0,0,0
|
||||||
|
at_port.o,0.038180%,24,0,24,0,0,0
|
||||||
|
strchr.o,0.031817%,20,0,20,0,0,0
|
||||||
|
memchr.o,0.031817%,20,0,20,0,0,0
|
||||||
|
isspace_o.o,0.028635%,18,0,18,0,0,0
|
||||||
|
strlen.o,0.022272%,14,0,14,0,0,0
|
||||||
|
tolower.o,0.019090%,12,0,12,0,0,0
|
||||||
|
entry9a.o,0.012727%,8,0,8,0,0,0
|
||||||
|
entry2.o,0.012727%,8,0,8,0,0,0
|
||||||
|
entry5.o,0.006363%,4,0,4,0,0,0
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
File_name,ram_percent,ram,flash,Code,RO_data,RW_data,ZI_data
|
||||||
|
drv_uart.o,12.719298%,1508,2063,2046,17,0,1508
|
||||||
|
bsp_net.o,10.695006%,1268,624,424,200,0,1268
|
||||||
|
bsp_sensor.o,10.593792%,1256,899,882,17,0,1256
|
||||||
|
bsp_history.o,9.952766%,1180,1335,1256,79,0,1180
|
||||||
|
main.o,8.738192%,1036,1969,1764,205,0,1036
|
||||||
|
startup_ciu32l051.o,8.636977%,1024,220,28,192,0,1024
|
||||||
|
bsp_adc.o,6.309042%,748,824,812,12,0,748
|
||||||
|
agile_led.o,5.971660%,708,1520,1320,200,0,708
|
||||||
|
bsp_button.o,5.769231%,684,1035,644,391,0,684
|
||||||
|
bsp_wdg.o,5.533063%,656,232,220,12,0,656
|
||||||
|
idle.o,3.508772%,416,270,248,22,0,416
|
||||||
|
ulog.o,2.808704%,333,2145,1934,211,0,333
|
||||||
|
scheduler.o,2.361673%,280,514,496,18,0,280
|
||||||
|
shell.o,1.290486%,153,1799,1768,31,0,153
|
||||||
|
object.o,1.248313%,148,1067,832,107,128,20
|
||||||
|
kservice.o,1.180837%,140,2114,1858,256,0,140
|
||||||
|
dev_pin.o,0.641026%,76,486,448,38,0,76
|
||||||
|
mem.o,0.607287%,72,1880,1512,368,0,72
|
||||||
|
console_be.o,0.404858%,48,90,86,4,0,48
|
||||||
|
timer.o,0.168691%,20,1157,1002,155,0,20
|
||||||
|
flexible_button.o,0.134953%,16,540,540,0,0,16
|
||||||
|
bsp_io_dev.o,0.134953%,16,89,76,13,0,16
|
||||||
|
thread.o,0.101215%,12,2154,1912,242,0,12
|
||||||
|
irq.o,0.101215%,12,88,88,0,0,12
|
||||||
|
cpuport.o,0.101215%,12,308,308,0,0,12
|
||||||
|
at_chat.o,0.067476%,8,3066,3050,16,0,8
|
||||||
|
bsp_rtc.o,0.050607%,6,699,600,99,0,6
|
||||||
|
mc_p.l,0.033738%,4,6161,6024,133,4,0
|
||||||
|
errno.o,0.033738%,4,36,32,0,4,0
|
||||||
|
system_ciu32l051.o,0.033738%,4,200,164,32,4,0
|
||||||
|
clock.o,0.033738%,4,54,54,0,0,4
|
||||||
|
bsp_flash.o,0.033738%,4,3567,2660,907,0,4
|
|
|
@ -27,8 +27,11 @@
|
||||||
"C_Cpp.default.configurationProvider": "cl.eide",
|
"C_Cpp.default.configurationProvider": "cl.eide",
|
||||||
"C_Cpp.errorSquiggles": "disabled",
|
"C_Cpp.errorSquiggles": "disabled",
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
|
<<<<<<< HEAD
|
||||||
"*.sqlbook": "sql",
|
"*.sqlbook": "sql",
|
||||||
"*.ndjson": "jsonl",
|
"*.ndjson": "jsonl",
|
||||||
|
=======
|
||||||
|
>>>>>>> af23917bf5ba0569ed83f15f9ceba4b80cab6f1c
|
||||||
"*.dbclient-js": "javascript",
|
"*.dbclient-js": "javascript",
|
||||||
".eideignore": "ignore",
|
".eideignore": "ignore",
|
||||||
"*.a51": "a51",
|
"*.a51": "a51",
|
||||||
|
@ -40,10 +43,25 @@
|
||||||
"*.cpp": "cpp",
|
"*.cpp": "cpp",
|
||||||
"*.cxx": "cpp",
|
"*.cxx": "cpp",
|
||||||
"*.cc": "cpp",
|
"*.cc": "cpp",
|
||||||
|
<<<<<<< HEAD
|
||||||
"cstddef": "c",
|
"cstddef": "c",
|
||||||
"limits": "c",
|
"limits": "c",
|
||||||
"initializer_list": "c",
|
"initializer_list": "c",
|
||||||
"ratio": "c"
|
"ratio": "c"
|
||||||
|
=======
|
||||||
|
"atomic": "c",
|
||||||
|
"compare": "c",
|
||||||
|
"cstddef": "c",
|
||||||
|
"limits": "c",
|
||||||
|
"type_traits": "c",
|
||||||
|
"xmemory": "c",
|
||||||
|
"xutility": "c",
|
||||||
|
"algorithm": "c",
|
||||||
|
"utility": "c",
|
||||||
|
"optional": "c",
|
||||||
|
"xtr1common": "c",
|
||||||
|
"initializer_list": "c"
|
||||||
|
>>>>>>> af23917bf5ba0569ed83f15f9ceba4b80cab6f1c
|
||||||
},
|
},
|
||||||
"[yaml]": {
|
"[yaml]": {
|
||||||
"editor.insertSpaces": true,
|
"editor.insertSpaces": true,
|
||||||
|
|
|
@ -1,160 +1,160 @@
|
||||||
#include <bsp_io_dev.h>
|
// #include <bsp_io_dev.h>
|
||||||
#include <rtthread.h>
|
// #include <rtthread.h>
|
||||||
#include "flexible_button.h"
|
// #include "agile_led.h"
|
||||||
#include "drv_gpio.h"
|
// #include "drv_gpio.h"
|
||||||
#include "main.h"
|
// #include "main.h"
|
||||||
|
|
||||||
#define LOG_TAG "bsp_button"
|
// #define LOG_TAG "bsp_button"
|
||||||
#define LOG_LVL LOG_LVL_DBG
|
// #define LOG_LVL LOG_LVL_DBG
|
||||||
#include <ulog.h>
|
// #include <ulog.h>
|
||||||
|
|
||||||
#define BUTTON_LOGIC_LEVEL 0
|
// #define BUTTON_LOGIC_LEVEL 0
|
||||||
#define BUTTON_THREAD_PRIORITY 5 // 优先级拉高,这时按键响应快点
|
// #define BUTTON_THREAD_PRIORITY 5 // 优先级拉高,这时按键响应快点
|
||||||
#define BUTTON_THREAD_TICKS 10
|
// #define BUTTON_THREAD_TICKS 10
|
||||||
#define BUTTON_THREAD_STACK_SIZE 512 /**< button_thread 线程堆栈大小 */
|
// #define BUTTON_THREAD_STACK_SIZE 512 /**< button_thread 线程堆栈大小 */
|
||||||
static rt_uint8_t button_thread_stack[BUTTON_THREAD_STACK_SIZE]; /**< button_thread 线程堆栈 */
|
// static rt_uint8_t button_thread_stack[BUTTON_THREAD_STACK_SIZE]; /**< button_thread 线程堆栈 */
|
||||||
static struct rt_thread button_0;
|
// static struct rt_thread button_0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define ENUM_TO_STR(e) (#e)
|
// #define ENUM_TO_STR(e) (#e)
|
||||||
|
|
||||||
typedef enum
|
// typedef enum
|
||||||
{
|
// {
|
||||||
USER_BUTTON_0 = 0,
|
// USER_BUTTON_0 = 0,
|
||||||
USER_BUTTON_MAX
|
// USER_BUTTON_MAX
|
||||||
} user_button_t;
|
// } user_button_t;
|
||||||
|
|
||||||
static char *enum_event_string[] = {
|
// static char *enum_event_string[] = {
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_DOWN),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_DOWN),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_CLICK),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_CLICK),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_DOUBLE_CLICK),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_DOUBLE_CLICK),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_REPEAT_CLICK),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_REPEAT_CLICK),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_SHORT_START),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_SHORT_START),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_SHORT_UP),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_SHORT_UP),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_LONG_START),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_LONG_START),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_LONG_UP),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_LONG_UP),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_LONG_HOLD),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_LONG_HOLD),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_LONG_HOLD_UP),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_LONG_HOLD_UP),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_MAX),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_MAX),
|
||||||
ENUM_TO_STR(FLEX_BTN_PRESS_NONE),
|
// ENUM_TO_STR(FLEX_BTN_PRESS_NONE),
|
||||||
};
|
// };
|
||||||
|
|
||||||
static char *enum_btn_id_string[] = {
|
// static char *enum_btn_id_string[] = {
|
||||||
ENUM_TO_STR(USER_BUTTON_0),
|
// ENUM_TO_STR(USER_BUTTON_0),
|
||||||
ENUM_TO_STR(USER_BUTTON_MAX),
|
// ENUM_TO_STR(USER_BUTTON_MAX),
|
||||||
};
|
// };
|
||||||
|
|
||||||
static flex_button_t user_button[USER_BUTTON_MAX];
|
// static flex_button_t user_button[USER_BUTTON_MAX];
|
||||||
|
|
||||||
static uint8_t common_btn_read(void *arg)
|
// static uint8_t common_btn_read(void *arg)
|
||||||
{
|
// {
|
||||||
uint8_t value = 0;
|
// uint8_t value = 0;
|
||||||
|
|
||||||
flex_button_t *btn = (flex_button_t *)arg;
|
// flex_button_t *btn = (flex_button_t *)arg;
|
||||||
|
|
||||||
switch (btn->id)
|
// switch (btn->id)
|
||||||
{
|
// {
|
||||||
case USER_BUTTON_0:
|
// case USER_BUTTON_0:
|
||||||
{
|
// {
|
||||||
return rt_pin_read(BUTTON_0);
|
// return rt_pin_read(BUTTON_0);
|
||||||
}
|
// }
|
||||||
default:
|
// default:
|
||||||
RT_ASSERT(0);
|
// RT_ASSERT(0);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return value;
|
// return value;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*事件回调*/
|
// /*事件回调*/
|
||||||
static void common_btn_evt_cb(void *arg)
|
// static void common_btn_evt_cb(void *arg)
|
||||||
{
|
// {
|
||||||
flex_button_t *btn = (flex_button_t *)arg;
|
// flex_button_t *btn = (flex_button_t *)arg;
|
||||||
|
|
||||||
LOG_D("id: [%d - %s] event: [%d - %30s] repeat: %d\n",
|
// LOG_D("id: [%d - %s] event: [%d - %30s] repeat: %d\n",
|
||||||
btn->id, enum_btn_id_string[btn->id], btn->event,
|
// btn->id, enum_btn_id_string[btn->id], btn->event,
|
||||||
enum_event_string[btn->event], btn->click_cnt);
|
// enum_event_string[btn->event], btn->click_cnt);
|
||||||
|
|
||||||
// 也可以使用组合键
|
// // 也可以使用组合键
|
||||||
if (flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_CLICK) // 单击
|
// if (flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_CLICK) // 单击
|
||||||
{
|
// {
|
||||||
LOG_I("FLEX_BTN_PRESS_CLICK\n");
|
// LOG_I("FLEX_BTN_PRESS_CLICK\n");
|
||||||
Send_Laser_Alarm_Event(kSelfInspectionEvents);
|
// Send_Laser_Alarm_Event(kSelfInspectionEvents);
|
||||||
}
|
// }
|
||||||
if (flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_DOUBLE_CLICK) // 双击
|
// if (flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_DOUBLE_CLICK) // 双击
|
||||||
{
|
// {
|
||||||
LOG_I("FLEX_BTN_PRESS_DOUBLE_CLICK\n");
|
// LOG_I("FLEX_BTN_PRESS_DOUBLE_CLICK\n");
|
||||||
|
|
||||||
// Send_Laser_Alarm_Event(kFlexBtnPressDoubleClick);
|
// // Send_Laser_Alarm_Event(kFlexBtnPressDoubleClick);
|
||||||
}
|
// }
|
||||||
if (flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_SHORT_START) // 短按开始
|
// if (flex_button_event_read(&user_button[USER_BUTTON_0]) == FLEX_BTN_PRESS_SHORT_START) // 短按开始
|
||||||
{
|
// {
|
||||||
|
|
||||||
LOG_I("FLEX_BTN_PRESS_SHORT_START\n");
|
// LOG_I("FLEX_BTN_PRESS_SHORT_START\n");
|
||||||
// Send_Laser_Alarm_Event(kFlexBtnPressShoartStart);
|
// // Send_Laser_Alarm_Event(kFlexBtnPressShoartStart);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
static void BSP_Button_Thread_Entry(void *parameter)
|
// static void BSP_Button_Thread_Entry(void *parameter)
|
||||||
{
|
// {
|
||||||
log_i("button_scan_thread\r\n");
|
// log_i("button_scan_thread\r\n");
|
||||||
while (1)
|
// while (1)
|
||||||
{
|
// {
|
||||||
flex_button_scan();
|
// flex_button_scan();
|
||||||
rt_thread_mdelay(20); // 20 ms
|
// rt_thread_mdelay(20); // 20 ms
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
static void _Button_Init(void)
|
// static void _Button_Init(void)
|
||||||
{
|
// {
|
||||||
int i;
|
// int i;
|
||||||
|
|
||||||
rt_memset(&user_button[0], 0x0, sizeof(user_button));
|
// rt_memset(&user_button[0], 0x0, sizeof(user_button));
|
||||||
|
|
||||||
rt_pin_mode(BUTTON_0, PIN_MODE_INPUT_PULLUP); /* set KEY pin mode to input */
|
// rt_pin_mode(BUTTON_0, PIN_MODE_INPUT_PULLUP); /* set KEY pin mode to input */
|
||||||
|
|
||||||
for (i = 0; i < USER_BUTTON_MAX; i++)
|
// for (i = 0; i < USER_BUTTON_MAX; i++)
|
||||||
{
|
// {
|
||||||
user_button[i].id = i;
|
// user_button[i].id = i;
|
||||||
user_button[i].usr_button_read = common_btn_read;
|
// user_button[i].usr_button_read = common_btn_read;
|
||||||
user_button[i].cb = common_btn_evt_cb;
|
// user_button[i].cb = common_btn_evt_cb;
|
||||||
user_button[i].pressed_logic_level = BUTTON_LOGIC_LEVEL;
|
// user_button[i].pressed_logic_level = BUTTON_LOGIC_LEVEL;
|
||||||
user_button[i].short_press_start_tick = FLEX_MS_TO_SCAN_CNT(1500);
|
// user_button[i].short_press_start_tick = FLEX_MS_TO_SCAN_CNT(1500);
|
||||||
user_button[i].long_press_start_tick = FLEX_MS_TO_SCAN_CNT(3000);
|
// user_button[i].long_press_start_tick = FLEX_MS_TO_SCAN_CNT(3000);
|
||||||
user_button[i].long_hold_start_tick = FLEX_MS_TO_SCAN_CNT(4500);
|
// user_button[i].long_hold_start_tick = FLEX_MS_TO_SCAN_CNT(4500);
|
||||||
|
|
||||||
flex_button_register(&user_button[i]);
|
// flex_button_register(&user_button[i]);
|
||||||
}
|
// }
|
||||||
} /**< button_thread 线程控制块 */
|
// } /**< button_thread 线程控制块 */
|
||||||
|
|
||||||
int Flex_Button_Thread(void)
|
// int Flex_Button_Thread(void)
|
||||||
{
|
// {
|
||||||
|
|
||||||
LOG_I("button_thread start");
|
// LOG_I("button_thread start");
|
||||||
rt_err_t ret = RT_ERROR;
|
// rt_err_t ret = RT_ERROR;
|
||||||
_Button_Init();
|
// _Button_Init();
|
||||||
|
|
||||||
ret = rt_thread_init(&button_0,
|
// ret = rt_thread_init(&button_0,
|
||||||
"button_0",
|
// "button_0",
|
||||||
BSP_Button_Thread_Entry,
|
// BSP_Button_Thread_Entry,
|
||||||
RT_NULL,
|
// RT_NULL,
|
||||||
&button_thread_stack[0],
|
// &button_thread_stack[0],
|
||||||
sizeof(button_thread_stack),
|
// sizeof(button_thread_stack),
|
||||||
BUTTON_THREAD_PRIORITY,
|
// BUTTON_THREAD_PRIORITY,
|
||||||
BUTTON_THREAD_TICKS);
|
// BUTTON_THREAD_TICKS);
|
||||||
|
|
||||||
if (ret == RT_EOK)
|
// if (ret == RT_EOK)
|
||||||
{
|
// {
|
||||||
LOG_D("button thread init success");
|
// LOG_D("button thread init success");
|
||||||
rt_thread_startup(&button_0);
|
// rt_thread_startup(&button_0);
|
||||||
return RT_EOK;
|
// return RT_EOK;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
LOG_E("button_thread create failed...\r\n");
|
// LOG_E("button_thread create failed...\r\n");
|
||||||
return RT_ERROR;
|
// return RT_ERROR;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
INIT_DEVICE_EXPORT(Flex_Button_Thread);
|
// INIT_DEVICE_EXPORT(Flex_Button_Thread);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,13 @@
|
||||||
* @Author: mbw
|
* @Author: mbw
|
||||||
* @Date: 2024-09-18 15:32:35
|
* @Date: 2024-09-18 15:32:35
|
||||||
* @LastEditors: mbw && 1600520629@qq.com
|
* @LastEditors: mbw && 1600520629@qq.com
|
||||||
|
<<<<<<< HEAD
|
||||||
* @LastEditTime: 2024-09-20 15:17:40
|
* @LastEditTime: 2024-09-20 15:17:40
|
||||||
* @FilePath: \USART1_Interrupt - RT-Thread\bsp\src\bsp_net.c
|
* @FilePath: \USART1_Interrupt - RT-Thread\bsp\src\bsp_net.c
|
||||||
|
=======
|
||||||
|
* @LastEditTime: 2025-06-06 13:44:40
|
||||||
|
* @FilePath: \ciu32_-l051_-m307-r\bsp\src\bsp_net.c
|
||||||
|
>>>>>>> af23917bf5ba0569ed83f15f9ceba4b80cab6f1c
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
* Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
* Copyright (c) 2024 by ${git_name_email}, All Rights Reserved.
|
||||||
|
|
Loading…
Reference in New Issue