mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
lcm1602,jhd1313m1: 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
fbbc0de6fb
commit
f29141087e
@ -42,7 +42,8 @@ Jhd1313m1::Jhd1313m1(int bus, int lcdAddress, int rgbAddress)
|
||||
|
||||
mraa::Result ret = m_i2c_lcd_rgb.address(m_rgb_address);
|
||||
if (ret != mraa::SUCCESS) {
|
||||
fprintf(stderr, "Messed up i2c bus\n");
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": I2c.address() failed");
|
||||
}
|
||||
|
||||
usleep(50000);
|
||||
|
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "hd44780_bits.h"
|
||||
@ -51,7 +52,8 @@ Lcm1602::Lcm1602(int bus_in, int addr_in, bool isExpander) :
|
||||
|
||||
error = m_i2c_lcd_control->address(m_lcd_control_address);
|
||||
if (error != mraa::SUCCESS) {
|
||||
fprintf(stderr, "Failed to initialize i2c bus\n");
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": I2c.address() failed");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user