LPD8806 osc communication
Dependents: LineLedControl LineLedControl2
Fork of LPD8806 by
Diff: LPD8806.cpp
- Revision:
- 2:0d8eb41bb976
- Parent:
- 1:6ebd3ac910b6
- Child:
- 3:4ff7fdb41bd2
diff -r 6ebd3ac910b6 -r 0d8eb41bb976 LPD8806.cpp --- a/LPD8806.cpp Fri Dec 16 10:26:35 2011 +0000 +++ b/LPD8806.cpp Mon Aug 19 12:12:30 2013 +0000 @@ -7,16 +7,18 @@ // // standard connected to 1st hardware SPI // LPD8806 <> MBED -// DATA -> P5 -// CLOCK -> p7 +// DATA -> P5( mosi ) or P11( mosi ) +// CLOCK -> p7( sclk ) or p13( sclk ) /*****************************************************************************/ #include "LPD8806.h" //Define SPI pins //Connected to first SPI module -SPI spi(p5, p6, p7); // mosi, miso, sclk -//SPI spi(p11, p12, p13); // mosi, miso, sclk +//example...SPI spi(p5, p6, p7); // mosi, miso, sclk (if don't use ... NC(not connected)) + +//SPI spi(p5, NC, p7); // mosi, miso, sclk (if don't use ... NC(not connected)) +SPI spi(p11, NC, p13); // mosi(data), miso, sclk(clock) (if don't use ... NC(not connected)) LPD8806::LPD8806(uint16_t n) { // Allocate 3 bytes per pixel: @@ -30,8 +32,12 @@ // Setup the spi for 8 bit data, low steady state clock, // first edge capture, with a 2MHz clock rate +// spi.format(8,3); +// spi.frequency(2000000); spi.format(8,0); spi.frequency(2000000); +// spi2.format(8,0); +// spi2.frequency(2000000); // Issue initial latch to 'wake up' strip (latch length varies w/numLEDs) writezeros(3 * ((numLEDs + 63) / 64)); @@ -42,7 +48,10 @@ } void LPD8806::writezeros(uint16_t n) { - while (n--) spi.write(0x00); + while (n--){ + spi.write(0x00); +// spi2.write(0x00); + } } // This is how data is pushed to the strip. Unfortunately, the company @@ -54,6 +63,7 @@ for (i=0; i<nl3; i++ ) { spi.write(pixels[i]); +// spi2.write(pixels[i]); } // Write latch at end of data; latch length varies with number of LEDs