@digitalblueeye, start by searching the forum for “porting” for example since there are several topics covering porting. Once you learned from that, come back with more specific questions.
The docs are a good starting point too
As for importing/using libraries
http://docs.particle.io/photon/build/#flash-apps-with-particle-build-using-libraries
http://docs.particle.io/photon/dev/#using-community-libraries
Some people argue the docs are not up to the task, but they are, they just need to be used correctly
If it helps for anyone else, this library doesn’t work the way it’s currently written with the revised Particle IDE… but the changes to make it work are very minor. I’ve forked it and made the changes on my own, but the IDE doesn’t want to accept a new library with the same name as a published one, so maybe the original publisher could make an update so it compiles on the current IDE?
The working on a photon in the web IDE version of the library is here: https://github.com/DaJMasta/Adafruit_ILI9341 and the only change was swapping the “hacked to work on the spark IDE” section of the IDE was commented out and replaced with [code]#if (PLATFORM_ID) == 6
#define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRRH = PIN_MAP[_pin].gpio_pin)
#define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRRL = PIN_MAP[_pin].gpio_pin)
#else
#define pinLO(_pin) (PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin)
#define pinHI(_pin) (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)
#endif[/code]
Hope it helps! Seems like a great little LCD for under $10 on ebay.
A while back already these macros have been superceeded by less HW dependent functions pinSetFast()
/pinResetFast()
and digitalWriteFast()
.
If you want your code to be safe for the future I’d recommend to use these instead.
https://docs.particle.io/reference/firmware/photon/#low-level-input-output
@DaJMasta, that’s the lib I ported!! The easiest way to let someone of github know of a problem is to raise an issue on the repo. I’ll take a look and post an update along the lines of what @ScruffR pointed out.
@DaJMasta, I just pushed an update on the repo which works with old Core and new Core/Photon/Electron firmware using the PinSetFast/PinResetFast functions
Thanks @ScruffR!
Great, I’ll swap over to that one in the project.
I was using the web IDE and was just trying to get the screen to work (had some trouble with a previous one) and by the time I got to the point I could actually make simple changes to anything, I had already forked the library and imported (I really need to setup to use a non-web IDE…), so it was easier to just post in the old thread than put in a notification to something that may not be maintained.
Happy that it’s fixed though!
Well, back to my version. The version available in the public community listing of libraries is based off of @peekay123’s work, but is the mtnscott version, which is currently unupdated. I’m not actually certain as to where the original library resides, and I’ve been unable to find it in the web IDE listing.
I just tried to use the Web IDE library for Adafruit_ILI9340 and the build initially came up with errors indicating that this version is still using GPIO - BRR and GPIO - BSRR instead of the pinSetFast()
and pinResetFast()
.
I set up a local copy of .cpp and .h for Adafruit_ILI9340 and corrected the #define
s for pinLO and pinHI. However, now I am getting another set of errors which appear to start with:
file included from Adafruit_ILI9341.cpp:17:0:
Adafruit_ILI9341.h:108:46: error: expected class-name before '{' token
class Adafruit_ILI9341 : public Adafruit_GFX {
^
I am not sure why this is happening since I have put in #include
s for Adafruit_mfGFX
and Adafruit_GFX
in the main program. Help!
@armor, you can grab the version I have on my repo with all the updates. Make sure you also include the Adafruit_mfGFX library.
Thanks - built now, I had left library Adafruit_GFX included and it didn’t like that.
Update: I am struggling to get the screen to work with the example. After previous experiences with ST7735 device I am uncertain as to whether the Reset pin on the screen needs to be linked to RST on the photon or whether the constructor actually makes use of the pin given (A0 in the example). I have double checked all the other connections and I am certain they are right. Have you any advice on the PIN use? Thanks
2nd Update: I had a look inside Adafruit_ILI9340.cpp and the .begin() appears to use the reset pin value. Using this I am getting nothing either. I have had issues with the latest batch of photons - pins not working - I will have to go through testing this photon.
I haven’t specifically used an ST7735, but I can tell you that on my Ili9340C connecting the RST is necessary. and NO you don’t hook the Display RST to the Photon RST. I have it connected to D5 for example. I let that go or did it wrong for quite a while getting nothing but a white screen. When i properly hooked it to a data pin and set the call appropriately, all was well.
Hi, thanks for the confirmation. When I first tried it I had a Serial.begin
and a wait until Serial input before the tft.begin()
. My learning from the ST7735 is that the reset line has to be set correctly very soon after power on of the tft. When I moved the tft.begin()
to the start of setup()
it worked. Maybe should be in the setupIO
function? Clearly whoever wrote this library didn’t experience such an issue otherwise they would have written it differently.
Have you seen any image (.BMP) loaders for the ILI9341? There doesn’t appear to be a bmpDraw()
function in the library. I have found this very useful on the ST7735 storing images on the SD card rather than using primitives to draw symbols. Simple animation is possible.
I am about to tackle the built-in SD card on the Ili9340 and I had found a file that was called spitftbitmap.ino I’m pretty sure it is available on the Adafruit site with the Ili9340 stuff. This is a program that loads a bitmap picture from the SD card. I don’t know if it has ever been put in a library form or ported to Particle.
The link to the Adafruit example for the Ili9340 is below: Click on the examples folder and the bitmap loading example is there
spitftbitmap example
I have this code ported somewhere! I just need to find it
Here is the link. The lib versions are a bit older and the SD library is not the new SDFat version but it does work.