-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Userland app for distance sensor #463
base: master
Are you sure you want to change the base?
Conversation
// | ||
// A returncode indicating whether the distance read was completed | ||
// successfully. | ||
returncode_t libtocksync_distance_read(int* distance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a newline.
returncode_t libtock_distance_set_upcall(subscribe_upcall callback, void* opaque); | ||
|
||
// Initiate an ambient distance measurement. | ||
returncode_t libtock_distance_command_read(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returncode_t libtock_distance_command_read(void) { | |
returncode_t libtock_distance_read(void) { |
returncode_t ret; | ||
|
||
ret = libtock_distance_set_upcall(distance_upcall, cb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returncode_t ret; | |
ret = libtock_distance_set_upcall(distance_upcall, cb); | |
returncode_t ret = libtock_distance_set_upcall(distance_upcall, cb); |
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.c
libtock_sync/sensors/distance.h
libtock/sensors/syscalls/distance_syscalls.c
libtock/sensors/syscalls/distance_syscalls.h
libtock/sensors/distance.c
libtock/sensors/distance.h
File modified:
examples/sensors/main.c