添加测试命令 test_input test_output 测试输入输出通道

This commit is contained in:
ranchuan
2023-10-12 11:17:07 +08:00
parent bf440a35bc
commit a3625c2a87
7 changed files with 89 additions and 12 deletions

View File

@@ -177,6 +177,11 @@
心跳数据在收到回复之后也会继续发送
芯片异常时不检测电容
str_is_print_str 函数中len为0时返回0
2023.9.26
扫描从机从启动后500ms改为启动后2000ms
2023.10.12
添加测试命令 test_input test_output 测试输入输出通道

View File

@@ -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"

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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;i<OUTPUT_CHANNEL_NUM;i++)
{
gpioout_name[7]='0'+i;
out=dev_get(gpioout_name);
if(out){
out->set(out,power);
}
}
return 0;
}
commend_export(test_output,test_output,"ctrl out state,param: on/off")

View File

@@ -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);