diff --git a/Adafruit_NeoPixel.cpp b/Adafruit_NeoPixel.cpp index a7142d76..b795a9a8 100644 --- a/Adafruit_NeoPixel.cpp +++ b/Adafruit_NeoPixel.cpp @@ -45,6 +45,10 @@ #include "Adafruit_NeoPixel.h" +#ifdef TARGET_LPC1768 + #include +#endif + #if defined(NRF52) || defined(NRF52_SERIES) #include "nrf.h" @@ -1846,6 +1850,50 @@ void Adafruit_NeoPixel::show(void) { } #endif +#elif defined(TARGET_LPC1768) + uint8_t *ptr, *end, p, bitMask; + ptr = pixels; + end = ptr + numBytes; + p = *ptr++; + bitMask = 0x80; + +#ifdef NEO_KHZ400 // 800 KHz check needed only if 400 KHz support enabled + if(is800KHz) { +#endif + for(;;) { + if(p & bitMask) { + // data ONE high + // min: 550 typ: 700 max: 5,500 + gpio_set(pin); + time::delay_ns(550); + // min: 450 typ: 600 max: 5,000 + gpio_clear(pin); + time::delay_ns(450); + } else { + // data ZERO high + // min: 200 typ: 350 max: 500 + gpio_set(pin); + time::delay_ns(200); + // data low + // min: 450 typ: 600 max: 5,000 + gpio_clear(pin); + time::delay_ns(450); + } + if(bitMask >>= 1) { + // Move on to the next pixel + asm("nop;"); + } else { + if(ptr >= end) break; + p = *ptr++; + bitMask = 0x80; + } + } +#ifdef NEO_KHZ400 + } else { // 400 KHz bitstream + // ToDo! + } +#endif + #elif defined (NRF51) uint8_t *p = pixels, pix, count, mask; diff --git a/Adafruit_NeoPixel.h b/Adafruit_NeoPixel.h index 6e40e07e..afec9f03 100644 --- a/Adafruit_NeoPixel.h +++ b/Adafruit_NeoPixel.h @@ -36,11 +36,17 @@ #ifndef ADAFRUIT_NEOPIXEL_H #define ADAFRUIT_NEOPIXEL_H -#if (ARDUINO >= 100) - #include -#else - #include - #include +#ifdef ARDUINO + #if (ARDUINO >= 100) + #include + #else + #include + #include + #endif +#endif + +#ifdef TARGET_LPC1768 + #include #endif // The order of primary colors in the NeoPixel data stream can vary among