aboutsummaryrefslogtreecommitdiffstats
path: root/ucs2-interface/ucs_lib_interf.c
diff options
context:
space:
mode:
authorTobias Jahnke <tjahnk@users.noreply.github.com>2017-08-01 11:03:06 +0200
committerFulup Ar Foll <fulup@iot.bzh>2017-08-01 11:47:14 +0200
commit01bb6c494c0ccacf75d0a7a7f2c7592147619168 (patch)
tree8ae78499e0732667e0ac226f931faaf769713797 /ucs2-interface/ucs_lib_interf.c
parentf892ce6d36b2287c5f54ae2a819b5342ef6ec22f (diff)
adds async. result to i2c_write
Diffstat (limited to 'ucs2-interface/ucs_lib_interf.c')
-rw-r--r--ucs2-interface/ucs_lib_interf.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ucs2-interface/ucs_lib_interf.c b/ucs2-interface/ucs_lib_interf.c
index 508b723..52840ba 100644
--- a/ucs2-interface/ucs_lib_interf.c
+++ b/ucs2-interface/ucs_lib_interf.c
@@ -222,8 +222,11 @@ void UCSI_Service(UCSI_Data_t *my)
(e->val.I2CWrite.isBurst ? UCS_I2C_BURST_MODE : UCS_I2C_DEFAULT_MODE), e->val.I2CWrite.blockCount,
e->val.I2CWrite.slaveAddr, e->val.I2CWrite.timeout, e->val.I2CWrite.dataLen, e->val.I2CWrite.data, OnUcsI2CWrite))
popEntry = false;
- else
+ else {
UCSI_CB_OnUserMessage(my->tag, true, "Ucs_I2c_WritePort failed", 0);
+ assert(e->val.I2CWrite.result_fptr != NULL);
+ e->val.I2CWrite.result_fptr(NULL /*processing error*/, e->val.I2CWrite.request_ptr);
+ }
break;
default:
assert(false);
@@ -826,6 +829,16 @@ static void OnUcsI2CWrite(uint16_t node_address, uint16_t i2c_port_handle,
{
UCSI_Data_t *my = (UCSI_Data_t *)user_ptr;
assert(MAGIC == my->magic);
+
+ if ((my->currentCmd->cmd == UnicensCmd_I2CWrite)
+ && (my->currentCmd->val.I2CWrite.result_fptr)) {
+
+ my->currentCmd->val.I2CWrite.result_fptr(&result.code, my->currentCmd->val.I2CWrite.request_ptr);
+ }
+ else {
+ assert(false);
+ }
+
OnCommandExecuted(my, UnicensCmd_I2CWrite);
if (UCS_I2C_RES_SUCCESS != result.code)
UCSI_CB_OnUserMessage(my->tag, true, "Remote I2C Write to node=0x%X failed", 1, node_address);