Files
E3/app/app_test.c
2025-10-04 16:06:55 +08:00

63 lines
1.6 KiB
C

#include "app_config.h"
#include "app_dependence.h"
#include "interface.h"
#include "app_frm_monitor.h"
#include "app_frm_signal.h"
#include "app_frm_timer.h"
#include "sdrv_vic.h"
#include "app_test.h"
#include "app_differential_drive.h"
// 定时器结构体
Timer test_timer;
// 定时器信号处理函数
void testTimerProcess(void *signal_id)
{
(void)signal_id; // 标记变量为已使用,避免编译器警告
// static uint32_t start_time = 0;
// uint32_t test_irq[6] = {0};
// 再次启动定时器,实现周期定时
timerStart(&test_timer, 5000,1);
// printf("speed = %f ",diff_data.desired_speed);
// printf("curvature = %f ",diff_data.desired_curvature);
// printf("mode = %d\n",diff_data.mode);
//
// sdrv_vic_lld_read_all(test_irq);//打印所有中断使能位
// printf("irq state = %#X ",test_irq[0]);
// printf("irq state = %#X ",test_irq[1]);
// printf("irq state = %#X ",test_irq[2]);
// printf("irq state = %#X ",test_irq[3]);
// printf("irq state = %#X ",test_irq[4]);
// printf("irq state = %#X\n",test_irq[5]);
// printf("testAPP: %d us \n",getCurrentTime() - start_time);
// start_time = getCurrentTime();
}
// APP模块的初始化
void testAppInit(void)
{
// 初始化定时器
timerInit(&test_timer);
// 订阅定时器信号,用于停止电机
subscribe(&test_timer, testTimerProcess);
printf("testAPP: initial OK %d\n",getCurrentTime());
timerStart(&test_timer, 5000,1);
}