Skip to content

Commit 6f09b00

Browse files
committed
update guide
1 parent f9c7c06 commit 6f09b00

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

doc/guide.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ typedef void (*libtock_sensor_callback_reading)(returncode_t, int);
251251
Define a upcall function to be passed to the kernel:
252252
253253
```c
254-
static void sensor_temp_upcall(int ret,
254+
static void sensor_temp_upcall(int status,
255255
int val,
256256
__attribute__ ((unused)) int unused0,
257257
void* opaque) {
258258
libtock_sensor_callback_reading cb = (libtock_sensor_callback_reading) opaque;
259-
cb(ret, val);
259+
cb(tock_status_to_returncode(status), val);
260260
}
261261
```
262262

@@ -349,12 +349,15 @@ the function.
349349

350350
```c
351351
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;
355358

356-
*value = (int) ret.data1;
357-
return RETURNCODE_SUCCESS;
359+
*value = (int) ywf.data1;
360+
return ret;
358361
}
359362
```
360363

@@ -400,13 +403,13 @@ space for the sync operation:
400403
#include "syscalls/temperature_syscalls.h"
401404

402405
returncode_t libtocksync_sensor_read(int* val) {
403-
returncode_t err;
406+
returncode_t ret;
404407

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;
407410

408411
// 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;
411414
}
412415
```

0 commit comments

Comments
 (0)