高通CamX驱动设定转换代码
作者:互联网
#include <iostream>
#include <fstream>
using namespace std;
const string sensorNameXML = "s5kgw1_sensor.xml";
const string spaceNum = " ";
const int regDataType = 2;
const int regSetting[]{
0x6028, 0x4000,
0x6214, 0xF9F0,
0x6218, 0xF150,
};
void regSettingToXML(void);
int main(int argc, char const *argv[])
{
regSettingToXML();
cout << "End of Conversion." << endl;
return 0;
}
void regSettingToXML(void)
{
ofstream ofile;
ofile.open(sensorNameXML);
string xmlout;
char str[16]{0};
for(int i = 0; i < sizeof(regSetting)/sizeof(regSetting[0]); i += 2)
{
sprintf(str, "0x%X", regSetting[i]);
xmlout += spaceNum + "<regSetting>\n" + spaceNum + " <registerAddr>" + static_cast<string>(str) + "</registerAddr>\n" + spaceNum;
sprintf(str, "0x%X", regSetting[i+1]);
xmlout += " <registerData>" + static_cast<string>(str) + "</registerData>\n" + spaceNum;
xmlout += " <regAddrType range=\"[1,4]\">2</regAddrType>\n" + spaceNum + " <regDataType range=\"[1,4]\">"
+ to_string(regDataType)
+ "</regDataType>\n" + spaceNum + " <operation>WRITE</operation>\n" + spaceNum
+ " <delayUs>0x00</delayUs>\n" + spaceNum + "</regSetting>\n";
}
ofile << xmlout;
ofile.close();
}
标签:设定,CamX,const,string,int,spaceNum,高通,regSetting,str 来源: https://blog.csdn.net/weixin_44433432/article/details/113827199