1 Commits
Author SHA1 Message Date
Kurt Eckhardt d1bcc4ff9b Allow a sketch to sub-class the SSD1306 object and change SPI settings
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
2020-02-16 15:07:32 -08:00