diff --git a/src/ads1x15/ads1x15.cxx b/src/ads1x15/ads1x15.cxx index cad437e4..2f370ef2 100644 --- a/src/ads1x15/ads1x15.cxx +++ b/src/ads1x15/ads1x15.cxx @@ -38,7 +38,7 @@ ADS1X15::ADS1X15(int bus, uint8_t address){ } if((i2c->address(address) != mraa::SUCCESS)){ - throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.address() failed"); + throw std::runtime_error(std::string(__FUNCTION__) + ": I2c.address() failed"); return; } @@ -125,11 +125,11 @@ ADS1X15::setThresh(ADSTHRESH reg, float value){ switch((int)reg){ case 4: //set conversion_rdy operation if(i2c->writeWordReg(ADS1X15_REG_POINTER_LOWTHRESH, 0x0000) != mraa::SUCCESS){ - throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed"); + throw std::runtime_error(std::string(__FUNCTION__) + ": I2c.write() failed"); return; } if(i2c->writeWordReg(ADS1X15_REG_POINTER_HITHRESH, 0x0080) != mraa::SUCCESS){ - throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed"); + throw std::runtime_error(std::string(__FUNCTION__) + ": I2c.write() failed"); return; } break; @@ -138,18 +138,18 @@ ADS1X15::setThresh(ADSTHRESH reg, float value){ set_value = value / getMultiplier(); set_value = set_value << m_bitShift; if(i2c->writeWordReg(reg, swapWord(set_value)) != mraa::SUCCESS){ - throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed"); + throw std::runtime_error(std::string(__FUNCTION__) + ": I2c.write() failed"); return; } break; case 5: //set default default: if(i2c->writeWordReg(ADS1X15_REG_POINTER_LOWTHRESH, 0x0080) != mraa::SUCCESS){ - throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed"); + throw std::runtime_error(std::string(__FUNCTION__) + ": I2c.write() failed"); return; } if(i2c->writeWordReg(ADS1X15_REG_POINTER_HITHRESH, 0xF07F) != mraa::SUCCESS){ - throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed"); + throw std::runtime_error(std::string(__FUNCTION__) + ": I2c.write() failed"); return; } break; @@ -171,7 +171,7 @@ ADS1X15::updateConfigRegister(uint16_t update, bool read){ //Mask out read bit if we are just updating the configuration. if(!read) temp = update & 0x7FFF; if(i2c->writeWordReg(ADS1X15_REG_POINTER_CONFIG, swapWord(temp)) != mraa::SUCCESS){ - throw std::invalid_argument(std::string(__FUNCTION__) + ": I2c.write() failed"); + throw std::runtime_error(std::string(__FUNCTION__) + ": I2c.write() failed"); return; } //If we update the configuration re-set the in memory copy.