I am working on a (yet another...) pin change interrupt library. It underlies an encoder library that will allow connections on ANY pin, even when they map to two different ports...
I do a lot of work with smaller cpu - e.g. tiny25/45/85, 24/44/84 etc. The goal is to have the code compile on ALL variants I use. It currently works fine for UNO abd MEGA2560, but I know I'm going to need some #ifdef to get it working across the board.
I have the tiny IDE addons that has boards.txt and variants for "tiny8" and "tiny14"
For example, tiny8s only use one pinchange interrupt, so i'd like to #ifdef out the PCINT1_vect and PCINT2_vect handlers for efficiency...also I'd like to set constants for the different number of allowable PCINT -> digital pin mappings, e.g. 20 on the UNO but only 16 on the MEGA and 4 on a tiny85 (and/or use different names and correct lack of NUM_DIGITAL_PINS definition etc)
I know I could say #ifdef attiny25 || attiny45 || attiny85 (or similar) but i'd rather say #ifdef tiny8... #ifdef tiny14 etc
- is there any way to get hold of the current variant at compile time? And whats the BEST way to determine processor, processor family @ compile time?