我想在我的Qt应用程序中使用此代码:
#ifndef AS_I2C__HPP__
#define AS_I2C__HPP__
#include <cstring>
#include "as_i2c.h"
class AsI2c
{
public:
AsI2c(int aBusNumber);
virtual ~AsI2c();
long setSlaveAddr(unsigned char aAddr);
long getSlaveAddr() const;
long read(unsigned char *aData, size_t aSize) const;
long write(unsigned char *aData, size_t aSize);
long readReg(unsigned char aReg, unsigned char *aData, size_t aSize) const;
long writeReg(unsigned char aReg, unsigned char *aData, size_t aSize);
long readMsg(unsigned char *aWData, unsigned char aWriteSize, unsigned char *aRData, size_t aReadSize);
long readRegByte(unsigned char aReg) const;
long writeRegByte(unsigned char aReg, unsigned char aVal);
protected:
mutable struct as_i2c_device *mDev;
};
#endif // AS_I2C__HPP__
我使用qt-everywhere 4.7进行交叉编译,我该怎么办? (代码是来自低级别c函数的c ++包装器。)
的问候。
答案 0 :(得分:0)
你可以用QChar替换char,Qt应用程序中的QString字符串。您需要包含#include才能使用这些类。
它们是本机C / C ++ char和字符串类的等效类,并允许自动类型转换。当您需要调用低级代码时,您只需键入cast QChar为char,QString为string。