Comments (13)
Without seeing what have you changed it is hard to comment.
from adafruit_tftlcd_8bit_stm32.
OK, I'll show you my version of the .h file below:
</*****************************************************************************/
// Define pins and Output Data Registers
/*****************************************************************************/
// Data port
//#define TFT_DATA_PORT GPIOA //JCB comment
#define TFT_DATA_PORT GPIOA // jcb changed from GPIOB
// Data bits/pins
#define TFT_DATA_SHIFT 0 // take the lower bits/pins 0..7
//#define TFT_DATA_SHIFT 8 // take the higher bits/pins 8..15
//Control pins |RD |WR |RS |CS |RST|
#define TFT_CNTRL_PORT GPIOB //jcb changed form GPIOA
#define TFT_RD PB6
#define TFT_WR PB5
#define TFT_RS PB4
#define TFT_CS PB3
#define TFT_RD_MASK BIT0 // digitalPinToBitMask(TFT_RD) //
#define TFT_WR_MASK BIT1 // digitalPinToBitMask(TFT_WR) //
#define TFT_RS_MASK BIT2 // digitalPinToBitMask(TFT_RS) //
#define TFT_CS_MASK BIT3 // digitalPinToBitMask(TFT_CS) //
#define TFT_RST PB7
// CHANGED THE FOLLOWING STATMENT TO MAKE IT WORK - JCB **************************
#define SLOW_WRITE 1.... // set to 1 for legacy slow write (using individual digitalWrite()s
/*****************************************************************************/
// LCD controller chip identifiers
#define ID_932X 0
#define ID_7575 1
#define ID_9341 2
#define ID_HX8357D 3
#define ID_9338 4
#define ID_UNKNOWN 0xFF
/*****************************************************************************/
#define TFTWIDTH 240
#define TFTHEIGHT 320
// Initialization command tables for different LCD controllers
#define TFTLCD_DELAY 0xFF
// For compatibility with sketches written for older versions of library.
// Color function name was changed to 'color565' for parity with 2.2" LCD
// library.
#define Color565 color565
/*****************************************************************************/
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define RD_ACTIVE digitalWrite(TFT_RD, LOW)
#define RD_IDLE digitalWrite(TFT_RD, HIGH)
#if SLOW_WRITE
// use old definition, standard bit toggling, low speed
#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 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 (TFT_DATA_SHIFT==0)
//#warning "Using lower data nibble..."
// set the pins to input mode
#define setReadDir() ( dataRegs->CRL = 0x88888888 ) // set the lower 8 bits as input
// set the pins to output mode
#define setWriteDir() ( dataRegs->CRL = 0x33333333 ) // set the lower 8 bits as output
// set pins to output the 8 bit value
#if SLOW_WRITE
inline void write8(uint8_t c) { /*Serial.print(" write8: "); Serial.print(c,HEX); Serial.write(',');*/
// CHANGED THE NEXT SET OF STATMENTS FROM PBx TO PAx - jcb ************************
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) { dataRegs->BSRR = (uint32_t)(0x00FF0000 + ((c)&0xFF)); WR_STROBE; }
// inline void write8(uint8_t d) { dataRegs->BSRR = (uint32_t)(0x00FF0000 + d); WR_STROBE; };
#endif
#elif (TFT_DATA_SHIFT==8)
#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
// set pins to output the 8 bit value
#if SLOW_WRITE
// CHANGED THE NEXT SET OF STATMENTS TO MAKE IT WORK - from PBx TO PAx
inline void write8(uint8_t 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) { dataRegs->BSRR = (uint32_t)(0xFF000000 + (((c)&0xFF)<<TFT_DATA_SHIFT)); WR_STROBE; }
// inline void write8(uint8_t d) { dataRegs->BSRR = (uint32_t)(0x00FF0000 + d); WR_STROBE; };
#endif >
I have noted in the above fragment from the .h file the changes I've made. I made no changes whatsoever to the the #define write8(c)….. statements.
Hope this helps. Thanks.
jb
from adafruit_tftlcd_8bit_stm32.
I think you have to adapt the TFT_XY_MASK definitions to your new control pin mapping as well.
I can't remember why I commented out the digitalPinToBitMask() macro.
from adafruit_tftlcd_8bit_stm32.
Don't see "TFT_XY_MASK" anywhere in the .h file...can you point me to where the change needs to be made?
Thanks.
jb
from adafruit_tftlcd_8bit_stm32.
Come on...
#define TFT_RD_MASK BIT0 // digitalPinToBitMask(TFT_RD) //
#define TFT_WR_MASK BIT1 // digitalPinToBitMask(TFT_WR) //
#define TFT_RS_MASK BIT2 // digitalPinToBitMask(TFT_RS) //
#define TFT_CS_MASK BIT3 // digitalPinToBitMask(TFT_CS) //
The mask should indicate the bit position of the port pin.
So for PB5 the mask is BIT5, PB4 is BIT4, and so on.
from adafruit_tftlcd_8bit_stm32.
I'm not a STM32 guru like you, sorry. I was looking for literal TFT_XY_MASK; but, nevertheless, why would the bit position of these need to change, they don't seem to be register dependent. Are they display dependent?
from adafruit_tftlcd_8bit_stm32.
The #define TFT_CNTRL_PORT GPIOB was changed from GPIOA....isn't that enough?
from adafruit_tftlcd_8bit_stm32.
You don't have to be a STM32 guru to be able to determine where some defines are used in the code.
Searching for TFT_WR_MASK will lead to: https://github.com/stevstrong/Adafruit_TFTLCD_8bit_STM32/search?q=TFT_WR_MASK&unscoped_q=TFT_WR_MASK
There you see that the port register has to be written with the correct mask value for each pin. This is why is important to have the correct mask defined.
RM0008 should be your bible from now on.
from adafruit_tftlcd_8bit_stm32.
Isn't that what I did here:
//Control pins |RD |WR |RS |CS |RST|
#define TFT_CNTRL_PORT GPIOB //jcb changed form GPIOA
#define TFT_RD PB6
#define TFT_WR PB5 <<<<<<-------- CHANGED THESE!
#define TFT_RS PB4
#define TFT_CS PB3
#define TFT_RD_MASK BIT0 // digitalPinToBitMask(TFT_RD) //
#define TFT_WR_MASK BIT1 // digitalPinToBitMask(TFT_WR) //
#define TFT_RS_MASK BIT2 // digitalPinToBitMask(TFT_RS) //
#define TFT_CS_MASK BIT3 // digitalPinToBitMask(TFT_CS) //
from adafruit_tftlcd_8bit_stm32.
Very good. BUT YOU HAVE TO CHANGE THAT TOO !
#define TFT_RD_MASK BIT0 // digitalPinToBitMask(TFT_RD) // <<<<<< this too!
#define TFT_WR_MASK BIT1 // digitalPinToBitMask(TFT_WR) // <<<<<< this too!
#define TFT_RS_MASK BIT2 // digitalPinToBitMask(TFT_RS) // <<<<<< this too!
#define TFT_CS_MASK BIT3 // digitalPinToBitMask(TFT_CS) // <<<<<< this too!
from adafruit_tftlcd_8bit_stm32.
You can try this as test only, not for working version, because this will slow down the speed.
#define TFT_RD_MASK BIT(digitalPinToBitMask(TFT_RD))
#define TFT_WR_MASK BIT(digitalPinToBitMask(TFT_WR))
#define TFT_RS_MASK BIT(digitalPinToBitMask(TFT_RS))
#define TFT_CS_MASK BIT(digitalPinToBitMask(TFT_CS))
from adafruit_tftlcd_8bit_stm32.
Made the recommended change and got no data displayed on screen
from adafruit_tftlcd_8bit_stm32.
from adafruit_tftlcd_8bit_stm32.
Related Issues (12)
- Problem after reset and readid HOT 5
- Would it be possible to add support for display 0x0154? HOT 2
- nokia 6300 HOT 2
- libmaple dependency HOT 1
- port for libopencm3? HOT 3
- Data Pin assigning problem HOT 1
- how to change pins for STM32F103C8T6 HOT 3
- Problem bmp file show HOT 1
- GPIOA Problem HOT 3
- New sub-type of HD8357? HOT 3
- multiple definition errors due to #include <Adafruit_GFX_AS.h> HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_tftlcd_8bit_stm32.