Hi ,

I just received my my 1.8" TFT LCD 160x128 Display Module  and have had it running on both I2C and SPI. It is a very nice unit and and seems very versatile. The library looks powerful.Good job.

I note that the SPI interface is based around software SPI, not the hardware based SPI solution offered by Arduino SPI.h. I attenmpted a convertsion to SPI.h by modifying DigoleSerial.h to use SPI.h instead of Shiftout. As far as I can see the only rotines which need to change are write and read1. The fragment below shows what I did. I was hoping that it might have worked to some extent, but it does not.

#if defined(_Digole_Serial_SPI_)
   
    void begin(void)
    {
        SPI.begin();
        pinMode(_SSpin, OUTPUT);
        digitalWrite(_SSpin, HIGH);
/*
    pinMode(_Clockpin, OUTPUT);
        pinMode(_Datapin, OUTPUT);
        pinMode(_SSpin, OUTPUT);
        digitalWrite(_SSpin, HIGH);
#if Ver==33 //sorry, we made wrong mode in Ver 3.3 firmware
        digitalWrite(_Clockpin, HIGH);
#else
        digitalWrite(_Clockpin, LOW);
#endif
        digitalWrite(_Datapin, LOW);
        if (_SIpin != 0)
            {
                pinMode(_SIpin, INPUT);
            }
*/
    }

    DigoleSerialDisp(uint8_t SS) //spi set up
    {
//        _Clockpin = pin_clock;
//        _Datapin = pin_data;
        _SSpin = SS;
//        _SIpin = SI;
        begin();
/*        pinMode(_Clockpin, OUTPUT);
        pinMode(_Datapin, OUTPUT);
        pinMode(_SSpin, OUTPUT);
        digitalWrite(_SSpin, HIGH);
#if Ver==33 //sorry, we made wrong mode in Ver 3.3 firmware
        digitalWrite(_Clockpin, HIGH);
#else
        digitalWrite(_Clockpin, LOW);
#endif
        digitalWrite(_Datapin, LOW);
        if (_SIpin != 0) {
            pinMode(_SIpin, INPUT);
        }
 */
    }

    size_t write(uint8_t value)
    {
        digitalWrite(_SSpin, LOW);
        digitalWrite(_SSpin, LOW);
        digitalWrite(_SSpin, LOW);
        SPI.transfer(value);
//        shiftOut(_Datapin, _Clockpin, MSBFIRST, value);

/*
#if Ver==33
        digitalWrite(_Clockpin, HIGH);
#endif
*/
        digitalWrite(_SSpin, HIGH);
        return 1; // assume sucess
    }

    size_t read1(void)
    {
        int t = 0;
        char c;
//        wdt_disable();
//        digitalWrite(_SSpin, HIGH);
//        digitalWrite(_SSpin, HIGH);
//        while (digitalRead(_SIpin) == LOW) ; //check to see the data is ready(1) or not(0)
        digitalWrite(_SSpin, LOW); //tell display module I will read data
        digitalWrite(_SSpin, LOW); //delay about 5us to wait module prepare data
        digitalWrite(_SSpin, LOW);
/*
        for (c = 8; c > 0; c = c - 1)
        {
            t <<= 1;
#if Ver==33
            digitalWrite(_Clockpin, LOW);
            if (digitalRead(_SIpin))
                t |= 1;
            digitalWrite(_Clockpin, HIGH);
#else
            digitalWrite(_Clockpin, HIGH);
            if (digitalRead(_SIpin))
                t |= 1;
            digitalWrite(_Clockpin, LOW);
#endif
        }
*/
        t=SPI.transfer(0x00);
        digitalWrite(_SSpin, HIGH);
        return t; // assume sucess
    }

Three points: I have been unkind to version 33 since I don't need to support it. Not good for a final solution however. SPI.h is included from the main file ( testallfunctions). I think the defaults for the SPI setting as to bit endian and so on is right at the default. However this might be a source of problems. The program testallfunctions compiles but fails to run correctly. Something is not right about the hardware SPI I suspect. Before I break out my oscilloscope and start probing about maybe you can tell me if this is a fool's errand and will never work for some reason.

The reason I ask is that the display was to fit into a much larger project designed ground up around mutliple devices on hardware SPI. Pins are not plentiful in a tight design and to allocate 3 for a software SPI is a luxury I don't have. Also it is a time critical application running with both timers generating interrupts and pin change interrupts, not to mention an incessant stream of serial data from a GPS unit feeding a hardware serial port. Waiting for software SPI is not a great outcome and will cause perceptable lags for some functions and likely corruption of the GPS data.

I2C is undesireable also from the pin point of view. I don't have a lot to spare. I note that the I2C interface uses the Arduino I2C library!

I suggest that using any form of software interface to hardware when a hardware solution is available isn't ideal and will cause potential users like me to baulk when they see the limitations.

Hoping you can solve this one easily with a conversion to hardware SPI.

Regards.