Skip to content

Commit

Permalink
Merge pull request #10 from technobly/photon
Browse files Browse the repository at this point in the history
Photon now fully supported in NeoPixel library!
  • Loading branch information
technobly committed May 26, 2015
2 parents c9474d1 + 647ec96 commit eb3e052
Show file tree
Hide file tree
Showing 6 changed files with 386 additions and 72 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
SparkCore-NeoPixel
==================

A library for manipulating NeoPixel RGB LEDs for the Spark Core.
A library for manipulating NeoPixel RGB LEDs for the Spark Core and Photon.
Implementation based on Adafruit's NeoPixel Library.
Library currently supports WS2812, WS2812B GRB 800kHz style pixels, strips and sticks!
WS2811 RGB 400kHz style pixels, strips and sticks!

Also supports these less common pixels
---
- Radio Shack Tri-Color LED Strip with TM1803 controller 400kHz bitstream.
- TM1829 pixels, many [details here.](https://community.spark.io/t/neopixel-library-for-tm1829-controller-resolved/5363)
- TM1829 pixels, many [details here.](https://community.particle.io/t/neopixel-library-for-tm1829-controller-resolved/5363)

Components Required
---
- A Neopixel digital RGB LED (get at [adafruit.com](adafruit.com))
- or a Radio Shack Tri-Color LED Strip (get at [radioshack.com](radioshack.com))
- A Spark Shield Shield or breakout board to supply neopixel's with 5V (see store at [spark.io](spark.io))
- A Particle Shield Shield or breakout board to supply neopixel's with 5V (see store at [particle.io](particle.io))

Example Usage
---
Expand All @@ -38,8 +38,8 @@ Nuances

- Make sure get the # of pixels, pin number, type of pixels correct

- NeoPixels require 5V logic level inputs and the Spark Core only has 3.3V logic level digital outputs. Level shifting from 3.3V to 5V is
necessary, the Spark Shield Shield has the [TXB0108PWR](http://www.digikey.com/product-search/en?pv7=2&k=TXB0108PWR) 3.3V to 5V level shifter built in (but has been known to oscillate at 50MHz with wire length longer than 6"), alternatively you can wire up your own with a [SN74HCT245N](http://www.digikey.com/product-detail/en/SN74HCT245N/296-1612-5-ND/277258), or [SN74HCT125N](http://www.digikey.com/product-detail/en/SN74HCT125N/296-8386-5-ND/376860). These are rock solid.
- NeoPixels require 5V logic level inputs and the Spark Core and Photon only have 3.3V logic level digital outputs. Level shifting from 3.3V to 5V is
necessary, the Particle Shield Shield has the [TXB0108PWR](http://www.digikey.com/product-search/en?pv7=2&k=TXB0108PWR) 3.3V to 5V level shifter built in (but has been known to oscillate at 50MHz with wire length longer than 6"), alternatively you can wire up your own with a [SN74HCT245N](http://www.digikey.com/product-detail/en/SN74HCT245N/296-1612-5-ND/277258), or [SN74HCT125N](http://www.digikey.com/product-detail/en/SN74HCT125N/296-8386-5-ND/376860). These are rock solid.


Building locally
Expand All @@ -48,11 +48,17 @@ Building locally
If you are building locally, place the files here:

```
..\core-firmware\inc\neopixel.h
..\core-firmware\src\application.cpp (renamed from extra-examples.cpp)
..\core-firmware\src\neopixel.cpp
..\core-firmware\src\build.mk (optional, if you have your own make file going, just add the neopixel.cpp to it)
../firmware/user/neo/extra-examples.cpp
../firmware/user/neo/neopixel.h
../firmware/user/neo/neopixel.cpp
```

Compile and program via DFU over USB with:

```
cd firmware/main
make v=1 APP=neo PLATFORM=photon clean all program-dfu
Useful Links
---
Expand Down
3 changes: 2 additions & 1 deletion firmware/examples/a-rainbow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
*/

#include "application.h"
//#include "spark_disable_wlan.h" // For faster local debugging only
#include "neopixel/neopixel.h"

SYSTEM_MODE(AUTOMATIC);

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
#define PIXEL_COUNT 10
Expand Down
14 changes: 8 additions & 6 deletions firmware/examples/extra-examples.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/*-------------------------------------------------------------------------
Spark Core library to control WS2811/WS2812 based RGB
Spark Core and Photon library to control WS2811/WS2812 based RGB
LED devices such as Adafruit NeoPixel strips.
Currently handles 800 KHz and 400kHz bitstream on Spark Core,
Currently handles 800 KHz and 400kHz bitstream on Spark Core and Photon,
WS2812, WS2812B and WS2811.
Also supports:
- Radio Shack Tri-Color Strip with TM1803 controller 400kHz bitstream.
- TM1829 pixels
PLEASE NOTE that the NeoPixels require 5V level inputs
and the Spark Core only has 3.3V level outputs. Level shifting is
necessary, but will require a fast device such as one of the following:
and the Spark Core and Photon only have 3.3V level outputs.
Level shifting is necessary, but will require a fast device such as one
of the following:
[SN74HCT125N]
http://www.digikey.com/product-detail/en/SN74HCT125N/296-8386-5-ND/376860
Expand All @@ -19,7 +20,7 @@
http://www.digikey.com/product-detail/en/SN74HCT245N/296-1612-5-ND/277258
Written by Phil Burgess / Paint Your Dragon for Adafruit Industries.
Modified to work with Spark Core by Technobly.
Modified to work with Spark Core and Photon by Technobly.
Contributions by PJRC and other members of the open source community.
Adafruit invests time and resources providing this open source code,
Expand All @@ -30,9 +31,10 @@
/* ======================= includes ================================= */

#include "application.h"
//#include "spark_disable_wlan.h" (for faster local debugging only)
#include "neopixel/neopixel.h"

SYSTEM_MODE(AUTOMATIC);

/* ======================= prototypes =============================== */

void colorAll(uint32_t c, uint8_t wait);
Expand Down
Loading

0 comments on commit eb3e052

Please sign in to comment.