mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
Add changes getting values for upm parameters
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
cb27acbc04
commit
a8cd0f72ec
@ -90,15 +90,15 @@ ADC121C021::ADC121C021(std::string initStr) : mraaIo(initStr)
|
||||
m_vref = std::stof(tok.substr(5));
|
||||
}
|
||||
if(tok.substr(0, 10) == "writeByte:") {
|
||||
uint8_t reg = std::stoi(tok.substr(10), &sz, 0);
|
||||
uint8_t reg = std::stoul(tok.substr(10), &sz, 0);
|
||||
tok = tok.substr(10);
|
||||
uint8_t byte = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint8_t byte = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
writeByte(reg, byte);
|
||||
}
|
||||
if(tok.substr(0,10) == "writeWord:") {
|
||||
uint8_t reg = std::stoi(tok.substr(10), &sz, 0);
|
||||
uint8_t reg = std::stoul(tok.substr(10), &sz, 0);
|
||||
tok = tok.substr(10);
|
||||
uint16_t word = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint16_t word = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
writeWord(reg, word);
|
||||
}
|
||||
if(tok.substr(0,16) == "enableAlertFlag:") {
|
||||
@ -118,15 +118,15 @@ ADC121C021::ADC121C021(std::string initStr) : mraaIo(initStr)
|
||||
enableAlertPinPolarityHigh(enable);
|
||||
}
|
||||
if(tok.substr(0,17) == "setAlertLowLimit:") {
|
||||
uint16_t limit = std::stoi(tok.substr(17), nullptr, 0);
|
||||
uint16_t limit = std::stoul(tok.substr(17), nullptr, 0);
|
||||
setAlertLowLimit(limit);
|
||||
}
|
||||
if(tok.substr(0,18) == "setAlertHighLimit:") {
|
||||
uint16_t limit = std::stoi(tok.substr(18), nullptr, 0);
|
||||
uint16_t limit = std::stoul(tok.substr(18), nullptr, 0);
|
||||
setAlertHighLimit(limit);
|
||||
}
|
||||
if(tok.substr(0,14) == "setHysteresis:") {
|
||||
uint16_t limit = std::stoi(tok.substr(14), nullptr, 0);
|
||||
uint16_t limit = std::stoul(tok.substr(14), nullptr, 0);
|
||||
setHysteresis(limit);
|
||||
}
|
||||
}
|
||||
|
@ -125,9 +125,9 @@ ADIS16448::ADIS16448(std::string initStr) : mraaIo(initStr)
|
||||
|
||||
for (std::string tok : upmTokens) {
|
||||
if(tok.substr(0, 9) == "regWrite:") {
|
||||
uint8_t regAddr = std::stoi(tok.substr(9), &sz, 0);
|
||||
uint8_t regAddr = std::stoul(tok.substr(9), &sz, 0);
|
||||
tok = tok.substr(9);
|
||||
uint16_t regData = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint16_t regData = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
regWrite(regAddr, regData);
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ BH1750::BH1750(std::string initStr) : mraaIo(initStr)
|
||||
powerDown();
|
||||
}
|
||||
if(tok.substr(0, 12) == "sendCommand:") {
|
||||
uint8_t mode = (uint8_t)std::stoi(tok.substr(12), nullptr, 0);
|
||||
uint8_t mode = (uint8_t)std::stoul(tok.substr(12), nullptr, 0);
|
||||
sendCommand(mode);
|
||||
}
|
||||
}
|
||||
|
@ -107,9 +107,9 @@ BMA220::BMA220(std::string initStr) : mraaIo(new mraa::MraaIo(initStr))
|
||||
for(std::string tok :upmTokens)
|
||||
{
|
||||
if(tok.substr(0, 9) == "writeReg:") {
|
||||
uint8_t reg = std::stoi(tok.substr(9), &sz, 0);
|
||||
uint8_t reg = std::stoul(tok.substr(9), &sz, 0);
|
||||
tok = tok.substr(9);
|
||||
uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint8_t val = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
writeReg(reg, val);
|
||||
}
|
||||
if(tok.substr(0, 22) == "setAccelerometerScale:") {
|
||||
|
@ -167,9 +167,9 @@ BMA250E::BMA250E(std::string initStr) : mraaIo(initStr)
|
||||
enableFIFO(useFIFO);
|
||||
}
|
||||
if(tok.substr(0, 9) == "writeReg:") {
|
||||
uint8_t reg = std::stoi(tok.substr(9), &sz, 0);
|
||||
uint8_t reg = std::stoul(tok.substr(9), &sz, 0);
|
||||
tok = tok.substr(9);
|
||||
uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint8_t val = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
writeReg(reg, val);
|
||||
}
|
||||
if(tok.substr(0, 9) == "setRange:") {
|
||||
@ -195,35 +195,35 @@ BMA250E::BMA250E(std::string initStr) : mraaIo(initStr)
|
||||
fifoConfig(mode, axes);
|
||||
}
|
||||
if(tok.substr(0, 20) == "setInterruptEnable0:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(20), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0);
|
||||
setInterruptEnable0(bits);
|
||||
}
|
||||
if(tok.substr(0, 20) == "setInterruptEnable1:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(20), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0);
|
||||
setInterruptEnable1(bits);
|
||||
}
|
||||
if(tok.substr(0, 20) == "setInterruptEnable2:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(20), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0);
|
||||
setInterruptEnable2(bits);
|
||||
}
|
||||
if(tok.substr(0, 17) == "setInterruptMap0:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(17), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0);
|
||||
setInterruptMap0(bits);
|
||||
}
|
||||
if(tok.substr(0, 17) == "setInterruptMap1:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(17), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0);
|
||||
setInterruptMap1(bits);
|
||||
}
|
||||
if(tok.substr(0, 17) == "setInterruptMap2:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(17), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0);
|
||||
setInterruptMap2(bits);
|
||||
}
|
||||
if(tok.substr(0, 16) == "setInterruptSrc:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(16), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0);
|
||||
setInterruptSrc(bits);
|
||||
}
|
||||
if(tok.substr(0, 26) == "setInterruptOutputControl:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(26), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(26), nullptr, 0);
|
||||
setInterruptOutputControl(bits);
|
||||
}
|
||||
if(tok.substr(0, 26) == "setInterruptLatchBehavior:") {
|
||||
|
@ -145,9 +145,9 @@ BMG160::BMG160(std::string initStr) : mraaIo(initStr)
|
||||
enableFIFO(useFIFO);
|
||||
}
|
||||
if(tok.substr(0, 9) == "writeReg:") {
|
||||
uint8_t reg = std::stoi(tok.substr(9), &sz, 0);
|
||||
uint8_t reg = std::stoul(tok.substr(9), &sz, 0);
|
||||
tok = tok.substr(9);
|
||||
uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint8_t val = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
writeReg(reg, val);
|
||||
}
|
||||
if(tok.substr(0, 9) == "setRange:") {
|
||||
@ -173,23 +173,23 @@ BMG160::BMG160(std::string initStr) : mraaIo(initStr)
|
||||
fifoConfig(mode, axes);
|
||||
}
|
||||
if(tok.substr(0, 20) == "setInterruptEnable0:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(20), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(20), nullptr, 0);
|
||||
setInterruptEnable0(bits);
|
||||
}
|
||||
if(tok.substr(0, 17) == "setInterruptMap0:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(17), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0);
|
||||
setInterruptMap0(bits);
|
||||
}
|
||||
if(tok.substr(0, 17) == "setInterruptMap1:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(17), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0);
|
||||
setInterruptMap1(bits);
|
||||
}
|
||||
if(tok.substr(0, 16) == "setInterruptSrc:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(16), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0);
|
||||
setInterruptSrc(bits);
|
||||
}
|
||||
if(tok.substr(0, 26) == "setInterruptOutputControl:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(26), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(26), nullptr, 0);
|
||||
setInterruptOutputControl(bits);
|
||||
}
|
||||
if(tok.substr(0, 26) == "setInterruptLatchBehavior:") {
|
||||
|
@ -151,9 +151,9 @@ BMM150::BMM150(std::string initStr) : mraaIo(initStr)
|
||||
init(usage);
|
||||
}
|
||||
if(tok.substr(0, 9) == "writeReg:") {
|
||||
uint8_t reg = std::stoi(tok.substr(9), &sz, 0);
|
||||
uint8_t reg = std::stoul(tok.substr(9), &sz, 0);
|
||||
tok = tok.substr(9);
|
||||
uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint8_t val = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
writeReg(reg, val);
|
||||
}
|
||||
if(tok.substr(0, 18) == "setOutputDataRate:") {
|
||||
@ -170,19 +170,19 @@ BMM150::BMM150(std::string initStr) : mraaIo(initStr)
|
||||
setOpmode(opmode);
|
||||
}
|
||||
if(tok.substr(0, 19) == "setInterruptEnable:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(19), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(19), nullptr, 0);
|
||||
setInterruptEnable(bits);
|
||||
}
|
||||
if(tok.substr(0, 19) == "setInterruptConfig:") {
|
||||
u_int8_t bits = (u_int8_t)std::stoi(tok.substr(19), nullptr, 0);
|
||||
u_int8_t bits = (u_int8_t)std::stoul(tok.substr(19), nullptr, 0);
|
||||
setInterruptConfig(bits);
|
||||
}
|
||||
if(tok.substr(0, 17) == "setRepetitionsXY:") {
|
||||
u_int8_t reps = (u_int8_t)std::stoi(tok.substr(17), nullptr, 0);
|
||||
u_int8_t reps = (u_int8_t)std::stoul(tok.substr(17), nullptr, 0);
|
||||
setRepetitionsXY(reps);
|
||||
}
|
||||
if(tok.substr(0, 16) == "setRepetitionsZ:") {
|
||||
u_int8_t reps = (u_int8_t)std::stoi(tok.substr(16), nullptr, 0);
|
||||
u_int8_t reps = (u_int8_t)std::stoul(tok.substr(16), nullptr, 0);
|
||||
setRepetitionsZ(reps);
|
||||
}
|
||||
if(tok.substr(0, 14) == "setPresetMode:") {
|
||||
|
@ -170,9 +170,9 @@ BMP280::BMP280(std::string initStr) : mraaIo(initStr)
|
||||
setSeaLevelPreassure(seaLevelhPA);
|
||||
}
|
||||
if(tok.substr(0, 9) == "writeReg:") {
|
||||
uint8_t reg = std::stoi(tok.substr(9), &sz, 0);
|
||||
uint8_t reg = std::stoul(tok.substr(9), &sz, 0);
|
||||
tok = tok.substr(9);
|
||||
uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint8_t val = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
writeReg(reg, val);
|
||||
}
|
||||
if(tok.substr(0, 10) == "setFilter:") {
|
||||
|
@ -110,9 +110,9 @@ BMPX8X::BMPX8X(std::string initStr) : mraaIo(initStr)
|
||||
setOversampling(oss);
|
||||
}
|
||||
if(tok.substr(0, 9) == "writeReg:") {
|
||||
uint8_t reg = std::stoi(tok.substr(9), &sz, 0);
|
||||
uint8_t reg = std::stoul(tok.substr(9), &sz, 0);
|
||||
tok = tok.substr(9);
|
||||
uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0);
|
||||
uint8_t val = std::stoul(tok.substr(sz+1), nullptr, 0);
|
||||
writeReg(reg, val);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user