mbr / gpio-rs

Rust GPIO library supporting bare metal and Linux.
MIT License
20 stars 3 forks source link

Speed up pin manipulation #1

Closed polyfloyd closed 6 years ago

polyfloyd commented 7 years ago

By storing the pin state in userspace, a syscall can be avoided if the requested state is equal to the current state.

In a real world application like ledcat, this leads to a speed increase of about 400%.

polyfloyd commented 7 years ago

ping @mbr

mbr commented 7 years ago

This may be an issue if the GPIO is shared - we do not have exclusive access to the PIN, as far as I know. Granted, it's a bad idea to given two programs control over it, I want to raise that concern nonetheless.

Additionally, sorry for the delay. =)

polyfloyd commented 7 years ago

Ah yes, that's not something I took into consideration.

Would documenting this new behaviour be sufficient? Two programs manipulating the same pin at once seems very uncommon to me.

mbr commented 6 years ago

With the new API changes coming up, this cannot be merged unfortunately. Sorry.

polyfloyd commented 6 years ago

Hi @mbr, are you still interested in these changes? I can create a new implementation if desired.