adafruit / Adafruit-SSD1331-OLED-Driver-Library-for-Arduino

For 0.96" OLEDs in the Adafruit shop
http://www.adafruit.com/products/684
Other
100 stars 67 forks source link

Added support for ESP8266 #6

Closed PontusO closed 6 years ago

PontusO commented 8 years ago

This pull request adds basic support for the ESP8266 from a hardware perspective. It encloses all necessary hardware calls with an #if directive and handles the ESP8266 separatly. I have tested the code on both esp8266 systems and standard Arduino compatible hardware.

mike-rankin commented 8 years ago

I see multiple errors using your new SSD1331 code on a Generic ESP8266 using the latest 1.6.11 IDE.

PontusO commented 8 years ago

Mike, that is interesting, I am not even seeing any warnings, neither on esp8266 or Arduino. I am seeing a lot of warnings in Adafruit_GFX though.

Can you send me a list so I can have a look at it.

PontusO commented 8 years ago

I just realized that you might mean errors on the display.... Yeah, I just realized that it doesn't support bit banged SPI. I'll fix that.

PontusO commented 8 years ago

Added support for bit banged SPI for the ESP8266 now. Tests OK on both ESP8266 and Arduino.

mike-rankin commented 8 years ago

Error on my end. It works perfectly! I'm using the Hazzah and a 0.96" Color display. Great work!

michalsok commented 7 years ago

Hi. How did you manage to compile? I first defined the pins as D2, D5 etc since the pure numbers don't map properly. Then after failed compile as bellow I changed the pin definitions to numbers as bellow: // You can use any (4 or) 5 pins

define sclk 14

define mosi 13

define cs 15

define rst 5

define dc 4

I also tried option 1 and 2 (hardware SPI) but both fail the same way.

I am having the following compile error:

`Arduino: 1.6.13 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)" C:\Users\Mike\Documents\Arduino\libraries\Adafruit_SSD1331\Adafruit_SSD1331.cpp: In member function 'void Adafruit_SSD1331::begin()': C:\Users\Mike\Documents\Arduino\libraries\Adafruit_SSD1331\Adafruit_SSD1331.cpp:289:21: error: cannot convert 'volatile uint32_t {aka volatile unsigned int}' to 'PortReg {aka volatile unsigned char}' in assignment sclkportreg = portOutputRegister(digitalPinToPort(_sclk)); ^ C:\Users\Mike\Documents\Arduino\libraries\Adafruit_SSD1331\Adafruit_SSD1331.cpp:293:20: error: cannot convert 'volatile uint32_t {aka volatile unsigned int}' to 'PortReg {aka volatile unsigned char}' in assignment sidportreg = portOutputRegister(digitalPinToPort(_sid)); ^ C:\Users\Mike\Documents\Arduino\libraries\Adafruit_SSD1331\Adafruit_SSD1331.cpp:305:15: error: cannot convert 'volatile uint32_t {aka volatile unsigned int}' to 'PortReg {aka volatile unsigned char}' in assignment csportreg = portOutputRegister(digitalPinToPort(_cs)); ^ C:\Users\Mike\Documents\Arduino\libraries\Adafruit_SSD1331\Adafruit_SSD1331.cpp:308:15: error: cannot convert 'volatile uint32_t {aka volatile unsigned int}' to 'PortReg {aka volatile unsigned char}' in assignment rsportreg = portOutputRegister(digitalPinToPort(_rs)); ^ exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. `

PontusO commented 7 years ago

Those errors look like you didn't apply the pull request properly. How did you merge it ?

scotthorn commented 7 years ago

Used @PontusO 's fork on the library to successfully work with my huzzah feather esp8266, in both hardware and non-hardware modes. Thanks, PontusO!

anthonykeane commented 7 years ago

@michalsok Did you get this resolved? I am having this exact error.

PontusO commented 7 years ago

Did you clone my fork or did you apply the patch in some other way. It looks like you don't have my changes.

/P

adavidzh commented 6 years ago

Hey @ladyada, any chance this will ever be merged? It's pretty nifty!

ladyada commented 6 years ago

hiya - we did a restructure to use Adafruit_SPITFT in the 'spitft' branch. that should 1) solve any current/future compatibility problems 2) speed things up A TON

could you please try it? if it works for one other person we'll merge it mainline and ESP8266/ESP32 will Just Work :)

adavidzh commented 6 years ago

could you please try [the 'spift' branch]?

I took the test sketch for a ride in Option 1: use any pins mode on my ESP8266:

ladyada commented 6 years ago

it should be way faster, yeah if you can put a PR for a delay(10) maybe after each line test (there's four) then i'm happy to merge that and then merge spitft into master and BE DONE WITH BITBANG NOODLING

adavidzh commented 6 years ago

I have more news with Option 2: must use the hardware SPI pins:

16 submitted with delay(0); for snag minimization (sorry for the ugly diff 😕).

ladyada commented 6 years ago

completely restructured. check latest code!