heretop wrote: ↑Fri Jul 02, 2021 4:41 pm
I have the 2.0.0 working with changing all PAXX to PA_XX !!!!
Code: Select all
#define TFT_CS PA_4//8
#define TFT_DC PB_1//9
#define TFT_RST PB_0//10
#define TFT_MOSI PA_7//PB15//11
#define TFT_SCLK PA_5//PB13//13
SPIClass SPI_1(PA_7, PA_6, PA_5);
//SPIClass SPI_2(PB15, PB14, PB13);
//Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
Adafruit_ST7789 tft = Adafruit_ST7789(&SPI_1, TFT_CS, TFT_DC, TFT_RST);
OK let analyze PinName (PY_n) and pin number (PYn):
with PortA equal to 0. So PA_0 is 4 and PA4 is 4 because in case of this variant pin number are defined ordered so those value are the same.
PB_0 = (PortB << 4) + 0x00,
with PortB equal to 1. So PB_0 is equal to 16. PB0 is defined a 16, etc.
But PB11 is not defined as it is not available. In this case PB12 is 27 while PB_12 is 28...
It seems you try to change or redefine the SPI instance. By default 1 SPI class is instantiated named SPI and uses thoses pins:
https://github.com/stm32duino/Arduino_C ... #L104-L112
Code: Select all
#ifndef PIN_SPI_MOSI
#define PIN_SPI_MOSI PA7
#endif
#ifndef PIN_SPI_MISO
#define PIN_SPI_MISO PA6
#endif
#ifndef PIN_SPI_SCK
#define PIN_SPI_SCK PA5
#endif
So you do this
This is useless as SPI instance already exists using those pins. It works because pin name as the same value than the pin number.
It seems you try to bring complexity where there is no need.
As stated before simply use the default example and it works with the default SPI instance.
Code: Select all
#define TFT_CS PA4
#define TFT_DC PB1
#define TFT_RST PB0
#define TFT_MOSI PA7
#define TFT_SCLK PA5
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
[/quote]