Files
STC32G_Power_Monitor/Header/vofa_client.h
2025-09-09 20:10:31 +08:00

92 lines
3.0 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __VOFA_CLIENT_H__
#define __VOFA_CLIENT_H__
#include "common.h"
#define VOFA_CLIENT_COM_INTERFACE (1) // 0:串口 1:USB-CDC 2:自定义
#define VOFA_RECEIVE_CH (32) // 接收通道数,最大256个通道
#define VOFA_SEND_CH (32) // 发送通道数
#if VOFA_CLIENT_COM_INTERFACE == 0
#include "uart.h"
#define VOFA_CLIENT_UART_PORT UART_1 // 串口号
#define VOFA_CLIENT_UART_BAUDRATE 115200 // 波特率
#define VOFA_CLIENT_UART_RX UART1_RX_P30 // 串口接收引脚
#define VOFA_CLIENT_UART_TX UART1_TX_P31 // 串口发送引脚
#define VOFA_CLIENT_UART_TIM TIM_0 // 串口定时器
#elif VOFA_CLIENT_COM_INTERFACE == 1
#include "stc32_stc8_usb.h"
#elif VOFA_CLIENT_COM_INTERFACE == 2
// 填写自定义接口的相关信息
#endif
typedef union
{
uint8 send[4];
float fdata;
}float_data;
extern float vofa_data[VOFA_RECEIVE_CH]; // 记录接收数据
extern uint8 vofa_receive_new_data[VOFA_RECEIVE_CH]; // 接收新数据标志位,需手动置零
extern float vofa_last_data; // 最后一次接收数据
extern uint8 vofa_last_ch; // 最后一次接收通道
extern uint8 rev_count;
typedef enum{
Format_Invalid,
Format_Mono,
Format_MonoLSB,
Format_Indexed8,
Format_RGB32,
Format_ARGB32,
Format_ARGB32_Premultiplied,
Format_RGB16,
Format_ARGB8565_Premultiplied,
Format_RGB666,
Format_ARGB6666_Premultiplied,
Format_RGB555,
Format_ARGB8555_Premultiplied,
Format_RGB888,
Format_RGB444,
Format_ARGB4444_Premultiplied,
Format_RGBX8888,
Format_RGBA8888,
Format_RGBA8888_Premultiplied,
Format_BGR30,
Format_A2BGR30_Premultiplied,
Format_RGB30,
Format_A2RGB30_Premultiplied,
Format_Alpha8,
Format_Grayscale8,
// 以下格式发送时IMG_WIDTH和IMG_HEIGHT不需要强制指定设置为-1即可
Format_BMP,
Format_GIF,
Format_JPG,
Format_PNG,
Format_PBM,
Format_PGM,
Format_PPM,
Format_XBM,
Format_XPM,
Format_SVG,
} ImgFormat ;
void VOFA_Data_Init(void);
uint8 VOFA_Connection_Init(void);
uint8 VOFA_Client_Init(void); // VOFA客户端初始化函数
void VOFA_Set_JustFloat_Data(int CH, float dataa); // 设置某通道数据
void VOFA_Set_JustFloat_Datas_From_Start(int num,...); // 设置从第一个通道开始的多个通道数据
void VOFA_Send_Datas(int num); // 从第一个通道开始发送数据指定数量的数据
void VOFA_Send_JustFloat_Image(uint32 IMG_ID, uint32 IMG_WIDTH, uint32 IMG_HEIGHT,uint32 IMG_DATA_SIZE, ImgFormat IMG_FORMAT,uint8* IMG_DATA); // 发送图像数据
void VOFA_Receiver_Callback(void); // 接收回调函数,需要在主循环或者接受中断中调用
#endif