nopnop2002 / wiringpi-tft-tool

TFT Command Line Tool for Raspberry Pi
MIT License
38 stars 10 forks source link

Tft.c line 606 #5

Closed goutx2 closed 4 years ago

goutx2 commented 4 years ago

You have to change line 606 ch to cs sscanf(buff, "CH=%d", &(pin->ch)); to sscanf(buff, "CH=%d", &(pin->cs));

nopnop2002 commented 4 years ago

The pins structure has no ch member.

It should cause a compilation error, but it is strange that it does not.

pins.cs is set here.

https://github.com/nopnop2002/wiringpi-tft-tool/blob/master/tft.c#L604

The following two lines are not required.

https://github.com/nopnop2002/wiringpi-tft-tool/blob/master/tft.c#L605 https://github.com/nopnop2002/wiringpi-tft-tool/blob/master/tft.c#L606

I'll fix this issues. Thank you for report.

nopnop2002 commented 4 years ago

@goutx2 pin.ch is SPI Channel.

https://github.com/nopnop2002/wiringpi-tft-tool/blob/master/spilib.c#L137

https://github.com/nopnop2002/wiringpi-tft-tool/blob/master/spilib.c#L145

No need to change.

goutx2 commented 4 years ago

when i change it to cs it work perfectly i dont know why but it work I use 8 bits paralell not spi

nopnop2002 commented 4 years ago

8 bit paralell uses the following structure:

typedef struct {
  int rst;
  int cs;
  int rs;
  int wr;
  int rd;
  int d0;
  int d1;
  int d2;
  int d3;
  int d4;
  int d5;
  int d6;
  int d7;
} TFTPin;

This structure has no ch members. But if pin.conf has "CH=xx", it will be set as a ch member and destroy the memory.

https://github.com/nopnop2002/wiringpi-tft-tool/blob/master/tft.c#L605

Is "CH=XX" in your pin.conf? ?