Para la parte nueva, han decidido utilizar el escudo y pantallas para el.
En la parte vieja, no hay manera, tanto por hueco como por desarrollo, incluso se ha probado los multiplexores y no hay espacio.
Mirando la libreria mcufriend_shield.h
He localizado algo de los pines del arduino MEGA
//################################### MEGA2560 ##############################
#elif defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) //regular UNO shield on MEGA2560
//LCD pins |D7 |D6 |D5 |D4 |D3 |D2 |D1 |D0 | |RD |WR |RS |CS |RST|
//AVR pin |PH4|PH3|PE3|PG5|PE5|PE4|PH6|PH5| |PF0|PF1|PF2|PF3|PF4|
#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
#define EMASK 0x38
#define GMASK 0x20
#define HMASK 0x78
#define write_8(x) { PORTH &= ~HMASK; PORTG &= ~GMASK; PORTE &= ~EMASK; \
PORTH |= (((x) & (3<<0)) << 5); \
PORTE |= (((x) & (3<<2)) << 2); \
PORTG |= (((x) & (1<<4)) << 1); \
PORTE |= (((x) & (1<<5)) >> 2); \
PORTH |= (((x) & (3<<6)) >> 3); \
}
#define read_8() ( ((PINH & (3<<5)) >> 5)\
| ((PINE & (3<<4)) >> 2)\
| ((PING & (1<<5)) >> 1)\
| ((PINE & (1<<3)) << 2)\
| ((PINH & (3<<3)) << 3)\
)
#define setWriteDir() { DDRH |= HMASK; DDRG |= GMASK; DDRE |= EMASK; }
#define setReadDir() { DDRH &= ~HMASK; DDRG &= ~GMASK; DDRE &= ~EMASK; }
#define write8(x) { write_8(x); WR_STROBE; }
#define write16(x) { uint8_t h = (x)>>8, l = x; write8(h); write8(l); }
#define READ_8(dst) { RD_STROBE; dst = read_8(); RD_IDLE; }
#define READ_16(dst) { uint8_t hi; READ_8(hi); READ_8(dst); dst |= (hi << 8); }
#define PIN_LOW(p, b) (p) &= ~(1<<(b))
#define PIN_HIGH(p, b) (p) |= (1<<(b))
#define PIN_OUTPUT(p, b) *(&p-1) |= (1<<(b))
Esta libreria tambien hace referencia a la libreria "mcufriend_special.h",
#if defined(USE_SPECIAL)
#include "mcufriend_special.h"
#elif defined(__AVR_ATmega2560__) && defined(USE_OPENSMART_SHIELD_PINOUT_MEGA)
//LCD pins | D7 | D6 | D5 | D4 |D3 | D2 | D1 | D0 |, |RD |WR | RS | CS |RST|
//AVR pin |PH4|PH3|PE3|PG5|PE5|PE4|PH6|PH5|, |PF0|PF1|PF2|PF3|PF4|
//MEGA pins| 7 | 6 | 5 | 4 | 3 | 2 | 9 | 8 | , |A0 | A1 | A2 | A3 |A4 |
#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 1 // n/a. so mimic WR_PIN
#define BMASK 0b10110000 //D13, D11, D10
#define GMASK 0x20 //D4
#define HMASK 0x78 //D6, D7, D8, D9
#if defined(USE_BLD_BST_MEGA2560)
static __attribute((always_inline)) void write_8(uint8_t val)
{
asm volatile("lds __tmp_reg__,0x0102" "\n\t" //PORTH
"BST %0,0" "\n\t" "BLD __tmp_reg__,5" "\n\t"
"BST %0,1" "\n\t" "BLD __tmp_reg__,6" "\n\t"
"BST %0,6" "\n\t" "BLD __tmp_reg__,3" "\n\t"
"BST %0,7" "\n\t" "BLD __tmp_reg__,4" "\n\t"
"sts 0x0102,__tmp_reg__" : : "a" (val));
asm volatile("in __tmp_reg__,0x05" "\n\t" //PORTB
"BST %0,2" "\n\t" "BLD __tmp_reg__,4" "\n\t"
"BST %0,3" "\n\t" "BLD __tmp_reg__,5" "\n\t"
"BST %0,5" "\n\t" "BLD __tmp_reg__,7" "\n\t"
"out 0x05,__tmp_reg__" : : "a" (val));
asm volatile("in __tmp_reg__,0x14" "\n\t" //PORTG
"BST %0,4" "\n\t" "BLD __tmp_reg__,5" "\n\t"
"out 0x14,__tmp_reg__" : : "a" (val));
}
#else
#define write_8(x) { \
PORTH = (PORTH&~HMASK)|(((x)& 0b11000000)>>3)|(((x)& 0b00000011)<<5); \
PORTB = (PORTB&~BMASK)|(((x)& 0b00101100)<<2); \
PORTG = (PORTG&~GMASK)|(((x)& 0b00010000)<<1); \
}
#endif
#define read_8()(\
((PINH & 0b00011000) << 3) | ((PINB & BMASK) >> 2) | \
((PING & GMASK) >> 1) | ((PINH & 0b01100000) >> 5) )
#define setWriteDir() { DDRH |= HMASK; DDRB |= BMASK; DDRG |= GMASK; }
#define setReadDir() { DDRH &= ~HMASK; DDRB &= ~BMASK; DDRG &= ~GMASK; }
#define write8(x) { write_8(x); WR_STROBE; }
#define write16(x) { uint8_t h = (x)>>8, l = x; write8(h); write8(l); }
#define READ_8(dst) { RD_STROBE; dst = read_8(); RD_IDLE; }
#define READ_16(dst) { uint8_t hi; READ_8(hi); READ_8(dst); dst |= (hi << 8); }
#define PIN_LOW(p, b) (p) &= ~(1<<(b))
#define PIN_HIGH(p, b) (p) |= (1<<(b))
#define PIN_OUTPUT(p, b) *(&p-1) |= (1<<(b))
pero por desgracia no entiendo el contexto de las 2 librerias, ni la posibilidad de cambiar los pines.
Alguien tiene alguna idea de como tambiarlos??
Necesitaria quedaran asi:
//LCD pins | D7 | D6 | D5 | D4 |D3 | D2 | D1 | D0 |, |RD |WR | RS | CS |RST|
//AVR pin |PL2|PL3|PL4|PL5 |PL6|PL7|PG0|PG1|, |PF0|PF1|PF2|PF3|PF4|
//MEGA pins| 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | , |A0 | A1 | A2 | A3 |A4 |