Libraries to Update for the Photon


#22

If your only goal is to use it, and not actually contribute to it, you can copy the contents of the files into the web IDE by hitting the small + sign in the top right corner of the IDE, and then pasting the contents of the files in the newly created pages. That should work. Once the library is fully ported, it can go into the library system where it can be used like the other libraries :smile:


#23

I can convert my stab at OneWire into a real library if that makes it easier for people to test it out/contribute.

I’m new to the particle ecosystem, so just to check, is this the official instructions for making a library: https://github.com/spark/uber-library-example? Is there a way to use this style of library with the desktop Particle Dev, or is it web IDE only?


#24

As for now there are some things to consider when providing a lib for Web IDE and other IDEs.
Web IDE does place contributed libs in your project inside a folder named after the lib, while Particle Dev wants (at least used to, last time I used it ;-)) it to be in your project root folder.

So I usually do this

#define PARTICLE_WEB_IDE  // uncomment for Web IDE
//#define PARTICLE_DEV_IDE  // uncomment for Particle DEV

// to avoid "No such file" errors
#if defined(PARTICLE_WEB_IDE)
#include "LibName/LibName.h"
#elif defined(PARICLE_DEV_IDE)
#include "LibName.h"
#else
// whatever else
#endif

Some other things, like the folder structure and the mentiond JSON file and other things should be done as shown in UBER-LIBRARY, but are also checked when contributing your lib.
Just make sure that all your provided examples do actually build without error before publishing your private lib to the public - that makes corrections easier :wink:
I usually need at least three iterations to get it running propperly :blush:


#25

Thanks Beebs for porting the OneWire library. I made a small modification to line 91 of the .h file. I removed the “OneWire::” in front of digitalReadFast(). It now seems to compile both for a core and a photon. I have also put the OneWire library in a format that matches the WebIDE with the name “Particle-OneWire”. I have modified the dallas library to match “ParticleDallasTemperature” . I have yet to fully check all of the examples, etc so I have not made it public to the WebIDE.


Photon and the PIN_MAP[] challenge!
Cannot download The examples from "Getting Started with the Photon"
Cannot download The examples from "Getting Started with the Photon"
#26

What would it take to get the OneWire library fixed in the Web IDE Libraries?

Is it something users can contribute too or something that Particle Team needs to do?


#27

I just issued a pull request to the existing OneWire library on the web IDE. I thought this would be better than publishing a new OneWire library, because then there would be multiple versions on the web IDE, some that support the Photon and some that don’t. If the maintainer of that library merges the pull request, then we’re good to go. It looks like they haven’t been on github in a while though, so if they don’t, then we can publish a new library or something.

@Carsten4207 if you want to contribute to a library, I think they best way is to fork it on github, make a change, then submit a pull request. It doesn’t look like OneWire is an official library the way SPI or something is, so anyone can contribute. Once the discussion about PIN_MAP gets sorted out, there will likely need to be some updates to the OneWire library!


#28

If you need an interim solution you can import the above linked libraries and into your account on the WebIDE. This is done under the “libraries” tab in the WebIDE. Click on “contribute library” and import. There will be a warning that another user has a library under the same name, disregard this. Note that any library that relies on OneWire will need to be changed to Particle-OneWire as is done for DallasTemperature in the above link. The Dallas library works but I am still working on getting fixing all of the examples. As Beebs mentioned ideally this will happen through a merger with the original OneWire library or through PIN_MAP modification so as not to add any confusion or reworking of already existing sketches.


#29

Thanks for that! I never realized you could import libraries.

Anyway I got the DS18B20 working with the Photon. Thanks!


#30

SD - https://github.com/technobly/SparkCore-SD


#31

Glad to hear that did the trick!


#32

I did a few quick a dirty edits to the library to get it working for the Photon. It’s not pretty, but it will get the job done until it gets a full update.


#33

Thank you ! Appreciate the effort :slight_smile:


#34

What about the Adafruit SSD1351 library? I see the SSD1306 and the GFX libraries, has anyone ported the SSD1351 yet?


#35

It would be amazing if someone could help port the FastLED library from the Core to the Photon. It’s on their list to port, but they are very busy. I’m trying to learn enough to help. :slight_smile: According to Daniel, it may not take much to port, depending “on how consistent ST Micro are with their peripherals across generations”.


#36

I tried and failed to use the RCSWITCH library with my new Particle. Can anyone take a look at it?
Thanks!

UPDATE: RESOLVED


#37

@davidbradway, can you give a few details on what you tried and what problems you are having? BTW, it is called the Photon (Particle is the new company name).


#38

For my Photon, I tried to Verify the “receivedemo_advanced” from the Rcswitch library and got the following output in the Build online IDE. I think it is not seeing the library location. Thanks.

In file included from …/inc/spark_wiring.h:29:0,
from …/inc/application.h:29,
from receivedemo_advanced.cpp:12:
…/…/core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning “Defaulting to Release Build” [-Wcpp]
#warning “Defaulting to Release Build”
^
receivedemo_advanced.cpp:13:31: fatal error: RCSwitch/RCSwitch.h: No such file or directory
static char *bin2tristate(char *bin);
^

compilation terminated.
make: *** [receivedemo_advanced.o] Error 1
Error: Could not compile. Please review your code.


#39

@davidbradway, odd. I just loaded that demo and it compiled just fine for both a Core and Photon target. Did you modify anything in the code? Can you attach a screen shot of web IDE showing receivedemo_advanced.ino tab?


#40

I just removed it and tried again, and it Verified properly this time. Thanks.


#41

LiquidTWI