Commit 512de83f authored by Wenxi Xu's avatar Wenxi Xu
Browse files

添加新的调试工具!!!

parent c66f31d8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
# Copyright (c) 2024 ttwards <12411711@mail.sustech.edu.cn>
# SPDX-License-Identifier: Apache-2.0

zephyr_library()

set(PLOTTER_SOURCES
	aresplot_protocol.c
	aresplot_uart.c
)

zephyr_library_sources(${PLOTTER_SOURCES})
 No newline at end of file
+630 −0

File added.

Preview size limit exceeded, changes collapsed.

+150 −0

File added.

Preview size limit exceeded, changes collapsed.

+221 −0

File added.

Preview size limit exceeded, changes collapsed.

+47 −0
Original line number Diff line number Diff line
#ifndef ARESPLOT_UART_H
#define ARESPLOT_UART_H

#include "zephyr/kernel/thread.h"
#include <zephyr/kernel.h>
#include <zephyr/drivers/uart.h>

// --- 用户需要实现的硬件/系统相关回调函数 ---
// --- User-implemented hardware/system-specific callback functions ---

struct aresplot_uart_params {
	struct device *uart_dev;
	uint16_t freq;
	struct k_timer timer;
	struct k_thread tid;
};

typedef struct aresplot_uart_params aresplot_uart_t;

/**
 * @brief 发送一个数据包 (通常是一个完整的Aresplot帧) 到通信接口 (例如 UART DMA,
 * USB packet) Sends a data packet (usually a complete Aresplot frame) to the
 * communication interface (e.g., UART DMA, USB packet).
 * @param data 指向要发送数据的指针 Pointer to the data to send.
 * @param length 要发送数据的长度 Length of the data to send.
 * @note 用户需要确保此函数是非阻塞的,或者在RTOS环境中适当地处理阻塞。
 * The user needs to ensure this function is non-blocking or handles blocking
 * appropriately in an RTOS environment. 如果发送操作是异步的
 * (例如DMA),此函数启动传输后即可返回。 If the send operation is asynchronous
 * (e.g., DMA), this function can return after initiating the transfer.
 */
void aresplot_user_send_packet(const uint8_t *data, uint16_t length);

/**
 * @brief 获取当前系统时间戳 (例如,毫秒)
 * Gets the current system timestamp (e.g., in milliseconds).
 * @return 当前时间戳 Current timestamp.
 */
uint32_t aresplot_user_get_tick_ms(void);

void aresplot_uart_init(const struct device *uart_dev, uint16_t freq);

void aresplot_user_critical_enter(void);

void aresplot_user_critical_exit(void);

#endif // ARESPLOT_UART_H
 No newline at end of file