mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
ssd1308: throw exception(s) on fatal errors
Signed-off-by: Jon Trulson <jtrulson@ics.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
fe133d7454
commit
cb6427b22e
@ -22,6 +22,7 @@
|
|||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -37,7 +38,8 @@ SSD1308::SSD1308(int bus_in, int addr_in) : m_i2c_lcd_control(bus_in)
|
|||||||
|
|
||||||
mraa::Result error = m_i2c_lcd_control.address(m_lcd_control_address);
|
mraa::Result error = m_i2c_lcd_control.address(m_lcd_control_address);
|
||||||
if (error != mraa::SUCCESS) {
|
if (error != mraa::SUCCESS) {
|
||||||
fprintf(stderr, "Failed to initialize i2c bus\n");
|
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||||
|
": I2c.address() failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user