From a3625c2a87842177deafdbb162e5a74eccd6dc92 Mon Sep 17 00:00:00 2001 From: ranchuan Date: Thu, 12 Oct 2023 11:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=20test=5Finput=20test=5Foutput=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E8=BE=93=E5=87=BA=E9=80=9A=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coder_2channel.uvoptx | 34 ++++++++---- source/ReadMe.txt | 5 ++ source/main/compiler_info.h | 2 +- source/rt_thread/board.c | 2 +- .../libcpu/arm/cortex-m3/context_rvds.S | 2 + source/task/process.c | 54 +++++++++++++++++++ source/task/transmit.c | 2 +- 7 files changed, 89 insertions(+), 12 deletions(-) diff --git a/coder_2channel.uvoptx b/coder_2channel.uvoptx index d0daa00..834cdcc 100644 --- a/coder_2channel.uvoptx +++ b/coder_2channel.uvoptx @@ -117,6 +117,11 @@ Segger\JL2CM3.dll + + 0 + DLGUARM + C + 0 UL2CM3 @@ -127,11 +132,6 @@ JL2CM3 -U69655983 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103RE$Flash\STM32F10x_512.FLM) - - 0 - DLGUARM - d - 0 ARMRTXEVENTFLAGS @@ -159,8 +159,8 @@ 1 - 1 - 0x200018F0 + 0 + 0x2000ac18 0 @@ -168,7 +168,7 @@ 2 0 - src_data + 0x20009ab8 0 @@ -385,6 +385,22 @@ + + 1 + 0 + 186 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\source\rt_thread\libcpu\arm\cortex-m3\context_rvds.S + + +
@@ -971,7 +987,7 @@ rt_thread - 0 + 1 0 0 0 diff --git a/source/ReadMe.txt b/source/ReadMe.txt index 33258f4..761dff0 100644 --- a/source/ReadMe.txt +++ b/source/ReadMe.txt @@ -177,6 +177,11 @@ 心跳数据在收到回复之后也会继续发送 芯片异常时不检测电容 str_is_print_str 函数中,len为0时返回0 +2023.9.26 + 扫描从机从启动后500ms改为启动后2000ms +2023.10.12 + 添加测试命令 test_input test_output 测试输入输出通道 + \ No newline at end of file diff --git a/source/main/compiler_info.h b/source/main/compiler_info.h index c1b5fc1..97f4616 100644 --- a/source/main/compiler_info.h +++ b/source/main/compiler_info.h @@ -6,7 +6,7 @@ -#define BUILD_DATE "2023-09-20 17:48:39" +#define BUILD_DATE "2023-10-12 11:03:25" #define SOFT_VERSION "0.03" diff --git a/source/rt_thread/board.c b/source/rt_thread/board.c index fc81678..1b289eb 100644 --- a/source/rt_thread/board.c +++ b/source/rt_thread/board.c @@ -97,9 +97,9 @@ void *dev_get(const char *name) void param_err_handle(const char *param,const char *file,const char *fun,int line) { - bk_reboot_param_err(); // printf("param=%s,file=%s,fun=%s,line=%d.\r\n",param,file,fun,line); DBG_ERR("param=%s,file=%s,fun=%s,line=%d.\r\n",param,file,fun,line); + bk_reboot_param_err(); while(1); } diff --git a/source/rt_thread/libcpu/arm/cortex-m3/context_rvds.S b/source/rt_thread/libcpu/arm/cortex-m3/context_rvds.S index c6d0d29..7ba6c19 100644 --- a/source/rt_thread/libcpu/arm/cortex-m3/context_rvds.S +++ b/source/rt_thread/libcpu/arm/cortex-m3/context_rvds.S @@ -177,10 +177,12 @@ rt_hw_interrupt_thread_switch PROC ENDP IMPORT rt_hw_hard_fault_exception + IMPORT bk_reboot_hard_err EXPORT HardFault_Handler HardFault_Handler PROC ; get current context + BL bk_reboot_hard_err B . TST lr, #0x04 ; if(!EXC_RETURN[2]) ITE EQ diff --git a/source/task/process.c b/source/task/process.c index e72dba1..f7a768e 100644 --- a/source/task/process.c +++ b/source/task/process.c @@ -11,6 +11,8 @@ #include "process.h" #include "tran_for_coder2ch.h" #include "coder_judge.h" +#include "commend.h" +#include "mystring.h" /* @@ -613,3 +615,55 @@ transmit_export(ym_checker,0x90,process_pccmd) + +// 定义输入输出通道测试 + +static int test_input(list_def *argv) +{ + gpioin_def *in=0; + list_def *states=list_temp(list_creat_int()); + char gpioin_name[]="gpioin0"; + // 这里默认驱动已经打开 + for(int i=0;i<10;i++) + { + gpioin_name[6]='0'+i; + in=dev_get(gpioin_name); + if(in){ + list_append_int(states,in->state(in)); + } + } + cmd_print("input state:%s.",str_temp(list_string(states))); + return 0; +} + +commend_export(test_input,test_input,"print the input state.") + + + + +static int test_output(list_def *argv) +{ + gpioout_def *out=0; + char gpioout_name[]="gpioout0"; + int power=0; + if(list_length(argv)<2){ + cmd_print("param num too less."); + cmd_print("param: on/off."); + return -1; + } + power=(strcmp(list_get_str(argv,1),"on")==0)?1:0; + // 这里默认驱动已经打开 + for(int i=0;iset(out,power); + } + } + return 0; +} + +commend_export(test_output,test_output,"ctrl out state,param: on/off") + + diff --git a/source/task/transmit.c b/source/task/transmit.c index 7f63c19..646145a 100644 --- a/source/task/transmit.c +++ b/source/task/transmit.c @@ -73,7 +73,7 @@ static int tran_init(void) tran_def *tran= tran_creat(t); tran->slave_online=0xfffff; app_variable("tran",tran,0); - later_execute(tran_scan_slave,tran,500); + later_execute(tran_scan_slave,tran,2000); return 0; } app_init_export(tran_init);