one .h (library) for AVR/Tiny ?

i have library using Wire.h, but for ATTiny i have to use TinyWireM.h, and a bit different function names..

i can fix this with #ifdef, but i don't know what exactly is defined for Tiny and for AVR to separate code. there should be something for that, but what?..

any ideas?

any ideas?

I don't even have any idea what you are talking about. It sounds like you are trying to create a sketch for some non-Arduino device that can also be used on some other device (Arduino or not isn't stated).

i have OLED display, and library for it. i've using this display with Arduino and with ATTiny85. but there is no Wire.h library for ATTiny, but TinyWireM.h.

now i make to different libs OLED.h/cpp and tinyOLED.h/cpp

but i want something like


include TinyWireM.h


include Wire.h


and i need this variable which compiler uses for ATTiny and for Arduino...

So, look at how Arduino.h manages that.

#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
#define DEFAULT 0
#define EXTERNAL 1
#define INTERNAL 2
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
#define INTERNAL1V1 2
#define INTERNAL2V56 3
#define INTERNAL 3
#define DEFAULT 1
#define EXTERNAL 0

Determining the constant that corresponds to your specific boards is left as an exercise for you. The last 5 lines in Arduino.h bear looking at.