diff --git a/src/abp/abp.cxx b/src/abp/abp.cxx index 4185cdf9..e8a47ac3 100644 --- a/src/abp/abp.cxx +++ b/src/abp/abp.cxx @@ -86,12 +86,12 @@ ABP::ABP(std::string initStr) : mraaIo(initStr) m_abp->abp_pressure_min = 0; for (std::string tok : upmTokens) { - if(tok.substr(0,12) == "maxPressure:") { - int pmax = std::stoi(tok.substr(12),nullptr,0); + if(tok.substr(0, 12) == "maxPressure:") { + int pmax = std::stoi(tok.substr(12), nullptr, 0); setMaxPressure(pmax); } - if(tok.substr(0,12) == "minPressure:") { - int pmin = std::stoi(tok.substr(12),nullptr,0); + if(tok.substr(0, 12) == "minPressure:") { + int pmin = std::stoi(tok.substr(12), nullptr, 0); setMinPressure(pmin); } } diff --git a/src/ad8232/ad8232.cxx b/src/ad8232/ad8232.cxx index 39229a4a..871e52ea 100644 --- a/src/ad8232/ad8232.cxx +++ b/src/ad8232/ad8232.cxx @@ -31,6 +31,11 @@ using namespace upm; using namespace std; +static bool operator!(mraa::MraaIo &mraaIo) +{ + return mraaIo.getMraaDescriptors() == NULL; +} + AD8232::AD8232(int loPlus, int loMinus, int output, float aref) { m_gpioLOPlus = new mraa::Gpio(loPlus); m_gpioLOMinus = new mraa::Gpio(loMinus); @@ -43,47 +48,38 @@ AD8232::AD8232(int loPlus, int loMinus, int output, float aref) { m_ares = (1 << m_aioOUT->getBit()); } -AD8232::AD8232(std::string initStr) -{ - mraaIo = new mraa::MraaIo(initStr); - if(mraaIo == NULL) - { - throw std::invalid_argument(std::string(__FUNCTION__) + - ": Failed to allocate memory for internal member"); +AD8232::AD8232(std::string initStr) : mraaIo(initStr) { + if(!mraaIo.gpios.empty()) { + if(mraaIo.gpios.size() == 2) { + m_gpioLOPlus = &mraaIo.gpios[0]; + m_gpioLOMinus = &mraaIo.gpios[1]; + } + else { + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_gpio_init() must initialize two pins"); + } } - - if(!mraaIo->gpios.empty()) - { - m_gpioLOPlus = &mraaIo->gpios[0]; - m_gpioLOMinus = &mraaIo->gpios[1]; - } - else - { + else { throw std::invalid_argument(std::string(__FUNCTION__) + ": mraa_gpio_init() failed, invalid pin?"); } - if(!mraaIo->aios.empty()) - { - m_aioOUT = &mraaIo->aios[0]; + if(!mraaIo.aios.empty()) { + m_aioOUT = &mraaIo.aios[0]; } - else - { + else { throw std::invalid_argument(std::string(__FUNCTION__) + ": mraa_aio_init() failed, invalid pin?"); } std::vector upmTokens; - if(!mraaIo->getLeftoverStr().empty()) - { - upmTokens = UpmStringParser::parse(mraaIo->getLeftoverStr()); + if(!mraaIo.getLeftoverStr().empty()) { + upmTokens = UpmStringParser::parse(mraaIo.getLeftoverStr()); } - for (std::string tok : upmTokens) - { - if(tok.substr(0,5) == "volt:") - { + for (std::string tok : upmTokens) { + if(tok.substr(0, 5) == "volt:") { m_aref = std::stof(tok.substr(5)); } } @@ -92,12 +88,7 @@ AD8232::AD8232(std::string initStr) AD8232::~AD8232() { - if(mraaIo != NULL) - { - delete mraaIo; - } - else - { + if(!mraaIo) { delete m_gpioLOPlus; delete m_gpioLOMinus; delete m_aioOUT; diff --git a/src/ad8232/ad8232.hpp b/src/ad8232/ad8232.hpp index 029f4bd0..ec1aa455 100644 --- a/src/ad8232/ad8232.hpp +++ b/src/ad8232/ad8232.hpp @@ -105,7 +105,7 @@ namespace upm { int value(); private: - mraa::MraaIo *mraaIo = NULL; + mraa::MraaIo mraaIo; mraa::Gpio *m_gpioLOPlus = NULL; mraa::Gpio *m_gpioLOMinus = NULL; mraa::Aio *m_aioOUT = NULL; diff --git a/src/adafruitss/adafruitss.cxx b/src/adafruitss/adafruitss.cxx index 4699dfc3..645cb6c5 100644 --- a/src/adafruitss/adafruitss.cxx +++ b/src/adafruitss/adafruitss.cxx @@ -106,17 +106,17 @@ adafruitss::adafruitss(std::string initStr) : mraaIo(initStr) for(std::string tok : upmTokens) { - if(tok.substr(0,8) == "pwmFreq:") + if(tok.substr(0, 8) == "pwmFreq:") { float freq = std::stof(tok.substr(8)); setPWMFreq(freq); } - if(tok.substr(0,6) == "servo:") + if(tok.substr(0, 6) == "servo:") { - uint8_t port = std::stoi(tok.substr(6),&sz,0); + uint8_t port = std::stoi(tok.substr(6), &sz, 0); tok = tok.substr(6); old_sz = sz+1; - uint8_t servo_type = std::stoi(tok.substr(old_sz),&sz,0); + uint8_t servo_type = std::stoi(tok.substr(old_sz), &sz, 0); tok = tok.substr(old_sz); float degrees = std::stof(tok.substr(sz+1)); servo(port, servo_type, degrees); diff --git a/src/adc121c021/adc121c021.cxx b/src/adc121c021/adc121c021.cxx index c3b73dc6..996dd5a5 100644 --- a/src/adc121c021/adc121c021.cxx +++ b/src/adc121c021/adc121c021.cxx @@ -89,44 +89,44 @@ ADC121C021::ADC121C021(std::string initStr) : mraaIo(initStr) if(tok.substr(0, 5) == "vref:") { m_vref = std::stof(tok.substr(5)); } - if(tok.substr(0,10) == "writeByte:") { - uint8_t reg = std::stoi(tok.substr(10),&sz,0); + if(tok.substr(0, 10) == "writeByte:") { + uint8_t reg = std::stoi(tok.substr(10), &sz, 0); tok = tok.substr(10); - uint8_t byte = std::stoi(tok.substr(sz+1),nullptr,0); + uint8_t byte = std::stoi(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::stoi(tok.substr(10), &sz, 0); tok = tok.substr(10); - uint16_t word = std::stoi(tok.substr(sz+1),nullptr,0); + uint16_t word = std::stoi(tok.substr(sz+1), nullptr, 0); writeWord(reg, word); } if(tok.substr(0,16) == "enableAlertFlag:") { - bool enable = std::stoi(tok.substr(16),nullptr,0); + bool enable = std::stoi(tok.substr(16), nullptr, 0); enableAlertFlag(enable); } if(tok.substr(0,15) == "enableAlertPin:") { - bool enable = std::stoi(tok.substr(15),nullptr,0); + bool enable = std::stoi(tok.substr(15), nullptr, 0); enableAlertPin(enable); } if(tok.substr(0,16) == "enableAlertHold:") { - bool enable = std::stoi(tok.substr(16),nullptr,0); + bool enable = std::stoi(tok.substr(16), nullptr, 0); enableAlertHold(enable); } if(tok.substr(0,27) == "enableAlertPinPolarityHigh:") { - bool enable = std::stoi(tok.substr(27),nullptr,0); + bool enable = std::stoi(tok.substr(27), nullptr, 0); enableAlertPinPolarityHigh(enable); } if(tok.substr(0,17) == "setAlertLowLimit:") { - uint16_t limit = std::stoi(tok.substr(17),nullptr,0); + uint16_t limit = std::stoi(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::stoi(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::stoi(tok.substr(14), nullptr, 0); setHysteresis(limit); } } diff --git a/src/adis16448/adis16448.cxx b/src/adis16448/adis16448.cxx index 1dc07d27..b84c7f90 100644 --- a/src/adis16448/adis16448.cxx +++ b/src/adis16448/adis16448.cxx @@ -87,7 +87,7 @@ ADIS16448::ADIS16448(std::string initStr) : mraaIo(initStr) } // Configure I/O - //Initialize RST pin + // Initialize RST pin if(!descs->gpios) { throw std::invalid_argument(std::string(__FUNCTION__) + @@ -124,10 +124,10 @@ ADIS16448::ADIS16448(std::string initStr) : mraaIo(initStr) std::string::size_type sz; for (std::string tok : upmTokens) { - if(tok.substr(0,9) == "regWrite:") { - uint8_t regAddr = std::stoi(tok.substr(9),&sz,0); + if(tok.substr(0, 9) == "regWrite:") { + uint8_t regAddr = std::stoi(tok.substr(9), &sz, 0); tok = tok.substr(9); - uint16_t regData = std::stoi(tok.substr(sz+1),nullptr,0); + uint16_t regData = std::stoi(tok.substr(sz+1), nullptr, 0); regWrite(regAddr, regData); } } diff --git a/src/ads1x15/ads1015.cxx b/src/ads1x15/ads1015.cxx index 5a478c97..b82d608e 100644 --- a/src/ads1x15/ads1015.cxx +++ b/src/ads1x15/ads1015.cxx @@ -58,7 +58,7 @@ ADS1015::ADS1015(int bus, uint8_t address, float vref) : ADS1X15(bus, address) { ADS1015::ADS1015(std::string initStr) : ADS1X15(initStr) { - float vref; + float vref = ADS1015_VREF; m_name = "ADS1015"; m_conversionDelay = ADS1015_CONVERSIONDELAY; m_bitShift = 4; @@ -67,14 +67,11 @@ ADS1015::ADS1015(std::string initStr) : ADS1X15(initStr) std::string leftoverString = ADS1X15::getLeftoverStr(); std::vector upmTokens; - if(!leftoverString.empty()) - { - upmTokens = UpmStringParser::parse(mraaIo->getLeftoverStr()); + if(!leftoverString.empty()) { + upmTokens = UpmStringParser::parse(mraaIo.getLeftoverStr()); } - for (std::string tok : upmTokens) - { - if(tok.substr(0,5) == "vref:") - { + for (std::string tok : upmTokens) { + if(tok.substr(0, 5) == "vref:") { vref = std::stof(tok.substr(5)); } } diff --git a/src/ads1x15/ads1x15.cxx b/src/ads1x15/ads1x15.cxx index 94111860..2e475837 100644 --- a/src/ads1x15/ads1x15.cxx +++ b/src/ads1x15/ads1x15.cxx @@ -32,19 +32,24 @@ using namespace upm; -ADS1X15::ADS1X15(int bus, uint8_t address){ +static bool operator!(mraa::MraaIo &mraaIo) +{ + return mraaIo.getMraaDescriptors() == NULL; +} - if(!(i2c = new mraa::I2c(bus))){ +ADS1X15::ADS1X15(int bus, uint8_t address) { + + if(!(i2c = new mraa::I2c(bus))) { throw std::invalid_argument(std::string(__FUNCTION__) +": I2c.init() failed"); return; } - if((i2c->address(address) != mraa::SUCCESS)){ + if((i2c->address(address) != mraa::SUCCESS)) { throw std::runtime_error(std::string(__FUNCTION__) + ": I2c.address() failed"); return; } - if(i2c->frequency( mraa::I2C_FAST) != mraa::SUCCESS){ + if(i2c->frequency( mraa::I2C_FAST) != mraa::SUCCESS) { syslog(LOG_WARNING, "%s: I2c.frequency(I2C_FAST) failed, using default speed", std::string(__FUNCTION__).c_str()); } //Will be reset by sub class. @@ -54,24 +59,16 @@ ADS1X15::ADS1X15(int bus, uint8_t address){ } -ADS1X15::ADS1X15(std::string initStr) +ADS1X15::ADS1X15(std::string initStr) : mraaIo(initStr) { - mraaIo = new mraa::MraaIo(initStr); - if(mraaIo == NULL) - { - throw std::invalid_argument(std::string(__FUNCTION__) + ": Failed to allocate memory for internal member"); + if(!mraaIo.i2cs.empty()) { + i2c = &mraaIo.i2cs[0]; + } + else { + throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.init() failed"); } - if(!mraaIo->i2cs.empty()) - { - i2c = &mraaIo->i2cs[0]; - } - else - { - throw std::invalid_argument(std::string(__FUNCTION__) +": I2c.init() failed"); - } - - if(i2c->frequency( mraa::I2C_FAST) != mraa::SUCCESS){ + if(i2c->frequency( mraa::I2C_FAST) != mraa::SUCCESS) { syslog(LOG_WARNING, "%s: I2c.frequency(I2C_FAST) failed, using default speed", std::string(__FUNCTION__).c_str()); } //Will be reset by sub class. @@ -81,40 +78,41 @@ ADS1X15::ADS1X15(std::string initStr) std::vector upmTokens; - if(!mraaIo->getLeftoverStr().empty()) { - upmTokens = UpmStringParser::parse(mraaIo->getLeftoverStr()); + if(!mraaIo.getLeftoverStr().empty()) { + upmTokens = UpmStringParser::parse(mraaIo.getLeftoverStr()); } std::string::size_type sz; for (std::string tok : upmTokens) { - if(tok.substr(0,12) == "setCompMode:") { - bool mode = std::stoi(tok.substr(12),nullptr,0); + if(tok.substr(0, 12) == "setCompMode:") { + bool mode = std::stoi(tok.substr(12), nullptr, 0); setCompMode(mode); } - if(tok.substr(0,11) == "setCompPol:") { - bool mode = std::stoi(tok.substr(11),nullptr,0); + if(tok.substr(0, 11) == "setCompPol:") { + bool mode = std::stoi(tok.substr(11), nullptr, 0); setCompPol(mode); } - if(tok.substr(0,13) == "setCompLatch:") { - bool mode = std::stoi(tok.substr(13),nullptr,0); + if(tok.substr(0, 13) == "setCompLatch:") { + bool mode = std::stoi(tok.substr(13), nullptr, 0); setCompLatch(mode); } - if(tok.substr(0,14) == "setContinuous:") { - bool mode = std::stoi(tok.substr(14),nullptr,0); + if(tok.substr(0, 14) == "setContinuous:") { + bool mode = std::stoi(tok.substr(14), nullptr, 0); setContinuous(mode); } - if(tok.substr(0,21) == "updateConfigRegister:") { + if(tok.substr(0, 21) == "updateConfigRegister:") { uint16_t update = std::stoi(tok.substr(21),&sz,0); tok = tok.substr(21); - bool read = std::stoi(tok.substr(sz+1),nullptr,0); - updateConfigRegister(update,read); + bool read = std::stoi(tok.substr(sz+1), nullptr, 0); + updateConfigRegister(update, read); } } } -ADS1X15::~ADS1X15(){ - delete mraaIo; +ADS1X15::~ADS1X15() { + if(!mraaIo) + delete i2c; } float @@ -250,7 +248,7 @@ ADS1X15::swapWord(uint16_t value){ std::string ADS1X15::getLeftoverStr(){ - return mraaIo->getLeftoverStr(); + return mraaIo.getLeftoverStr(); } diff --git a/src/ads1x15/ads1x15.hpp b/src/ads1x15/ads1x15.hpp index f65e38ef..c82c803c 100644 --- a/src/ads1x15/ads1x15.hpp +++ b/src/ads1x15/ads1x15.hpp @@ -432,7 +432,7 @@ namespace upm { void updateConfigRegister(uint16_t update, bool read = false); uint16_t swapWord(uint16_t value); - mraa::MraaIo* mraaIo = NULL; + mraa::MraaIo mraaIo; mraa::I2c* i2c; };} diff --git a/src/adxl335/adxl335.cxx b/src/adxl335/adxl335.cxx index 0032e30a..3a519092 100644 --- a/src/adxl335/adxl335.cxx +++ b/src/adxl335/adxl335.cxx @@ -76,25 +76,32 @@ ADXL335::ADXL335(std::string initStr) : mraaIo(initStr) if(!descs->aios) { throw std::invalid_argument(std::string(__FUNCTION__) + - ": mraa_aio_init(X) failed, invalid pin?"); + ": mraa_aio_init(X) failed, invalid pin?"); } else { printf("ADXL335 else inside constructor\n"); - if( !(m_aioX = descs->aios[0]) ) + if(descs->n_aio == 3) + { + if( !(m_aioX = descs->aios[0]) ) + { + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_aio_init(X) failed, invalid pin?"); + } + if( !(m_aioY = descs->aios[1]) ) + { + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_aio_init(X) failed, invalid pin?"); + } + if( !(m_aioZ = descs->aios[2]) ) + { + throw std::invalid_argument(std::string(__FUNCTION__) + + ": mraa_aio_init(X) failed, invalid pin?"); + } + } else { throw std::invalid_argument(std::string(__FUNCTION__) + - ": mraa_aio_init(X) failed, invalid pin?"); - } - if( !(m_aioY = descs->aios[1]) ) - { - throw std::invalid_argument(std::string(__FUNCTION__) + - ": mraa_aio_init(X) failed, invalid pin?"); - } - if( !(m_aioZ = descs->aios[2]) ) - { - throw std::invalid_argument(std::string(__FUNCTION__) + - ": mraa_aio_init(X) failed, invalid pin?"); + ": mraa_aio_init(X) must initialize three pins"); } } @@ -105,7 +112,7 @@ ADXL335::ADXL335(std::string initStr) : mraaIo(initStr) } for (std::string tok : upmTokens) { - if(tok.substr(0,5) == "aref:") { + if(tok.substr(0, 5) == "aref:") { m_aref = std::stof(tok.substr(5)); } } diff --git a/src/adxrs610/adxrs610.cxx b/src/adxrs610/adxrs610.cxx index 5a3ea184..708332ba 100644 --- a/src/adxrs610/adxrs610.cxx +++ b/src/adxrs610/adxrs610.cxx @@ -74,7 +74,7 @@ ADXRS610::ADXRS610(std::string initStr) : mraaIo(new mraa::MraaIo(initStr)) setDeadband(0.0); for (std::string tok : upmTokens) { - if(tok.substr(0,5) == "aref:") { + if(tok.substr(0, 5) == "aref:") { m_aref = std::stof(tok.substr(5)); } } diff --git a/src/am2315/am2315.cpp b/src/am2315/am2315.cpp index 74587757..f0a62070 100644 --- a/src/am2315/am2315.cpp +++ b/src/am2315/am2315.cpp @@ -109,7 +109,7 @@ AM2315::AM2315(std::string initStr) : mraaIo(initStr) } for (std::string tok : upmTokens) { - if(tok.substr(0,13) == "updateValues:") { + if(tok.substr(0, 13) == "updateValues:") { update_values(); } } diff --git a/src/apds9930/apds9930.cxx b/src/apds9930/apds9930.cxx index a9be920e..a11dc499 100644 --- a/src/apds9930/apds9930.cxx +++ b/src/apds9930/apds9930.cxx @@ -66,12 +66,12 @@ APDS9930::APDS9930(std::string initStr) : mraaIo(initStr) } for (std::string tok : upmTokens) { - if(tok.substr(0,16) == "enableProximity:") { - bool enable = std::stoi(tok.substr(16),nullptr,0); + if(tok.substr(0, 16) == "enableProximity:") { + bool enable = std::stoi(tok.substr(16), nullptr, 0); enableProximity(enable); } - if(tok.substr(0,18) == "enableIlluminance:") { - bool enable = std::stoi(tok.substr(18),nullptr,0); + if(tok.substr(0, 18) == "enableIlluminance:") { + bool enable = std::stoi(tok.substr(18), nullptr, 0); enableIlluminance(enable); } } diff --git a/src/bh1750/bh1750.cxx b/src/bh1750/bh1750.cxx index fb5d4c50..a4d5a627 100644 --- a/src/bh1750/bh1750.cxx +++ b/src/bh1750/bh1750.cxx @@ -81,7 +81,7 @@ BH1750::BH1750(std::string initStr) : mraaIo(initStr) for (std::string tok : upmTokens) { if(tok.substr(0, 5) == "mode:") { - BH1750_OPMODES_T mode = (BH1750_OPMODES_T)std::stoi(tok.substr(5),nullptr,0); + BH1750_OPMODES_T mode = (BH1750_OPMODES_T)std::stoi(tok.substr(5), nullptr, 0); if(bh1750_set_opmode(m_bh1750, mode) != UPM_SUCCESS) { bh1750_close(m_bh1750); @@ -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::stoi(tok.substr(12), nullptr, 0); sendCommand(mode); } } diff --git a/src/bma220/bma220.cxx b/src/bma220/bma220.cxx index 4cb5a3ce..cdef7fbd 100644 --- a/src/bma220/bma220.cxx +++ b/src/bma220/bma220.cxx @@ -106,31 +106,31 @@ 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); + if(tok.substr(0, 9) == "writeReg:") { + uint8_t reg = std::stoi(tok.substr(9), &sz, 0); tok = tok.substr(9); - uint8_t val = std::stoi(tok.substr(sz+1),nullptr,0); + uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0); writeReg(reg, val); } - if(tok.substr(0,22) == "setAccelerometerScale:") { - FSL_RANGE_T scale = (FSL_RANGE_T)std::stoi(tok.substr(22),nullptr,0); + if(tok.substr(0, 22) == "setAccelerometerScale:") { + FSL_RANGE_T scale = (FSL_RANGE_T)std::stoi(tok.substr(22), nullptr, 0); setAccelerometerScale(scale); } - if(tok.substr(0,16) == "setFilterConfig:") { - FILTER_CONFIG_T filter = (FILTER_CONFIG_T)std::stoi(tok.substr(16),nullptr,0); + if(tok.substr(0, 16) == "setFilterConfig:") { + FILTER_CONFIG_T filter = (FILTER_CONFIG_T)std::stoi(tok.substr(16), nullptr, 0); setFilterConfig(filter); } - if(tok.substr(0,16) == "setSerialHighBW:") { - bool high = std::stoi(tok.substr(16),nullptr,0); + if(tok.substr(0, 16) == "setSerialHighBW:") { + bool high = std::stoi(tok.substr(16), nullptr, 0); setSerialHighBW(high); } - if(tok.substr(0,16) == "setFilterConfig:") { - FILTER_CONFIG_T filter = (FILTER_CONFIG_T)std::stoi(tok.substr(16),nullptr,0); + if(tok.substr(0, 16) == "setFilterConfig:") { + FILTER_CONFIG_T filter = (FILTER_CONFIG_T)std::stoi(tok.substr(16), nullptr, 0); setFilterConfig(filter); } - if(tok.substr(0,16) == "setFilterConfig:") { - FILTER_CONFIG_T filter = (FILTER_CONFIG_T)std::stoi(tok.substr(16),nullptr,0); + if(tok.substr(0, 16) == "setFilterConfig:") { + FILTER_CONFIG_T filter = (FILTER_CONFIG_T)std::stoi(tok.substr(16), nullptr, 0); setFilterConfig(filter); } } diff --git a/src/bma250e/bma250e.cxx b/src/bma250e/bma250e.cxx index 908cfb34..0559a217 100644 --- a/src/bma250e/bma250e.cxx +++ b/src/bma250e/bma250e.cxx @@ -161,81 +161,81 @@ BMA250E::BMA250E(std::string initStr) : mraaIo(initStr) } std::string::size_type sz; - for(std::string tok:upmTokens) { - if(tok.substr(0,11) == "enableFIFO:") { - bool useFIFO = std::stoi(tok.substr(11),&sz,0); + for(std::string tok : upmTokens) { + if(tok.substr(0, 11) == "enableFIFO:") { + bool useFIFO = std::stoi(tok.substr(11), &sz, 0); enableFIFO(useFIFO); } - if(tok.substr(0,9) == "writeReg:") { - uint8_t reg = std::stoi(tok.substr(9),&sz,0); + if(tok.substr(0, 9) == "writeReg:") { + uint8_t reg = std::stoi(tok.substr(9), &sz, 0); tok = tok.substr(9); - uint8_t val = std::stoi(tok.substr(sz+1),nullptr,0); + uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0); writeReg(reg, val); } - if(tok.substr(0,9) == "setRange:") { - BMA250E_RANGE_T scale = (BMA250E_RANGE_T)std::stoi(tok.substr(9),nullptr,0); + if(tok.substr(0, 9) == "setRange:") { + BMA250E_RANGE_T scale = (BMA250E_RANGE_T)std::stoi(tok.substr(9), nullptr, 0); setRange(scale); } - if(tok.substr(0,13) == "setBandwidth:") { - BMA250E_BW_T bw = (BMA250E_BW_T)std::stoi(tok.substr(13),nullptr,0); + if(tok.substr(0, 13) == "setBandwidth:") { + BMA250E_BW_T bw = (BMA250E_BW_T)std::stoi(tok.substr(13), nullptr, 0); setBandwidth(bw); } - if(tok.substr(0,13) == "setPowerMode:") { - BMA250E_POWER_MODE_T power = (BMA250E_POWER_MODE_T)std::stoi(tok.substr(13),nullptr,0); + if(tok.substr(0, 13) == "setPowerMode:") { + BMA250E_POWER_MODE_T power = (BMA250E_POWER_MODE_T)std::stoi(tok.substr(13), nullptr, 0); setPowerMode(power); } - if(tok.substr(0,17) == "fifoSetWatermark:") { - BMA250E_RANGE_T wm = (BMA250E_RANGE_T)std::stoi(tok.substr(17),nullptr,0); + if(tok.substr(0, 17) == "fifoSetWatermark:") { + BMA250E_RANGE_T wm = (BMA250E_RANGE_T)std::stoi(tok.substr(17), nullptr, 0); fifoSetWatermark(wm); } - if(tok.substr(0,11) == "fifoConfig:") { - BMA250E_FIFO_MODE_T mode = (BMA250E_FIFO_MODE_T)std::stoi(tok.substr(11),&sz,0); + if(tok.substr(0, 11) == "fifoConfig:") { + BMA250E_FIFO_MODE_T mode = (BMA250E_FIFO_MODE_T)std::stoi(tok.substr(11), &sz, 0); tok = tok.substr(11); - BMA250E_FIFO_DATA_SEL_T axes = (BMA250E_FIFO_DATA_SEL_T)std::stoi(tok.substr(sz+1),nullptr,0); + BMA250E_FIFO_DATA_SEL_T axes = (BMA250E_FIFO_DATA_SEL_T)std::stoi(tok.substr(sz+1), nullptr, 0); fifoConfig(mode, axes); } - if(tok.substr(0,20) == "setInterruptEnable0:") { - u_int8_t bits = (u_int8_t)std::stoi(tok.substr(20),nullptr,0); + if(tok.substr(0, 20) == "setInterruptEnable0:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 20) == "setInterruptEnable1:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 20) == "setInterruptEnable2:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 17) == "setInterruptMap0:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 17) == "setInterruptMap1:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 17) == "setInterruptMap2:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 16) == "setInterruptSrc:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 26) == "setInterruptOutputControl:") { + u_int8_t bits = (u_int8_t)std::stoi(tok.substr(26), nullptr, 0); setInterruptOutputControl(bits); } - if(tok.substr(0,26) == "setInterruptLatchBehavior:") { - BMA250E_RST_LATCH_T latch = (BMA250E_RST_LATCH_T)std::stoi(tok.substr(26),nullptr,0); + if(tok.substr(0, 26) == "setInterruptLatchBehavior:") { + BMA250E_RST_LATCH_T latch = (BMA250E_RST_LATCH_T)std::stoi(tok.substr(26), nullptr, 0); setInterruptLatchBehavior(latch); } - if(tok.substr(0,24) == "enableRegisterShadowing:") { - bool shadow = std::stoi(tok.substr(24),nullptr,0); + if(tok.substr(0, 24) == "enableRegisterShadowing:") { + bool shadow = std::stoi(tok.substr(24), nullptr, 0); enableRegisterShadowing(shadow); } - if(tok.substr(0,22) == "enableOutputFiltering:") { - bool filter = std::stoi(tok.substr(22),nullptr,0); + if(tok.substr(0, 22) == "enableOutputFiltering:") { + bool filter = std::stoi(tok.substr(22), nullptr, 0); enableOutputFiltering(filter); } } diff --git a/src/bmg160/bmg160.cxx b/src/bmg160/bmg160.cxx index e19ca24e..7d23bbdd 100644 --- a/src/bmg160/bmg160.cxx +++ b/src/bmg160/bmg160.cxx @@ -140,68 +140,68 @@ BMG160::BMG160(std::string initStr) : mraaIo(initStr) std::string::size_type sz; for(std::string tok:upmTokens) { - if(tok.substr(0,11) == "enableFIFO:") { - bool useFIFO = std::stoi(tok.substr(11),&sz,0); + if(tok.substr(0, 11) == "enableFIFO:") { + bool useFIFO = std::stoi(tok.substr(11), &sz, 0); enableFIFO(useFIFO); } - if(tok.substr(0,9) == "writeReg:") { - uint8_t reg = std::stoi(tok.substr(9),&sz,0); + if(tok.substr(0, 9) == "writeReg:") { + uint8_t reg = std::stoi(tok.substr(9), &sz, 0); tok = tok.substr(9); - uint8_t val = std::stoi(tok.substr(sz+1),nullptr,0); + uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0); writeReg(reg, val); } - if(tok.substr(0,9) == "setRange:") { - BMG160_RANGE_T scale = (BMG160_RANGE_T)std::stoi(tok.substr(22),nullptr,0); + if(tok.substr(0, 9) == "setRange:") { + BMG160_RANGE_T scale = (BMG160_RANGE_T)std::stoi(tok.substr(22), nullptr, 0); setRange(scale); } - if(tok.substr(0,13) == "setBandwidth:") { - BMG160_BW_T bw = (BMG160_BW_T)std::stoi(tok.substr(13),nullptr,0); + if(tok.substr(0, 13) == "setBandwidth:") { + BMG160_BW_T bw = (BMG160_BW_T)std::stoi(tok.substr(13), nullptr, 0); setBandwidth(bw); } - if(tok.substr(0,13) == "setPowerMode:") { - BMG160_POWER_MODE_T power = (BMG160_POWER_MODE_T)std::stoi(tok.substr(13),nullptr,0); + if(tok.substr(0, 13) == "setPowerMode:") { + BMG160_POWER_MODE_T power = (BMG160_POWER_MODE_T)std::stoi(tok.substr(13), nullptr, 0); setPowerMode(power); } - if(tok.substr(0,17) == "fifoSetWatermark:") { - BMG160_RANGE_T wm = (BMG160_RANGE_T)std::stoi(tok.substr(17),nullptr,0); + if(tok.substr(0, 17) == "fifoSetWatermark:") { + BMG160_RANGE_T wm = (BMG160_RANGE_T)std::stoi(tok.substr(17), nullptr, 0); fifoSetWatermark(wm); } - if(tok.substr(0,11) == "fifoConfig:") { - BMG160_FIFO_MODE_T mode = (BMG160_FIFO_MODE_T)std::stoi(tok.substr(11),&sz,0); + if(tok.substr(0, 11) == "fifoConfig:") { + BMG160_FIFO_MODE_T mode = (BMG160_FIFO_MODE_T)std::stoi(tok.substr(11), &sz, 0); tok = tok.substr(11); - BMG160_FIFO_DATA_SEL_T axes = (BMG160_FIFO_DATA_SEL_T)std::stoi(tok.substr(sz+1),nullptr,0); + BMG160_FIFO_DATA_SEL_T axes = (BMG160_FIFO_DATA_SEL_T)std::stoi(tok.substr(sz+1), nullptr, 0); fifoConfig(mode, axes); } - if(tok.substr(0,20) == "setInterruptEnable0:") { - u_int8_t bits = (u_int8_t)std::stoi(tok.substr(20),nullptr,0); + if(tok.substr(0, 20) == "setInterruptEnable0:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 17) == "setInterruptMap0:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 17) == "setInterruptMap1:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 16) == "setInterruptSrc:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 26) == "setInterruptOutputControl:") { + u_int8_t bits = (u_int8_t)std::stoi(tok.substr(26), nullptr, 0); setInterruptOutputControl(bits); } - if(tok.substr(0,26) == "setInterruptLatchBehavior:") { - BMG160_RST_LATCH_T latch = (BMG160_RST_LATCH_T)std::stoi(tok.substr(26),nullptr,0); + if(tok.substr(0, 26) == "setInterruptLatchBehavior:") { + BMG160_RST_LATCH_T latch = (BMG160_RST_LATCH_T)std::stoi(tok.substr(26), nullptr, 0); setInterruptLatchBehavior(latch); } - if(tok.substr(0,24) == "enableRegisterShadowing:") { - bool shadow = std::stoi(tok.substr(24),nullptr,0); + if(tok.substr(0, 24) == "enableRegisterShadowing:") { + bool shadow = std::stoi(tok.substr(24), nullptr, 0); enableRegisterShadowing(shadow); } - if(tok.substr(0,22) == "enableOutputFiltering:") { - bool filter = std::stoi(tok.substr(22),nullptr,0); + if(tok.substr(0, 22) == "enableOutputFiltering:") { + bool filter = std::stoi(tok.substr(22), nullptr, 0); enableOutputFiltering(filter); } } diff --git a/src/bmm150/bmm150.cxx b/src/bmm150/bmm150.cxx index ab873e89..feda81d7 100644 --- a/src/bmm150/bmm150.cxx +++ b/src/bmm150/bmm150.cxx @@ -146,47 +146,47 @@ BMM150::BMM150(std::string initStr) : mraaIo(initStr) std::string::size_type sz; for(std::string tok:upmTokens) { - if(tok.substr(0,5) == "init:") { - BMM150_USAGE_PRESETS_T usage = (BMM150_USAGE_PRESETS_T)std::stoi(tok.substr(5),nullptr,0); + if(tok.substr(0, 5) == "init:") { + BMM150_USAGE_PRESETS_T usage = (BMM150_USAGE_PRESETS_T)std::stoi(tok.substr(5), nullptr, 0); init(usage); } - if(tok.substr(0,9) == "writeReg:") { - uint8_t reg = std::stoi(tok.substr(9),&sz,0); + if(tok.substr(0, 9) == "writeReg:") { + uint8_t reg = std::stoi(tok.substr(9), &sz, 0); tok = tok.substr(9); - uint8_t val = std::stoi(tok.substr(sz+1),nullptr,0); + uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0); writeReg(reg, val); } - if(tok.substr(0,18) == "setOutputDataRate:") { - BMM150_DATA_RATE_T odr = (BMM150_DATA_RATE_T)std::stoi(tok.substr(18),nullptr,0); + if(tok.substr(0, 18) == "setOutputDataRate:") { + BMM150_DATA_RATE_T odr = (BMM150_DATA_RATE_T)std::stoi(tok.substr(18), nullptr, 0); setOutputDataRate(odr); } - if(tok.substr(0,12) == "setPowerBit:") { - bool power = std::stoi(tok.substr(12),&sz,0); + if(tok.substr(0, 12) == "setPowerBit:") { + bool power = std::stoi(tok.substr(12), &sz, 0); setPowerBit(power); } - if(tok.substr(0,10) == "setOpmode:") { - BMM150_OPERATION_MODE_T opmode = (BMM150_OPERATION_MODE_T)std::stoi(tok.substr(10),nullptr,0); + if(tok.substr(0, 10) == "setOpmode:") { + BMM150_OPERATION_MODE_T opmode = (BMM150_OPERATION_MODE_T)std::stoi(tok.substr(10), nullptr, 0); setOpmode(opmode); } - if(tok.substr(0,19) == "setInterruptEnable:") { - u_int8_t bits = (u_int8_t)std::stoi(tok.substr(19),nullptr,0); + if(tok.substr(0, 19) == "setInterruptEnable:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 19) == "setInterruptConfig:") { + u_int8_t bits = (u_int8_t)std::stoi(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); + if(tok.substr(0, 17) == "setRepetitionsXY:") { + u_int8_t reps = (u_int8_t)std::stoi(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); + if(tok.substr(0, 16) == "setRepetitionsZ:") { + u_int8_t reps = (u_int8_t)std::stoi(tok.substr(16), nullptr, 0); setRepetitionsZ(reps); } - if(tok.substr(0,14) == "setPresetMode:") { - BMM150_USAGE_PRESETS_T usage = (BMM150_USAGE_PRESETS_T)std::stoi(tok.substr(14),nullptr,0); + if(tok.substr(0, 14) == "setPresetMode:") { + BMM150_USAGE_PRESETS_T usage = (BMM150_USAGE_PRESETS_T)std::stoi(tok.substr(14), nullptr, 0); setPresetMode(usage); } } diff --git a/src/bmp280/bmp280.cxx b/src/bmp280/bmp280.cxx index f37d04fd..a4e0f36c 100644 --- a/src/bmp280/bmp280.cxx +++ b/src/bmp280/bmp280.cxx @@ -165,38 +165,38 @@ BMP280::BMP280(std::string initStr) : mraaIo(initStr) std::string::size_type sz; for(std::string tok:upmTokens) { - if(tok.substr(0,21) == "setSeaLevelPreassure:") { + if(tok.substr(0, 21) == "setSeaLevelPreassure:") { float seaLevelhPA = std::stof(tok.substr(21)); setSeaLevelPreassure(seaLevelhPA); } - if(tok.substr(0,9) == "writeReg:") { - uint8_t reg = std::stoi(tok.substr(9),&sz,0); + if(tok.substr(0, 9) == "writeReg:") { + uint8_t reg = std::stoi(tok.substr(9), &sz, 0); tok = tok.substr(9); - uint8_t val = std::stoi(tok.substr(sz+1),nullptr,0); + uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0); writeReg(reg, val); } - if(tok.substr(0,10) == "setFilter:") { - BMP280_FILTER_T filter = (BMP280_FILTER_T)std::stoi(tok.substr(10),nullptr,0); + if(tok.substr(0, 10) == "setFilter:") { + BMP280_FILTER_T filter = (BMP280_FILTER_T)std::stoi(tok.substr(10), nullptr, 0); setFilter(filter); } - if(tok.substr(0,16) == "setTimerStandby:") { - BMP280_T_SB_T tsb = (BMP280_T_SB_T)std::stoi(tok.substr(16),nullptr,0); + if(tok.substr(0, 16) == "setTimerStandby:") { + BMP280_T_SB_T tsb = (BMP280_T_SB_T)std::stoi(tok.substr(16), nullptr, 0); setTimerStandby(tsb); } - if(tok.substr(0,15) == "setMeasureMode:") { - BMP280_MODES_T mode = (BMP280_MODES_T)std::stoi(tok.substr(15),nullptr,0); + if(tok.substr(0, 15) == "setMeasureMode:") { + BMP280_MODES_T mode = (BMP280_MODES_T)std::stoi(tok.substr(15), nullptr, 0); setMeasureMode(mode); } - if(tok.substr(0,26) == "setOversampleRatePressure:") { - BMP280_OSRS_P_T rate = (BMP280_OSRS_P_T)std::stoi(tok.substr(26),nullptr,0); + if(tok.substr(0, 26) == "setOversampleRatePressure:") { + BMP280_OSRS_P_T rate = (BMP280_OSRS_P_T)std::stoi(tok.substr(26), nullptr, 0); setOversampleRatePressure(rate); } - if(tok.substr(0,29) == "setOversampleRateTemperature:") { - BMP280_OSRS_T_T rate = (BMP280_OSRS_T_T)std::stoi(tok.substr(29),nullptr,0); + if(tok.substr(0, 29) == "setOversampleRateTemperature:") { + BMP280_OSRS_T_T rate = (BMP280_OSRS_T_T)std::stoi(tok.substr(29), nullptr, 0); setOversampleRateTemperature(rate); } - if(tok.substr(0,13) == "setUsageMode:") { - BMP280_USAGE_MODE_T mode = (BMP280_USAGE_MODE_T)std::stoi(tok.substr(13),nullptr,0); + if(tok.substr(0, 13) == "setUsageMode:") { + BMP280_USAGE_MODE_T mode = (BMP280_USAGE_MODE_T)std::stoi(tok.substr(13), nullptr, 0); setUsageMode(mode); } } diff --git a/src/bmpx8x/bmpx8x.cxx b/src/bmpx8x/bmpx8x.cxx index e2a0ef91..8e0f8102 100644 --- a/src/bmpx8x/bmpx8x.cxx +++ b/src/bmpx8x/bmpx8x.cxx @@ -104,15 +104,15 @@ BMPX8X::BMPX8X(std::string initStr) : mraaIo(initStr) } std::string::size_type sz; - for(std::string tok:upmTokens) { - if(tok.substr(0,16) == "setOversampling:") { - BMPX8X_OSS_T oss = (BMPX8X_OSS_T)std::stoi(tok.substr(16),nullptr,0); + for(std::string tok : upmTokens) { + if(tok.substr(0, 16) == "setOversampling:") { + BMPX8X_OSS_T oss = (BMPX8X_OSS_T)std::stoi(tok.substr(16), nullptr, 0); setOversampling(oss); } - if(tok.substr(0,9) == "writeReg:") { - uint8_t reg = std::stoi(tok.substr(9),&sz,0); + if(tok.substr(0, 9) == "writeReg:") { + uint8_t reg = std::stoi(tok.substr(9), &sz, 0); tok = tok.substr(9); - uint8_t val = std::stoi(tok.substr(sz+1),nullptr,0); + uint8_t val = std::stoi(tok.substr(sz+1), nullptr, 0); writeReg(reg, val); } } diff --git a/src/cjq4435/cjq4435.cxx b/src/cjq4435/cjq4435.cxx index 0a22c415..f3dae444 100644 --- a/src/cjq4435/cjq4435.cxx +++ b/src/cjq4435/cjq4435.cxx @@ -84,24 +84,24 @@ CJQ4435::CJQ4435(std::string initStr) : mraaIo(initStr) m_cjq4435->enabled = false; for(std::string tok : upmTokens) { - if(tok.substr(0,12) == "setPeriodUS:") { - int us = std::stoi(tok.substr(0,12),nullptr,0); + if(tok.substr(0, 12) == "setPeriodUS:") { + int us = std::stoi(tok.substr(0, 12), nullptr, 0); setPeriodUS(us); } - if(tok.substr(0,12) == "setPeriodMS:") { - int ms = std::stoi(tok.substr(0,12),nullptr,0); + if(tok.substr(0, 12) == "setPeriodMS:") { + int ms = std::stoi(tok.substr(0, 12), nullptr, 0); setPeriodMS(ms); } - if(tok.substr(0,17) == "setPeriodSeconds:") { - float seconds = std::stof(tok.substr(0,17)); + if(tok.substr(0, 17) == "setPeriodSeconds:") { + float seconds = std::stof(tok.substr(0, 17)); setPeriodSeconds(seconds); } - if(tok.substr(0,7) == "enable:") { - bool en = std::stoi(tok.substr(0,7),nullptr,0); + if(tok.substr(0, 7) == "enable:") { + bool en = std::stoi(tok.substr(0, 7), nullptr, 0); enable(en); } - if(tok.substr(0,13) == "setDutyCycle:") { - float dutyCycle = std::stof(tok.substr(0,13)); + if(tok.substr(0, 13) == "setDutyCycle:") { + float dutyCycle = std::stof(tok.substr(0, 13)); setDutyCycle(dutyCycle); } } diff --git a/src/cwlsxxa/cwlsxxa.cxx b/src/cwlsxxa/cwlsxxa.cxx index b9bbb4d2..a5fa1a0d 100644 --- a/src/cwlsxxa/cwlsxxa.cxx +++ b/src/cwlsxxa/cwlsxxa.cxx @@ -123,14 +123,14 @@ CWLSXXA::CWLSXXA(std::string initStr) upmTokens = UpmStringParser::parse(mraaIo->getLeftoverStr()); } - for(std::string tok:upmTokens) + for(std::string tok : upmTokens) { - if(tok.substr(0,5) == "aref:") + if(tok.substr(0, 5) == "aref:") { float aref = std::stof(tok.substr(5)); m_aref = aref; } - if(tok.substr(0,10) == "rResistor:") + if(tok.substr(0, 10) == "rResistor:") { float rResistor = std::stof(tok.substr(10)); m_rResistor = rResistor;