Replies: 1 comment 2 replies
-
|
I am not entirely sure what the question is. The example code you provide is a bit garbled. But if you want to know how far you can read in the buffer then you can check your Also see this example code: https://github.com/brgl/libgpiod/blob/4254100/examples/watch_line_rising.c#L115-L126 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Can I please get some clarity on the sequence of storing events.
My understanding is, to eventually read the stored buffer I must first:
initialising buffer to a MAX_BUFFER == 20 (hypothetically speaking)
gpiod_edge_event_buffer *buffer = gpiod_edge_event_buffer_new(MAX_BUFFER);
initialise a line to get inputs...
struct (properly intialised input line with edge detection for both) *line...
wait for an event...
gpiod_line_request_wait_Edge_Events(*gpiod_line, nsec);
read that event...
int read = gpiod_line_request_read_edge_events(line -> gpiod_line_request...);
store the event when detected into the initialised buffer..
struct gpiod_edge_event *event = gpiod_edge_event_buffer_get_event(buffer, index);
from here I can access the variables of event...
like uint64_t timestamps
enum gpiod_edge_event_type
etc...
Say index ++ if index < 10...
My question is
I seem to be able to read index from a buffer manually, but looping through it i get an Assertion failed.
Beta Was this translation helpful? Give feedback.
All reactions