@@ -251,12 +251,12 @@ typedef void (*libtock_sensor_callback_reading)(returncode_t, int);
251
251
Define a upcall function to be passed to the kernel:
252
252
253
253
```c
254
- static void sensor_temp_upcall(int ret ,
254
+ static void sensor_temp_upcall(int status ,
255
255
int val,
256
256
__attribute__ ((unused)) int unused0,
257
257
void* opaque) {
258
258
libtock_sensor_callback_reading cb = (libtock_sensor_callback_reading) opaque;
259
- cb(ret , val);
259
+ cb(tock_status_to_returncode(status) , val);
260
260
}
261
261
```
262
262
@@ -349,12 +349,15 @@ the function.
349
349
350
350
``` c
351
351
returncode_t libtocksync_[name]_yield_wait_for(int * value) {
352
- yield_waitfor_return_t ret;
353
- ret = yield_wait_for(DRIVER_NUM_ [ NAME] , 0);
354
- if (ret.data0 != RETURNCODE_SUCCESS) return ret.data0;
352
+ returncode_t ret;
353
+ yield_waitfor_return_t ywf;
354
+
355
+ ywf = yield_wait_for(DRIVER_NUM_ [ NAME] , 0);
356
+ ret = tock_status_to_returncode(ywf.data0);
357
+ if (ret != RETURNCODE_SUCCESS) return ret;
355
358
356
- * value = (int) ret .data1;
357
- return RETURNCODE_SUCCESS ;
359
+ * value = (int) ywf .data1;
360
+ return ret ;
358
361
}
359
362
```
360
363
@@ -400,13 +403,13 @@ space for the sync operation:
400
403
#include " syscalls/temperature_syscalls.h"
401
404
402
405
returncode_t libtocksync_sensor_read (int* val) {
403
- returncode_t err ;
406
+ returncode_t ret ;
404
407
405
- err = libtock_sensor_command_read();
406
- if (err != RETURNCODE_SUCCESS) return err ;
408
+ ret = libtock_sensor_command_read();
409
+ if (ret != RETURNCODE_SUCCESS) return ret ;
407
410
408
411
// Wait for the operation to finish.
409
- err = libtock_temperature_yield_wait_for(val);
410
- return err ;
412
+ ret = libtock_temperature_yield_wait_for(val);
413
+ return ret ;
411
414
}
412
415
```
0 commit comments