4 ms·
Exactly, this is a lot for something rarely going wrong,.and if going wrong pretty apparent what's wrong.. Also, that approach would need quite some extension
by throwbadubadu 3y ago
Exactly, this is a lot for something rarely going wrong,.and if going wrong pretty apparent what's wrong..
Also, that approach would need quite some extension for modern capabilities of pins and conflicting options across multiple registers (pin dir, pin mux and what else driver options)..
Also what about those pins you really need to be use in both directions (e.g. one wire protocol, or pins where you have your own mux behind), how to do that? The current approach does not look like supporting switching at runtime.. another complexity level added..
- morelisp 3y agoSwitching the pin mode should be exactly what Rust is offering over potentially more advanced C++ solutions, because you can take a "raw" pin as an input pin and ensure you don't use it as an output pin for exactly the duration you have it as an input pin.
- pjmlp 3y agoSame thing in C++, when one actually uses the C++ type system. Rust can be made as unsafe as the C example, by calling digitalWrite() directly, instead of using the language type system.