Open medakk opened 2 years ago
I've tested the changes on raspbian 10
@medakk Thanks, this looks great! One small nitpick before I merge it: Instead of returning the microsecond value directly from the Linux kernel, I would like it to be an instance of std::time::Duration
constructed with std::time::Duration::from_micros()
.
The reason for this is that I'd like to use a type that's name describes what it is (I believe this is important for measurement units, such as time). The precision of microseconds is somewhat arbitrary, and in the future it might be possible some other device supports nanoseconds (although the usefulness of that might be questionable). Although this does increase the size of Event
, it should be acceptable since typically after events are created, they are matched on immediately.
I'm also thinking maybe the event should be called Uptime
rather than Timestamp
, since usually timestamps are associated with other events.
BTW I'm hoping I can fix #38 today, which should make it possible to start looking into #39 again.
@medakk Actually, scratch that. I'm planning on merging code that changes a lot of the organization of code in the repository today, so I'll just merge this when I do and make the necessary changes to avoid a mess of merging.
Thanks @AldaronLau ! yes std::time::Duration
makes more sense here!
Regarding #39 , with this PR (#40) and the WIP PR #38, I am able to use my joycons' accelerometer. I'm just not sure what the scale is, but admittedly I haven't dug into it too much since its fine for my current project
Adds handling for timestamp events on linux. These events are sent by Nintendo joycons(I'm not aware of any other controller that sends this information) As I understand this can be used to correlate timing with gyro/accelerometer readings sent. (See here )
Here's the relevant part of the event code documentation
Also: I'm not sure whats the from_id and to_id stuff and just added the next number in the series.