This repository has been archived on 2025-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
SP713_Upper_C/libs/SpiApi.h
2025-07-17 17:54:51 +08:00

47 lines
909 B
C++
Executable File
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.

#pragma once
#include <memory>
#include <string>
#include <vector>
#include "Common.h"
#ifdef SPI_API_LIB
#define SPI_API __declspec(dllexport)
#else
#define SPI_API __declspec(dllimport)
#endif
class SpiHandler;
class SPI_API SpiApi {
public:
SpiApi();
~SpiApi();
/**
* @breaf 初始化所有CH347并返回列表
*
* @return 已知的CH347设备列表
*/
std::vector<DevSimple> initUsbDevice();
/**
* @breaf 向设备下发参数
*
* @param devs 指定接收参数的设备
* @param cmdarg 控制字参数具体定义见Common.h
* @param varg 电压参数具体定义见Common.h
*
* @return 成功返回true
*/
bool applyArg(DevSimple devs, SetCommandArg cmdarg, SetVotegeArg varg);
/**
* @breaf 设为true可以在exe的工作目录的debug.log中输出打包后要下发的十六进制参数
*/
void debug(bool on = true);
private:
std::shared_ptr<SpiHandler> sh_;
std::string lastError_;
};