diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-10-04 08:05:53 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-10-04 08:05:53 -0400 |
commit | b5d824985ca85bda978185bddca4066ac63a249c (patch) | |
tree | 00aa09f4f77fae9dffcd5fdd7ac1137025207c8c /i2c.c | |
parent | e1231fc5e2aacdbe3c3fae4b7440189a06843cb0 (diff) |
more sensible warnings if hardware is missing
Diffstat (limited to 'i2c.c')
-rw-r--r-- | i2c.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -10,6 +10,9 @@ #define I2C_BUS "/dev/i2c-3" +gboolean write_error_flagged; +gboolean read_error_flagged; + void I2C_Write(gulong address, guchar value) { @@ -23,7 +26,8 @@ void I2C_Write(gulong address, guchar value) int device = open(I2C_BUS, O_RDWR); - if (device == -1) { + if ((device == -1) && !write_error_flagged) { + write_error_flagged = TRUE; g_print_debug("ERROR: could not open I2C bus %s for writing\n", I2C_BUS); return; } @@ -48,7 +52,8 @@ guchar I2C_Read(gulong address) int device = open(I2C_BUS, O_RDWR); - if (device == -1) { + if ((device == -1) && !read_error_flagged) { + read_error_flagged = TRUE; g_print_debug("ERROR: could not open I2C bus %s for reading\n", I2C_BUS); return 0; } |