9 years, 6 months ago.

Pin Connections

Dear, Awesome Work! Thanks for putting in the time and efforts.

How and where in the program do we specify the pin connection details?

Thanks.

Question relating to:

A first port of the excellent Adafruit ST7735 library LCD, ST7735, TFT
  1. include "mbed.h"
  2. include "Adafruit_GFX.h"
  3. include "Adafruit_ST7735.h"

DigitalOut lite(PTC9);backlite connection

Adafruit_ST7735 display(PTD2, PTD3, PTD1, PTD0, PTD5, PTA13); MOSI, MISO, SCK,CS,RS,RESET; the actual pins of FRDM-KL25Z

int main() {

lite=1;

display.initR(INITR_GREENTAB); display.fillScreen(ST7735_BLACK);

wait(1);

while(1) { display.fillRect(10, 10, 100, 100, ST7735_RED); wait(0.2);

} }

posted by utkarsh sinha 25 May 2015

1 Answer

9 years, 6 months ago.

See line 95 of the .h file: https://developer.mbed.org/users/SomeRandomBloke/code/Adafruit_ST7735/docs/18ecda534e06/Adafruit__ST7735_8h_source.html. Thats how you should use the contructor.

Accepted Answer

Thanks for your help. :)

But it still shows some errors and cant compile.

it gives this error: (screen shot) https://drive.google.com/file/d/0BxETKU7nj3LdMzVYMlEtQ1d4dW8/view?usp=sharing

posted by utkarsh sinha 19 May 2015

Look how it is done in other code, for example: https://developer.mbed.org/handbook/SPI. You now used it as strings.

posted by Erik - 19 May 2015

thanks.

I figured it out soon after that : I cahnged line 95 of the .h file to " Adafruit_ST7735(PinName PTD2, PinName PTD3, PinName PTD1, PinName PTD0, PinName PTD5, PinName PTA13); " and its giving no more errors.

However I am still not able to use the Adafruit Display.

Can you please post an example code?

posted by utkarsh sinha 19 May 2015

I don't have it myself so I cannot be sure how it works either, especially since the library does not include an example. But for starters give more info: How are you not able to use it. How did you connect it. What code are you rinning? Which board do you have exactly? Are you calling initB/initR?

posted by Erik - 19 May 2015

Thanks Erik! Could finally did it! (posting it for the community)

  1. include "mbed.h"
  2. include "Adafruit_GFX.h"
  3. include "Adafruit_ST7735.h" <weird # looks like 1,2 ,3 in this answer!>

DigitalOut lite(PTC9);

<comment> backlite connection </comment>

Adafruit_ST7735 display(PTD2, PTD3, PTD1, PTD0, PTD5, PTA13);

<comment> MOSI, MISO, SCK,CS,RS,RESET; the actual pins of FRDM-KL25Z </comment>

int main() {

lite=1;

display.initR(INITR_GREENTAB); display.fillScreen(ST7735_BLACK);

wait(1);

while(1) { display.fillRect(10, 10, 100, 100, ST7735_RED); wait(0.2);

} }

posted by utkarsh sinha 25 May 2015

Glas to hear it worked. For future reference, you can use <<code>> and <</code>> (on seperate lines) to properly format code you post here :).

posted by Erik - 25 May 2015