diff options
author | daniel <danieruru@gmail.com> | 2012-10-07 19:46:17 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2012-10-07 19:46:17 +0900 |
commit | 3870833ae365162eccd5e1416682de02c498467b (patch) | |
tree | 7eb21d1aab245e094d7e51b9ad252115094e050e /i2c.c | |
parent | db682a18e8c7b1711f101d655a4f12e53c71b73d (diff) | |
parent | b2c2c72d381ab1b32fa5b5fc4e890fef6c2bf1e0 (diff) |
Merge branch 'master' of grenfell.avtechpulse.com:Instrument
Conflicts:
instr-daemon.c
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; } |