stevstrong / adafruit_tftlcd_8bit_stm32 Goto Github PK
View Code? Open in Web Editor NEWAdafruit TFT library using 8 bit parallel access ported to STM32
Adafruit TFT library using 8 bit parallel access ported to STM32
Not everyone has libmaple. You need to let people know the dependencies before they waste their time downloading it
will it work for nokia 6300 lcd http://andybrown.me.uk/2012/06/05/nokia-lcd-for-arduino-mega-1/
Hello,
what do you think about porting of Adafruit_TFTLCD_8bit_STM32
for libopencm3 ?
I tried running on generic STM32F103C8T6 (blue pill) but had to run in slow mode, fast mode produced no output. Since the my board uses PB2 on one of the jumpers and won't boot unless it's grounded, I had to use GPIOA for dataregs and GPIOB for cntrlregs. I changed all the digitalWrite commands from PBx to PAx
don't think there's anything else I need to change.
Any ideas or suggestions for isolating the problem?
Hello,
The display works fine on the Arduino Mega2560, but I'm trying to adapt a project that uses this library Adafruit_TFTLCD_8bit_STM32.
The library on my display is this:
https://github.com/prenticedavid/MCUFRIEND_kbv
The project that uses the Adafruit_TFTLCD_8bit_STM32 library is this:
(An open source firmware for DSO-138 Oscilloscope)
https://github.com/ardyesp/DLO-138
Thank you!
Dear Sir
Thanks for the lib.
It seems that the library (even when it set to - #define TFT_DATA_LOW_NIBBLE 1) does affect all GPIOA ports, I use PA14, PA15 to control relays and I see that with no action at all sometimes they change to HIGH mode and cannot be changed to LOW even when I run command digitalWrite(PA14,LOW) they do stay on high mode (I don’t have anything else in my code that address those pins but the relay switch code).
Also checked with GPIO PA10, PA11,PA12 and it has the same problem...
I think that something is wrong with this code:
#define write8(c) { uint32_t val = (((c^0x00FF)<<16) | c)<<TFT_DATA_SHIFT; \
dataRegs->BSRR = val; WR_STROBE; }
If I change the pins from PA to PB (pins) or PC (pins) everything works well.
I don’t know what to look in your library that can affect those pins…
This Is a part from the H file.
#define TFT_DATA_PORT GPIOA
// Port data bits D0..D7:
// enable only one from below lines corresponding to your HW setup:
#define TFT_DATA_LOW_NIBBLE 1 // take the lower 8 bits: 0..7
//#define TFT_DATA_HIGH_NIBBLE 1 // take the higher 8 bits: 8..15
//Control pins |RD |WR |RS |CS |RST|
#define TFT_CNTRL_PORT GPIOB
#define TFT_RD PB4
#define TFT_WR PB5
#define TFT_RS PB10
#define TFT_CS PB11
#define TFT_RST PB3 //PB0
#define TFT_RD_MASK BIT4 // digitalPinToBitMask(TFT_RD) //
#define TFT_WR_MASK BIT5 // digitalPinToBitMask(TFT_WR) //
#define TFT_RS_MASK BIT10 // digitalPinToBitMask(TFT_RS) //
#define TFT_CS_MASK BIT11 // digitalPinToBitMask(TFT_CS) //
#if 0
// use old definition, standard bit toggling, low speed
#define RD_ACTIVE digitalWrite(TFT_RD, LOW)
#define RD_IDLE digitalWrite(TFT_RD, HIGH)
#define WR_ACTIVE digitalWrite(TFT_WR, LOW)
#define WR_IDLE digitalWrite(TFT_WR, HIGH)
#define CD_COMMAND digitalWrite(TFT_RS, LOW)
#define CD_DATA digitalWrite(TFT_RS, HIGH)
#define CS_ACTIVE digitalWrite(TFT_CS, LOW)
#define CS_IDLE digitalWrite(TFT_CS, HIGH)
#define CS_ACTIVE_CD_COMMAND { CS_ACTIVE; CD_COMMAND; }
#else
// use fast bit toggling, very fast speed!
extern gpio_reg_map * cntrlRegs;
#define RD_ACTIVE { cntrlRegs->BRR = TFT_RD_MASK; }
#define RD_IDLE { cntrlRegs->BSRR = TFT_RD_MASK; }
#define WR_ACTIVE { cntrlRegs->BRR = TFT_WR_MASK; }
#define WR_IDLE { cntrlRegs->BSRR = TFT_WR_MASK; }
#define CD_COMMAND { cntrlRegs->BRR = TFT_RS_MASK; }
#define CD_DATA { cntrlRegs->BSRR = TFT_RS_MASK; }
#define CS_ACTIVE { cntrlRegs->BRR = TFT_CS_MASK; }
#define CS_IDLE { cntrlRegs->BSRR = TFT_CS_MASK; }
#define CS_ACTIVE_CD_COMMAND { cntrlRegs->BRR = (TFT_CS_MASK|TFT_RS_MASK); }
#endif
#define WR_STROBE { WR_ACTIVE; WR_IDLE; }
extern uint8_t read8_(void);
#define read8(x) ( x = read8_() )
extern gpio_reg_map * dataRegs;
#if defined(TFT_DATA_LOW_NIBBLE)
//#warning "Using lower data nibble..."
// set the pins to input mode
#define setReadDir() ( dataRegs->CRL = 0x88888888 ) // set the lower 8 bits as input
// #define setReadDir() ( dataRegs->CRL = 0x44444444 ) // set the lower 8 bits as input floating
// set the pins to output mode
#define setWriteDir() ( dataRegs->CRL = 0x33333333 ) // set the lower 8 bits as output
#define TFT_DATA_SHIFT 0
#elif defined(TFT_DATA_HIGH_NIBBLE)
#warning "Using high data nibble..."
// set the pins to input mode
#define setReadDir() ( dataRegs->CRH = 0x88888888 ) // set the upper 8 bits as input
// set the pins to output mode
#define setWriteDir() ( dataRegs->CRH = 0x33333333 ) // set the lower 8 bits as output
#define TFT_DATA_SHIFT 8
#endif
// set pins to output the 8 bit value
#if 0 // slow write
#define write8(c) { Serial.print(" write8: "); Serial.print(c,HEX); Serial.write(','); \
digitalWrite(PA0, (c&BIT0)?HIGH:LOW); \
digitalWrite(PA1, (c&BIT1)?HIGH:LOW); \
digitalWrite(PA2, (c&BIT2)?HIGH:LOW); \
digitalWrite(PA3, (c&BIT3)?HIGH:LOW); \
digitalWrite(PA4, (c&BIT4)?HIGH:LOW); \
digitalWrite(PA5, (c&BIT5)?HIGH:LOW); \
digitalWrite(PA6, (c&BIT6)?HIGH:LOW); \
digitalWrite(PA7, (c&BIT7)?HIGH:LOW); \
WR_STROBE; }
#else
**_#define write8(c) { uint32_t val = (((c^0x00FF)<<16) | c)<<TFT_DATA_SHIFT; \
/*Serial.print(" write8: "); Serial.print(val,HEX); Serial.write(',');*/ \
dataRegs->BSRR = val; WR_STROBE; }_**
#endif
Hi,
I have problems with this library.
Reset works, and read id as well, but I am not sure if correctly.
But, then, after readid, begin() does not work. Nor anything else.
I have a blue pill board.
My LCD is this: http://www.elecfreaks.com/wiki/index.php?title=2.4%22_TFT_LCD:_TFT01-2.4
The version I have is the ili9325
Your library reports mine as ili9328. I do not know why. But, at least, it does, and I guess that wiring is okey (because reset() and readid() works).
But then comes begin(). It does not work. And after begin, anything I try fails. For example, readID() fails after begin() (still if it worked after reset).
And, I am not sure if the library reporting ili9328 (and not ili9325) is okey.
Do you have some ideas about what is happening? Could you assist me a bit to do some more steps? I do not know what else to try.
I tested all the examples. Following the code I see that just reset() and readID() work.
Thanks in advance.
Hello there,
I have 3 questions.
If I enable TFT_DATA_SHIFT 8 then as mentioned to the readme file pX8-px15. What is the X means? Both PA and PB can be used? I am using TFT_DATA_SHIFT 8 and pin started from PB8-PB15.
where RST(Lcd ) pin will go? connected to Reset pin of stm32 blue pill.
-Erfan
So I bought a board like this (https://www.ebay.de/itm/2-4-TFT-LCD-Display-Shield-Touch-Panel-ILI9341-240X320-for-Arduino-UNO-MEGA/192163706724?epid=7008035186&hash=item2cbdd97764:g:PDoAAOSwRUhY-IYe), sold as an ILI9341.
The ID is read out as "3838" (unknown). Turns out I can drive it by using tft.begin (0x8357). However, everything is mirrored, then. I can "fix" the mirroring using the patch, below, but obviously, it would be better if this would be handled by a #define, and best, if it was detected, automatically. Any further info I can provide to help?
diff --git a/Adafruit_TFTLCD_8bit_STM32.cpp b/Adafruit_TFTLCD_8bit_STM32.cpp
index 3bcf96e..44d1de9 100644
--- a/Adafruit_TFTLCD_8bit_STM32.cpp
+++ b/Adafruit_TFTLCD_8bit_STM32.cpp
@@ -412,17 +412,17 @@ void Adafruit_TFTLCD_8bit_STM32::setRotation(uint8_t x)
switch (rotation) {
case 1:
- t = HX8357B_MADCTL_MY | HX8357B_MADCTL_MV | HX8357B_MADCTL_RGB;
+ t = HX8357B_MADCTL_MV | HX8357B_MADCTL_RGB;
break;
case 2:
- t = HX8357B_MADCTL_RGB;
+ t = HX8357B_MADCTL_MX | HX8357B_MADCTL_RGB;
break;
case 3:
- t = HX8357B_MADCTL_MX | HX8357B_MADCTL_MV | HX8357B_MADCTL_RGB;
+ t = HX8357B_MADCTL_MY | HX8357B_MADCTL_MX | HX8357B_MADCTL_MV | HX8357B_MADCTL_RGB;
break;
case 0:
default:
- t = HX8357B_MADCTL_MX | HX8357B_MADCTL_MY | HX8357B_MADCTL_RGB;
+ t = HX8357B_MADCTL_MY | HX8357B_MADCTL_RGB;
break;
}
writeRegister8(ILI9341_MADCTL, t ); // MADCTL
Most examples #include <Adafruit_GFX.h>, while Adafruit_TFTLCD_8bit_STM32.h has #include <Adafruit_GFX_AS.h>. This results in "multiple definition" errors while compiling.
Adafruit_TFTLCD_8bit_STM32.h should either #include <Adafruit_GFX.h>, instead of <Adafruit_GFX_AS.h>, or the examples should omit the #include <Adafruit_GFX.h> line, or both.
I change the tftBMP example's library to this:
#include <Adafruit_TFTLCD_8bit_STM32.h> // Hardware-specific library
and define pins and... but when I complie it I have this error:
`
Arduino: 1.8.3 (Windows 10), Board: "Generic STM32F103C series, STM32F103C8 (20k RAM. 64k Flash),STLink, 72Mhz (Normal)"
C:\Users\Mohammad\Documents\Arduino\LCDBMPTest\LCDBMPTest.ino: In function 'void bmpDraw(char*, int, int)':
LCDBMPTest:220: error: 'class Adafruit_TFTLCD_8bit_STM32' has no member named 'color565'
lcdbuffer[lcdidx++] = tft.color565(r,g,b);
^
exit status 1
'class Adafruit_TFTLCD_8bit_STM32' has no member named 'color565'
`
My STM32 board doesn't have PB2 pin to use. How can I change the data pins definition??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.