重新构建的批检仪主板程序
This commit is contained in:
@@ -3,23 +3,45 @@
|
||||
|
||||
#include <QObject>
|
||||
#include "base/base.h"
|
||||
#include "interface/codec.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
||||
typedef std::function<void(void)> irq_cb;
|
||||
typedef std::function<void(myarray data)> irq_cb;
|
||||
|
||||
class InterFace : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
InterFace() {}
|
||||
InterFace() {irq_fun=nullptr;}
|
||||
virtual ~InterFace() {}
|
||||
virtual void init() = 0;
|
||||
virtual int write(myarray data) = 0;
|
||||
virtual void set_irq(irq_cb fun, myarray &data) = 0;
|
||||
virtual void set_irq(irq_cb fun){
|
||||
this->irq_fun=fun;
|
||||
}
|
||||
protected:
|
||||
irq_cb irq_fun;
|
||||
};
|
||||
|
||||
InterFace *interFaceFind(const char *name);
|
||||
|
||||
|
||||
typedef struct{
|
||||
const char *name;
|
||||
InterFace *(*if_get_fun)();
|
||||
}if_def;
|
||||
|
||||
|
||||
#define if_export(name_,fun_) \
|
||||
const static char __if_##name_##_name[] __attribute__((section(".rodata.ifstr"))) = #name_; \
|
||||
__attribute__((used)) static if_def _if_##name_ __attribute__((section("ifdef")))={\
|
||||
.name=__if_##name_##_name,\
|
||||
.if_get_fun=fun_,\
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // INTERFACE_H
|
||||
|
Reference in New Issue
Block a user