There's a point when learning things the hard way is just stupid. I think I've hit one and before I needlessly poke myself in the eye I'd like some guidance. Once caveat, this is my "for fun because I can" project. I know much of this has been done elsewhere but I'm learning.
Question 1: How much should/can one put into an object (Ardunio "module")?
Background: I'm creating a button object that will provide debounce, pin management, action, etc. My current code uses timer overflow interrupt. The app guy in me says that the timer and interrupt code goes in the class. The system guy in me says that will hide critical information.
Question 2: How evil is it to rely on interrupts to allow "background" processing?
Background: My button timer is set for a long cycle (5ms) to reduce the impact to processing. the nice thing about this is that I can use the 5ms to do quite a bit of work. In an effort to reduce the impact of the ISR I'm toggling some volatiles that are accessed in main to actually execute the button action. App guy wants to use a second ISR to manage button action. System guy is all "WTF are you trying to do, spend all your time processing ISR?"
Question 3: If a project is heavy on interrupts is it best to separate the interrupt driven components to a dedicated sub-module and use i2c/spi to communicate user input to the main logic?
Background: 20+ buttons with possible multiple user inputs while managing serial (rs232/usb) comm, i2c, calculations and some IO storage. It might make sense to use a attiny23xx or another atmega328 just for user interface leaving the core processing to the main atmega328.
I'm posting this in the avr gcc forum as the answer to the first question would seem to be related to gcc capabilities (I assume my Linux version may be different than the official WinAVR version. If gcc impacts the first answer then I expect it would impact the latter questions as well. If I posted in the wrong location, my apologies. Please relocate as necessary.