summaryrefslogtreecommitdiff
path: root/ucoo/hal/i2c/i2c.host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ucoo/hal/i2c/i2c.host.cc')
-rw-r--r--ucoo/hal/i2c/i2c.host.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/ucoo/hal/i2c/i2c.host.cc b/ucoo/hal/i2c/i2c.host.cc
index 6b3181b..d471df1 100644
--- a/ucoo/hal/i2c/i2c.host.cc
+++ b/ucoo/hal/i2c/i2c.host.cc
@@ -190,6 +190,22 @@ I2cHost::recv (uint8_t addr, char *buf, int count)
finished_handler_->finished (master_status_);
}
+void
+I2cHost::send_recv (uint8_t addr, const char *send_buf, int send_count,
+ char *recv_buf, int recv_count)
+{
+ // No restart in host implementation, do regular send/recv.
+ int r = shared_->send (addr, send_buf, send_count);
+ if (r == send_count)
+ {
+ master_status_ = STATUS_ERROR;
+ if (finished_handler_)
+ finished_handler_->finished (master_status_);
+ }
+ else
+ recv (addr, recv_buf, recv_count);
+}
+
int
I2cHost::status ()
{