重新配置CAN引脚映射并实现基于DMA的数据收发机制,提升通信效率。增加了DMA通道4和5的中断处理函数,用于接收和发送CAN消息。修改了CAN发送函数以支持DMA传输,并去除了原有的轮询等待机制。 feat(ADC): 重新实现ADC与DMA初始化配置 将ADC和DMA的配置迁移至ADC.cpp文件中,完善了DMA循环采样模式配置及ADC多通道扫描功能。删除了initial.cpp中重复的初始化代码,并修正了相关头文件包含。 chore(headers): 清理冗余头文件引用 多个源文件中删除了不必要的标准库和硬件无关头文件引用,减少编译依赖,提高代码清晰度。
25 lines
864 B
C++
25 lines
864 B
C++
#include "adc.h"
|
|
#include <cstdio>
|
|
|
|
constexpr int status_print = 0;
|
|
extern sampler sampler;
|
|
void test_1111() {
|
|
// 初始化CAN回环测试
|
|
// can_loopback_init();
|
|
// can_config();
|
|
if (status_print) {
|
|
/* value print */
|
|
printf(" the temperature data is %2.2f degrees Celsius\r\n",
|
|
sampler.get_mcu_temp());
|
|
printf(" the drv_temperature data is %2.2f degrees Celsius\r\n",
|
|
sampler.get_drv_temp());
|
|
printf(" the U current data is %2.2f mA\r\n", sampler.get_current('U'));
|
|
printf(" the V current data is %2.2f mA\r\n", sampler.get_current('V'));
|
|
printf(" the W current data is %2.2f mA\r\n", sampler.get_current('W'));
|
|
printf(" the VBUS is %2.2f V\r\n", sampler.get_vbus_voltage());
|
|
// printf(" the angle is %2.2f\r\n", tle5012b_read());
|
|
|
|
printf("\n----------------------------------------------------\n");
|
|
}
|
|
// can_loopback_test();
|
|
} |