Userland app for distance sensor#463
Open
cristianaprecup wants to merge 3 commits intotock:masterfrom
Open
Conversation
alexandruradovici
requested changes
Aug 15, 2024
| // | ||
| // A returncode indicating whether the distance read was completed | ||
| // successfully. | ||
| returncode_t libtocksync_distance_read(int* distance); |
Contributor
There was a problem hiding this comment.
These function do not have an async version, I would place them only on libtock/sensors.
|
|
||
| int libtock_distance_get_maximum_distance(void) { | ||
| return command(DRIVER_NUM_DISTANCE, 3, 0, 0).data[0]; | ||
| } No newline at end of file |
| returncode_t libtock_distance_set_upcall(subscribe_upcall callback, void* opaque); | ||
|
|
||
| // Initiate an ambient distance measurement. | ||
| returncode_t libtock_distance_command_read(void); |
Contributor
There was a problem hiding this comment.
Suggested change
| returncode_t libtock_distance_command_read(void); | |
| returncode_t libtock_distance_read(void); |
| return tock_subscribe_return_to_returncode(sval); | ||
| } | ||
|
|
||
| returncode_t libtock_distance_command_read(void) { |
Contributor
There was a problem hiding this comment.
Suggested change
| returncode_t libtock_distance_command_read(void) { | |
| returncode_t libtock_distance_read(void) { |
Comment on lines
+13
to
+15
| returncode_t ret; | ||
|
|
||
| ret = libtock_distance_set_upcall(distance_upcall, cb); |
Contributor
There was a problem hiding this comment.
Suggested change
| returncode_t ret; | |
| ret = libtock_distance_set_upcall(distance_upcall, cb); | |
| returncode_t ret = libtock_distance_set_upcall(distance_upcall, cb); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds an app that provides a simple interface to read measurements from a connected distance sensor
(tock/tock#4138).
Files added:
libtock_sync/sensors/distance.clibtock_sync/sensors/distance.hlibtock/sensors/syscalls/distance_syscalls.clibtock/sensors/syscalls/distance_syscalls.hlibtock/sensors/distance.clibtock/sensors/distance.hFile modified:
examples/sensors/main.c