Skip to content

Commit

Permalink
Finish LPC1768 support
Browse files Browse the repository at this point in the history
Due to some confusion on my part I left this code out of the PR.
  • Loading branch information
mikeshub committed Jul 30, 2019
1 parent 74b2e76 commit 0f78242
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
48 changes: 48 additions & 0 deletions Adafruit_NeoPixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@

#include "Adafruit_NeoPixel.h"

#ifdef TARGET_LPC1768
#include <time.h>
#endif

#if defined(NRF52) || defined(NRF52_SERIES)
#include "nrf.h"

Expand Down Expand Up @@ -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;
Expand Down
16 changes: 11 additions & 5 deletions Adafruit_NeoPixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@
#ifndef ADAFRUIT_NEOPIXEL_H
#define ADAFRUIT_NEOPIXEL_H

#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#include <pins_arduino.h>
#ifdef ARDUINO
#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#include <pins_arduino.h>
#endif
#endif

#ifdef TARGET_LPC1768
#include <Arduino.h>
#endif

// The order of primary colors in the NeoPixel data stream can vary among
Expand Down

0 comments on commit 0f78242

Please sign in to comment.