-Added void display_d(dfunc_t dfunc) which is a variant of the display() that calls a user function after each row
-changed private data to protected to more easily derive and modify.
To help users getting started less painful. You find 1000 pics of arduino UNOs connected at pins A4, A5 to the display but it doesn't work on your MEGA 2560 because there it's the pins 20, 21 that are used for I2C. You don't necessarily know that already at the moment you start with these displays. And you maybe do not search in the Wire-library for the solution.
At least some of the SSD1309 displays can work with this library if SPI_MODE0 is changed to SPI_MODE3.
Instead of allowing the main constructor to do this, we pulled the spiSettings member out to be protected instead of private. This allows us to create a smple subclass of this code base to run on these displays. With this I have a version of the ssd1306_128x64_spi sketch that has the subclass code:
```
class Adafruit_SSD1309_SPI : public Adafruit_SSD1306 {
public:
Adafruit_SSD1309_SPI(uint8_t w, uint8_t h, SPIClass *spi,
int8_t dc_pin, int8_t rst_pin, int8_t cs_pin, uint32_t bitrate=8000000UL) :
Adafruit_SSD1306(w, h, spi, dc_pin, rst_pin, cs_pin, bitrate) {
#ifdef SPI_HAS_TRANSACTION
spiSettings = SPISettings(bitrate, MSBFIRST, SPI_MODE3);
#endif
}
};
```
and then I used the hardware version of the constructor:
```
#define OLED_DC 6
#define OLED_CS 7
#define OLED_RESET 8
Adafruit_SSD1309_SPI display(SCREEN_WIDTH, SCREEN_HEIGHT,
&SPI, OLED_DC, OLED_RESET, OLED_CS);
```
And it now runs on this display
In begin(), there is code to compute the correct contrast value, based on the configuration of the display.
The same code also computes the comPin setting. This code has been factored so that these two values
are computed, and contrast saved in an instance variable.
Later, in dim(), the saved computed contrast value is used when un-dimming the display.