Best practices? #248
Replies: 1 comment 2 replies
-
Your questions are a little like asking "how long is a string?" :) The ancient AVR macros to read/write GPIO pins should work if you want real bare-metal I/O. I'd suggest first doing a single Interrupts in the Arduino API are very limited and can't do what you're trying to do (there is no passed-in parameter). If you look at Good luck! |
Beta Was this translation helpful? Give feedback.
-
By way of background, I've done Arduino on AVR for a number of years. I'm hardly an expert, but competent and used off-the-shelf boards and custom ones of my own design.
My question is around best practices for pin interrupts and efficient digital IO. With some cores, getting closer to the hardware via direct register access is sometimes essential for sufficient throughput.
I've done experimentation with this core and an RPi Pico and loving it. Got a couple of custom boards as add-ons as well as a standalone RP2040 board and am excited.
So, are digitalRead/digitalWrite considered good enough for most cases? What are the situations where you might want to go quicker?
I use attachInterrupt and it works fine so far, but I need to attach an interrupt to each pin I'm using. Is it possible/recommended to have a single interrupt and have it work out which pin and which trigger (eg: rising or falling) within the ISR?
PS: FYI here one of my custom boards that has an onboard level shifter for connecting to 5V systems
![IMG_6103](https://user-images.githubusercontent.com/54263749/125559884-59ea130d-21a9-4a59-87f9-401a374b2419.jpeg)
Beta Was this translation helpful? Give feedback.
All reactions