5 Replies Latest reply on Jun 24, 2015 5:00 PM by Intel_Alvarado

    Slow paint on LCD

    cmlopez48

      Hello.

      I am using an Adafruit LCD 320x240 pixels. with Eclipse IDE.

      Everythign is ok, except is too slow.

      Draw a line from one side to the other side take about 10 seconds. Imagine to paint all screen

       

      I put some pieces of the code.

       

      Any one have some problems with the speed using Eclipse?

       

      Any help with this issue will be appreciated

       

      This is  the function to draw a pixel:

      void dibujar_pixel(int16_t x, int16_t y, uint16_t color) {

      // check boundaries

        if((x < 0) || (y < 0) || (x >= TFTWIDTH) || (y >= TFTHEIGHT)) return;

        set_ram(x,y,x,y);

        writeCommand8(0x2c,true);

        writeData8(color >> 8,true); //

        writeData8(color,false);

      }

       

      and these are the other functions

       

      void writeCommand8(uint8_t a,bool chip_select) {

        CS_ACTIVE;   //#define CS_ACTIVE     mraa_gpio_write(m_csPinCtx, LOW)

        RD_IDLE; //     #define RD_IDLE    mraa_gpio_write(m_rdPinCtx, HIGH)

        WR_IDLE;     //#define WR_IDLE    mraa_gpio_write(m_wrPinCtx, HIGH)

        CD_COMMAND;     //#define CD_COMMAND mraa_gpio_write(m_cdPinCtx, LOW)

       

        write_port(a);

        usleep(10);

        //delay(1);

        WR_ACTIVE;

        usleep(10);

        //delay(1);

        WR_IDLE;

       

      if (chip_select==false)

        CS_IDLE;

        delay(1);

      }

      }

       

       

      void write_port(uint8_t a) {

       

         //{ 13, 10, 12, 11, 14, 15, 16, 17 };

      for (int i=0; i<8;i++){

        mraa_gpio_write(m_dataPinCtx[i],(a>>i) & 0x1);

        //printf("%i: %i\n",i,(a>>i) & 0x1);

      }

       

       

       

      }