Go Down

Topic: MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields (Read 528725 times) previous topic - next topic

david_prentice

Pins are determined in mcufriend_shield.h
If USE_SPECIAL is defined,   mcufriend_special.h is checked before mcufriend_shield.h

All "common" pinouts are already available in  mcufriend_special.h
You just un-comment a define

David.


Mattty5

I had the UNO shield screen working on the Mega with 8bit uno on Mega defined.

Soooo much faster, unlocks a great amount for me so thank you again David!!

Only trouble, I had was with the touch, I think I have to use Analog pins? Anyway I switched pins to Proto variation and change the def,

The touch screen pin diag example didn't go for that, looks like it only checks sensible pins,

Works now anyway, I set,
XP=22 XM=A2 YP=A1 YM=23 works like a charm, I'm so please to have solved this!

Before I knew I had a problem I was expecting 22,38,40,23


Many thanks,
Matt

Mattty5

I have to redo my bounce and double tap detection now, so much faster...

AdiGitalEU

Hello,

I've been playing with the library for some time with great success (David even included my timings for Teensy in v 2.9.9 beta) Now I encountered a challenge. Not critical but would greatly improve my design if it worked.

Unless I'm wrong, from what I see and understand about the vertScroll method it only works for entire screen.

I'm using the display in horizontal mode and need to scroll an area/window horizontally, which should still follow the hardware direction. I've tried the software method already. What I'm looking here is just confirmation that it's not possible to hardware scroll a defined area of the screen.

david_prentice

Most controllers will Vertical Scroll a horizontal Band.  e.g. in Penguin screens.

In Landscape mode,  it is a "horizontal scroll".   A "Band" would be a vertical band.
This works fine for a graph e.g. monitoring music, pressure, voltage, ... 

What do you want to do?
Which controller?

Note that you can use hardware to move a substantial area.  And redraw a small area to make it look as if you are moving a window with stationary axes.

David.

AdiGitalEU

It's RM6814 and a graph is exactly what I want to create. It's part for a lab power supply and apart from gauges, bars etc. I'd like to create rolling graph updated several times a second. I'm aiming to implement it in a window. However, can't find a method to achieve that.

david_prentice

Post the code for a stationary graph.  i.e. axes, labels, actual position and size on Landscape screen.

I will show you how to "scroll it".

A paper sketch is fine.    i.e. axes, labels, position and size on Landscape screen.

David.

AdiGitalEU

Thank you David for taking the time.

The UI I'm building is based on subclassing a root UIelement and there are multiple types of sub-elements like DigitalDisplay, BarGraph, Label and so on. The UIelement contains the main properties like screen coordinates, dimensions or colours. What's left if is to override the drawing methods. If you don't mind suggesting a function, then I should manage to implement it into the class. I think I understand the principle of scrolling algorithm of such object. Correct me please if I'm wrong but is it something like?:

1. Draw pixel on right edge.
2. Scroll area left by 1 pixel.
3. Go To 1.

I attached a sketch.

david_prentice


AdiGitalEU


scornp

Hi,
I don't normally post so probably in the wrong place - please no glib or sarky responses. I have a mcufriend tft, and I need to shift the usage of IO on PORTF to PORTK on an arduino 1280/2560. The reason is because I need to use the jtag inteface, I've tried modifying mcufriend_shield.h and mcufriend_special.h with no success, has anybody done this?

Regards

Roger

david_prentice

Change
Code: [Select]

//################################### MEGA2560 ##############################
#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)       //regular UNO shield on MEGA2560
#define RD_PORT PORTF
#define RD_PIN  0
#define WR_PORT PORTF
#define WR_PIN  1
#define CD_PORT PORTF
#define CD_PIN  2
#define CS_PORT PORTF
#define CS_PIN  3
#define RESET_PORT PORTF
#define RESET_PIN  4

to
Code: [Select]

//################################### MEGA2560 ##############################
#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)       //special wiring on MEGA2560
#define RD_PORT PORTK //PK0
#define RD_PIN  0
#define WR_PORT PORTK //PK1
#define WR_PIN  1
#define CD_PORT PORTK //PK2
#define CD_PIN  2
#define CS_PORT PORTK //PK3
#define CS_PIN  3
#define RESET_PORT PORTK //PK4
#define RESET_PIN  4


Moving individual control pins is easy.
Moving random data pins is PAINFUL.   I will do it for you if there is a good reason (and the user is prepared to verify the proposed wiring with LCD_ID_readreg first)

David.

scornp

Hi David,
many thanks for your response. It was in fact one of the first things I tried. I have also tried using the Ax and absolute addressing notation for pins - no success, I did find that the display worked if I shifted to the upper half of PORTF with the reset being pin 0 of PORTK, but the touch screen did not work. I'm at a loss quite frankly, I'm overlooking something and cannot see what I'm missing. BTW is the addressing meant to be within the port range i.e.

#define RD_PORT PORTK //PK0
#define RD_PIN  0

since I've tried all addressing modes without success.

Regards

Roger


david_prentice

Think about it.   You can move control pins anywhere you want.

But the TouchScreen needs at least two Analog pins.   The obvious thing to do is put LCD_WR, LCD_RS on PF6, PF7.  (assuming that that is where XM, YP are physically placed)

Mind you,  PK0-PK7 are Analog pins.  So you can follow my scheme in #2967.   XM, YP will be using A9, A10 instead of A1, A2.

David.

Edit.   Oops.  JTAG is on PF4-PF7.   So the only conflict is with PF4.   You can move the LCD_RST pin to anywhere you want.  Even snip the shield pins and solder a 10k pullup to 5V and rely on SW Reset.    This gives you access to PF4-PF7 with the Shield in place.   (use some angle header strip)

Go Up