summaryrefslogtreecommitdiff
path: root/peripheral/libmraa/api/mraa/i2c.hpp
diff options
context:
space:
mode:
authorMohammed Habibulla <moch@google.com>2016-07-15 20:44:53 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-07-15 20:44:53 +0000
commit9d97430478e42f35a5e00e00766c0c8279cf03dc (patch)
tree4464a7ea06d1f2d81ddaa4015ad17788bc6a76ef /peripheral/libmraa/api/mraa/i2c.hpp
parent94b0add192f544ef43d3a9b1c3e7f223dd8f35fd (diff)
parent2038aa86daa4ec99b3f199e670a95400a82eb2e0 (diff)
downloadintel-9d97430478e42f35a5e00e00766c0c8279cf03dc.tar.gz
Merge \"Revert \"libmraa: sync with upstream (SHA1: d336e9f)\"\"
am: 2038aa86da Change-Id: I712f2d819b81372dba7e8abf0fd3054666f4e3e5
Diffstat (limited to 'peripheral/libmraa/api/mraa/i2c.hpp')
-rw-r--r--peripheral/libmraa/api/mraa/i2c.hpp35
1 files changed, 3 insertions, 32 deletions
diff --git a/peripheral/libmraa/api/mraa/i2c.hpp b/peripheral/libmraa/api/mraa/i2c.hpp
index 52e2153..cd3c31c 100644
--- a/peripheral/libmraa/api/mraa/i2c.hpp
+++ b/peripheral/libmraa/api/mraa/i2c.hpp
@@ -62,18 +62,6 @@ class I2c
throw std::invalid_argument("Invalid i2c bus");
}
}
- /**
- * I2C constructor, takes a pointer to a I2C context and initialises the I2C class
- *
- * @param void * to an I2C context
- */
- I2c(void* i2c_context)
- {
- m_i2c = (mraa_i2c_context) i2c_context;
- if (m_i2c == NULL) {
- throw std::invalid_argument("Invalid I2C context");
- }
- }
/**
* Closes the I2c Bus used. This does not guarrantee the bus will not
@@ -115,17 +103,12 @@ class I2c
/**
* Read exactly one byte from the bus
*
- * @throws std::invalid_argument in case of error
* @return char read from the bus
*/
uint8_t
readByte()
{
- int x = mraa_i2c_read_byte(m_i2c);
- if (x == -1) {
- throw std::invalid_argument("Unknown error in I2c::readByte()");
- }
- return (uint8_t) x;
+ return (uint8_t) mraa_i2c_read_byte(m_i2c);
}
/**
@@ -145,36 +128,24 @@ class I2c
* Read byte from an i2c register
*
* @param reg Register to read from
- *
- * @throws std::invalid_argument in case of error
* @return char read from register
*/
uint8_t
readReg(uint8_t reg)
{
- int x = mraa_i2c_read_byte_data(m_i2c, reg);
- if (x == -1) {
- throw std::invalid_argument("Unknown error in I2c::readReg()");
- }
- return (uint8_t) x;
+ return mraa_i2c_read_byte_data(m_i2c, reg);
}
/**
* Read word from an i2c register
*
* @param reg Register to read from
- *
- * @throws std::invalid_argument in case of error
* @return char read from register
*/
uint16_t
readWordReg(uint8_t reg)
{
- int x = mraa_i2c_read_word_data(m_i2c, reg);
- if (x == -1) {
- throw std::invalid_argument("Unknown error in I2c::readReg()");
- }
- return (uint16_t) x;
+ return mraa_i2c_read_word_data(m_i2c, reg);
}
/**