I am punishing myself by rebuilding UTFT "library" to emulate standard LCD ( Hitachi controller based ) code.
The "main" obstacle in using UTFT "as is " - it is ( the class itself ) trying to be universal. Not a bad idea by itself, but it is locked to connect to "shields" pins and I have just raw TFT LCD module with 40 pins and I like to connect to my existing SAM3x8e vacant pins.
Hardware in no problem, it is the way UTFT software is build.
Here is an example in setting pin mode / direction:
void UTFT::_set_direction_registers(byte mode)
{
if (mode==16)
{
REG_PIOA_OER=0xc080; //PA7,PA14,PA15 enable
REG_PIOB_OER=0x4000000; //PB26 enable
REG_PIOC_OER=0x3e; //PC1 - PC5 enable
REG_PIOD_OER=0x64f; //PD0-3,PD6,PD9-10 enable
}
}
This function sets the direction registers just fine , but they are for some specific shield.
I did not bother to find out which one, don't need that info.
I am all for working at "registers level", but why in this case?
I am connecting to / using Due pins 22 thru 53 so what is wrong in simply setting registers to output using pinMode API?
During class instantiation speed is immaterial.
for ( int i = 22; i != 53; i++)
pinMode(i, OUTPUT);
I finding search for current source code on Github rather awkward.
digitalPinToPort is next on my search list.
Any commentary, preferably to the subject of TFT LCD, or other ideas would be appreciated.