Adafruit ILI9340 library [PORTED]

@peekay123 If there is only one SPI device can the MISO not be used for the LCD but use it for something else?

@wesner0019, if you use hardware SPI, then the answer is NO since the STM32 controls the pin. If you use software SPI then it can be done but the SPI speed will be much lower. If you can explain what you are trying to achieve and what devices you will be using I may be able to give you better advice. :smile:

@peekay123 I am going to use the P1 in a near project and I will be using an accelerometer, TFT display with touch, a stepper driver and a few other inputs. As it is now I will be maxing out the pins on the P1 even using the spare pins. I am trying to free up a few pins so it is not maxed out.

I see that the reset pin is also optional, i tired to set the define for the reset as #define 200 or something to basically diable it so i can use the reset pin for something else but the core flashes red on the led after initalization when I do this. How do I by pass the reset pin?

Also speed is not that important for this display, how difiicult would it be to get the software SPI working so that i could free up the MISO?

@wesner0019, the reset pin on the Core is not optional as far as I know. Can you do an inventory of the devices you want to use so I can do some pin allocation planning? The exact parts you want to use would be best. If you are concerned about privacy, just PM me the list. :smiley:

Below is the list:

I have been running the ILI9341 with RST tied to V3.3 and the MISO disconnected. I performed your speed testing example and did not notice any speed difference. Im sure that would change with software SPI.

MMA7660FCT-ND
ACCELEROMETER 3X3 DGTL 10-DFN

CSQG703BP - Needs PWM
BUZZER MAGNETIC 3V 12MM RADIAL

296-30458-1-ND - Stepper Motor control
IC DARL ARRAY 7CH 16TSSOP

2 SWITCHS - One to determine a press and the other needs an Interrupt

296-23840-1-ND - 2 pins needed to determine power good and charge status

IC LI-ION CHARGE/PWR MGMT 16-QFN

http://www.buydisplay.com/default/serial-qvga-2-2-inch-tft-spi-240x320-lcd-touch-display-module-ili9341
with the touch screen, I would like the resistive touch connected to the P1 directly ( needs to Digital and 2 Analog)
Will also need a PWM pin to control the Back light

2 resistor dividers to detect voltage

I thinks that all of it.

@wesner0019, how many PWM pins do you need for stepper motors?

The stepper does not need PWM, just digital. This snippet of the code.

void nextStep(){

 switch (currStep) {
    case 1:
        setMotor(1,0,0,0,motorSpeed);
      break;
    case 2:
      setMotor(1,1,0,0,motorSpeed);
      break;
    case 3:
      setMotor(0,1,0,0,motorSpeed);
      break;
    case 4:
      setMotor(0,1,1,0,motorSpeed);
      break;
    case 5:
      setMotor(0,0,1,0,motorSpeed);
      break;
    case 6:
      setMotor(0,0,1,1,motorSpeed);
      break;
    case 7:
      setMotor(0,0,0,1,motorSpeed);
      break;
    case 8:
      setMotor(1,0,0,1,motorSpeed);
      break;
  }

  setMotor(0,0,0,0,0);    //Turns stepper motor off

@wesner0019, so… how many digital! :unamused:

Oh yeah, sorry for got to mention that, it would be 4 digital.

@wesner0019, you don’t have enough I/O! By using an I2C touch screen controller like the STMPE610, you can reduce the I/O requirements by 4 pins. This would be one possible layout:

D0,D1: I2C w/MMA7660 and STMPE610 (or similar)
D2,D3: switches (can attach interrupt to both)
D4-D7: stepper motor
A0,A1: PWM out w/backlight, buzzer
A2-A5: Hardware SPI w/ILI9341 display
A6,A7: Charge controller digital inputs
TX,RX: Free for debugging or as spare digital I/O

:smiley:

With the P1 there are 6 spare pins that can act as GPIO’s. Spark hasnt yet published the exact functionality of these but they should be available.

@wesner0019, this is the $64K question! Well, you have options if those I/O are not as expected. :smiley:

1 Like

I’ve been checking the open source Photon repository daily for changes looking for an answer to the 64K question! I’m hoping some day soon we’ll know.

With the TFT, some pins are also needed for the D/C and PWM for the LED back light control?

@peekay123, Just wondering if you every saw this library? The DMA mode is really fast.

http://marekburiak.github.io/ILI9341_due/

@wesner0019, yup! That’s the one that @mtnscott kinda ported but is cleaning up before he posts it :weary:

1 Like

@peekay123, just tried flashing this code to the photon, when it compiles for the photon I get the below errors: But when if verify for the core it works. I’m guessing the pin mapping of the direct pin manipulation is off between the two?

Can this be fixed?

deleted

Hi @peekay123 and @mtnscott , have you heard anything if the DMA mode has been ported/posted?

@wesner0019, that scoundrel @mtnscott has gone dark and has me chomping at the bit for his library. I am focusing on working with the Particle team to embed timer and DMA management in the new firmware. Keep bugging @mtnscott and maybe he’ll acquiesce and share what he has :stuck_out_tongue: :cry:

1 Like

Im totally new to using the photon, although I do have experience with Arduino. How did you import the library files (the .cpps and .h files)? If you could give me a bit of a point in the right direction on how to set up the photon with your ported library I would really appriciate it!