Forum: Projekte & Code Arduino_IDE mit ESP8266 und Ucglib unter Win7-64bit


von e-d (Gast)


Angehängte Dateien:

Lesenswert?

Dies beschreibt die Einrichtung der Ucglib, einer Linux-Lib. auf einer 
bereits für ESP8266 konfig. Arduino-IDE.
Windows-User haben das Problem, die *.zip Datei zum Einbinden über
"sketch -->  include Library" erst mit z.B. "Cygwin" in
C:\Users\ich\Downloads\ucglib-master\ucglib\tools\release\arduino
bilden zu müssen.
Es geht aber auch ohne Cygwin:
- https://github.com/spapadim/ucglib download und entpacken;
- in C:\Users\ich\Downloads\ucglib-master\ucglib\tools\release\arduino
   die ucglib_arduino_v1.3.zip reinkopieren;
- über "sketch -->  include Library" die Lib. zugänglich machen;
-  line (777 in Ucglib.cpp)  in 
"C:\Users\ich\Documents\Arduino\libraries\Ucglib"
    #if defined(__PIC32MX) || defined(_arm_) || defined(_XTENSA_)
  abändern;
- line61  in "C:\Users\ich\Documents\Arduino\libraries\Ucglib" in
  #include 
"C:\Users\ich\Documents\Arduino\libraries\Ucglib\utility\ucg.h"
  abändern;

- Arduino-IDE neustarten und Example unter "Beispiele-Ucglib" 
ausprobieren;

Durch auskommentieren werden die entsprechenden (z.B.: HWSPI ucg für 
ESP8266)


//Ucglib8BitPortD ucg(ucg_dev_ili9325_18x240x320_itdb02, 
ucg_ext_ili9325_18, /* wr= */ 18 , /* cd= */ 19 , /* cs= */ 17, /* 
reset= */ 16 );
//Ucglib8Bit ucg(ucg_dev_ili9325_18x240x320_itdb02, ucg_ext_ili9325_18, 
0, 1, 2, 3, 4, 5, 6, 7, /* wr= */ 18 , /* cd= */ 19 , /* cs= */ 17, /* 
reset= */ 16 );

//Ucglib4WireSWSPI ucg(ucg_dev_ili9325_18x240x320_itdb02, 
ucg_ext_ili9325_18, /*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, 
/*reset=*/ 8);  // not working
//Ucglib4WireSWSPI ucg(ucg_dev_ili9325_spi_18x240x320, 
ucg_ext_ili9325_spi_18, /*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 
10, /*reset=*/ 8);  // not working
//Ucglib3WireILI9325SWSPI ucg(ucg_dev_ili9325_spi_18x240x320, 
ucg_ext_ili9325_spi_18, /*sclk=*/ 13, /*data=*/ 11, /*cs=*/ 10, 
/*reset=*/ 8);  // not working
//Ucglib3WireILI9325SWSPI ucg(ucg_dev_ili9325_18x240x320_itdb02, 
ucg_ext_ili9325_18, /*sclk=*/ 13, /*data=*/ 11, /*cs=*/ 10, /*reset=*/ 
8);  // not working

//Ucglib_ST7735_18x128x160_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 
9 , /*cs=*/ 10, /*reset=*/ 8);
Ucglib_ST7735_18x128x160_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 
8);

//Ucglib_ILI9163_18x128x128_SWSPI ucg(/*sclk=*/ 7, /*data=*/ 6, /*cd=*/ 
5 , /*cs=*/ 3, /*reset=*/ 4);
//Ucglib_ILI9163_18x128x128_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 
8);  /* HW SPI Adapter */

//Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 7, /*data=*/ 6, /*cd=*/ 
5 , /*cs=*/ 3, /*reset=*/ 4);
//Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, 
/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 
8);
//Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 4, /*data=*/ 3, /*cd=*/ 
6 , /*cs=*/ 7, /*reset=*/ 5);  /* Elec Freaks Shield */

//Ucglib_SSD1351_18x128x128_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, 
/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1351_18x128x128_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 
8);
//Ucglib_SSD1351_18x128x128_FT_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, 
/*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1351_18x128x128_FT_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, 
/*reset=*/ 8);

//Ucglib_PCF8833_16x132x132_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, 
/*cs=*/ 9, /*reset=*/ 8);  /* linksprite board */
//Ucglib_PCF8833_16x132x132_HWSPI ucg(/*cs=*/ 9, /*reset=*/ 8);  /* 
linksprite board */

//Ucglib_LD50T6160_18x160x128_6Bit ucg( /*d0 =*/ d0, /*d1 =*/ d1, /*d2 
=*/ d2, /*d3 =*/ d3, /*d4 =*/ d4, /*d5 =*/ d5, /*wr=*/ wr, /*cd=*/ cd, 
/*cs=*/ cs, /*reset=*/ reset);
//Ucglib_LD50T6160_18x160x128_6Bit ucg( /*d0 =*/ 16, /*d1 =*/ 17, /*d2 
=*/ 18, /*d3 =*/ 19, /*d4 =*/ 20, /*d5 =*/ 21, /*wr=*/ 14, /*cd=*/ 15); 
/* Samsung 160x128 OLED with 6Bit minimal interface with Due */
//Ucglib_LD50T6160_18x160x128_6Bit ucg( /*d0 =*/ 5, /*d1 =*/ 4, /*d2 =*/ 
3, /*d3 =*/ 2, /*d4 =*/ 1, /*d5 =*/ 0, /*wr=*/ 7, /*cd=*/ 6); /* Samsung 
160x128 OLED with 6Bit minimal interface with Uno */

//Ucglib_SSD1331_18x96x64_UNIVISION_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 
11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SSD1331_18x96x64_UNIVISION_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, 
/*reset=*/ 8);

//Ucglib_SEPS225_16x128x128_UNIVISION_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 
11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
//Ucglib_SEPS225_16x128x128_UNIVISION_HWSPI ucg(/*cd=*/ 9 , /*cs=*/ 10, 
/*reset=*/ 8);

ausgewählt;

For wiring, I'll describe what's in front of me. The order below is 
always

Display -> ESP

First, we have the shared SPI bus pins; these are hardware SPI and you 
must use the same pins on the ESP8266.

SDO(MISO) -> MISO (GPIO12)
SDI(MOSI) -> MOSI (GPIO13)
SCK -> SCLK (GPIO14)

If you have/use the touchscreen, you also must connect the touch driver 
to the same SPI bus pins:

T_DO -> MISO (GPIO12)
T_DIN -> MOSI (GPIO13)
T_CLK -> SCLK (GPIO14)

The rest of the pins are my (arbitrary) choices -- the only restriction 
is that T_IRQ cannot use GPIO16 if you plan to use ISRs for touch 
(because that pin doesn't support interrupts), otherwise you can choose 
as you wish. My library does not register an ISR, though.

For the TFT driver (ILI9341):

D/C -> GPIO2
CS -> GPIO4
RESET -> GPIO5

If you use those, then you can instantiate Ucglib with (you'll have to 
add it to the Ucglib examples; in the XPT2046 library examples, it's 
already there):
Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 2 , /*cs=*/ 4, /*reset=*/ 
5);

For the touch driver:

T_CS -> GPIO16 (aka XPD ?)
T_IRQ -> GPIO0 (must disconnect every time you reflash!!)

If you use those, you can initalize my library with
XPT2046 touch(/*cs=*/ 16, /*irq=*/ 0);
In retrospect, GPIO0 was less than ideal for T_IRQ (but I had hooked up 
everything else when I got to touch, and I'm ashamed to say I've been 
too lazy to swap :) ): T_IRQ has a 10K pullup, and GPIO0 needs to be low 
on powerup to reflash, so on my ESP board I have to disconnect either 
T_IRQ or the display module's power.

Finally, don't forget the power pins:

VCC -> 3.3V
LED -> 3.3V
GND -> GND

* aus:
http://www.esp8266.com/viewtopic.php?f=32&t=5560&start=8

von e-d (Gast)


Lesenswert?

e-d schrieb:
> - line61  in "C:\Users\ich\Documents\Arduino\libraries\Ucglib" in
>   #include
> "C:\Users\ich\Documents\Arduino\libraries\Ucglib\utility\ucg.h"
>   abändern;

in der Ucglib.h ;

von e-d (Gast)


Lesenswert?

Touch wird direkt als .zip importiert:
https://github.com/spapadim/XPT2046

von e-d (Gast)


Angehängte Dateien:

Lesenswert?

Hier eine ältere Anwendung der Ucglib mit SPI-Display und ESP07.
http://www.esp8266.com/viewtopic.php?f=29&t=6069&start=8#p32124

von chris_ (Gast)


Lesenswert?

Hallo e-d,

bei solchen Threads könntest zuerst eine Kurzbeschreibung vorne 
anstellen. Ich wusste nicht was eine UGC-Lib ist:

"Color graphics library for embedded systems with focus on Arduino 
Environment."

von e-d (Gast)


Lesenswert?

"Was denn, kein Kaugummi..  ?"  :-)

s.a.:
Beitrag "Re: ST-Discovery-Net-IO Anfang"

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.