I am having a problem getting my Arduino Micro Pro to work with an OLED screen.
I am using this library
https://github.com/wonho-maker/Adafruit_SH1106
I am using hardware SPI
Everything works fine if I use the pins specified in the example…
#define OLED_DC 6
#define OLED_CS 7
#define OLED_RESET 8
Unfortunately I am already using these pins for something else…and specifically the interrupt functionality on these pins so I cannot change them. The only pins that are spare on my board are the Analogue pins A0-A4.
If I use…
#define OLED_DC 18
#define OLED_CS 19
#define OLED_RESET 20
…which supposedly maps to the analogue pins it doesnt work.
When I looked into the library code I noticed that for speed digitalWrite() is not used to toggle the pins. Instead the ports are accessed directly like this…
csport = portOutputRegister(digitalPinToPort(cs));
cspinmask = digitalPinToBitMask(cs);
dcport = portOutputRegister(digitalPinToPort(dc));
dcpinmask = digitalPinToBitMask(dc);
portOutputRegister(), digitalPinToPort() and digitalPinToBitMask() are arduino functions but it seems they are having trouble accessing Port F (the analogue port)
I cant see any reason why this should be a problem?
Any help greatly appreciated
Thanks
Nick