mirror of
https://github.com/AlexGyver/GyverLamp.git
synced 2025-08-06 16:17:20 +03:00
add
This commit is contained in:
2
libraries/FastLED-3.2.0/.gitignore
vendored
2
libraries/FastLED-3.2.0/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
html/
|
|
||||||
*.gch
|
|
@@ -1,181 +0,0 @@
|
|||||||
#include "FastLED.h"
|
|
||||||
|
|
||||||
FASTLED_USING_NAMESPACE
|
|
||||||
|
|
||||||
// FastLED "100-lines-of-code" demo reel, showing just a few
|
|
||||||
// of the kinds of animation patterns you can quickly and easily
|
|
||||||
// compose using FastLED.
|
|
||||||
//
|
|
||||||
// This example also shows one easy way to define multiple
|
|
||||||
// animations patterns and have them automatically rotate.
|
|
||||||
//
|
|
||||||
// -Mark Kriegsman, December 2014
|
|
||||||
|
|
||||||
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
|
|
||||||
#warning "Requires FastLED 3.1 or later; check github for latest code."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DATA_PIN 12
|
|
||||||
//#define CLK_PIN 4
|
|
||||||
#define LED_TYPE WS2811
|
|
||||||
#define COLOR_ORDER GRB
|
|
||||||
#define NUM_LEDS 27
|
|
||||||
CRGB leds[NUM_LEDS];
|
|
||||||
|
|
||||||
#define BRIGHTNESS 60
|
|
||||||
#define FRAMES_PER_SECOND 120
|
|
||||||
|
|
||||||
// -- The core to run FastLED.show()
|
|
||||||
#define FASTLED_SHOW_CORE 0
|
|
||||||
|
|
||||||
// -- Task handles for use in the notifications
|
|
||||||
static TaskHandle_t FastLEDshowTaskHandle = 0;
|
|
||||||
static TaskHandle_t userTaskHandle = 0;
|
|
||||||
|
|
||||||
/** show() for ESP32
|
|
||||||
* Call this function instead of FastLED.show(). It signals core 0 to issue a show,
|
|
||||||
* then waits for a notification that it is done.
|
|
||||||
*/
|
|
||||||
void FastLEDshowESP32()
|
|
||||||
{
|
|
||||||
if (userTaskHandle == 0) {
|
|
||||||
// -- Store the handle of the current task, so that the show task can
|
|
||||||
// notify it when it's done
|
|
||||||
userTaskHandle = xTaskGetCurrentTaskHandle();
|
|
||||||
|
|
||||||
// -- Trigger the show task
|
|
||||||
xTaskNotifyGive(FastLEDshowTaskHandle);
|
|
||||||
|
|
||||||
// -- Wait to be notified that it's done
|
|
||||||
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 );
|
|
||||||
ulTaskNotifyTake(pdTRUE, xMaxBlockTime);
|
|
||||||
userTaskHandle = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** show Task
|
|
||||||
* This function runs on core 0 and just waits for requests to call FastLED.show()
|
|
||||||
*/
|
|
||||||
void FastLEDshowTask(void *pvParameters)
|
|
||||||
{
|
|
||||||
// -- Run forever...
|
|
||||||
for(;;) {
|
|
||||||
// -- Wait for the trigger
|
|
||||||
ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
|
|
||||||
|
|
||||||
// -- Do the show (synchronously)
|
|
||||||
FastLED.show();
|
|
||||||
|
|
||||||
// -- Notify the calling task
|
|
||||||
xTaskNotifyGive(userTaskHandle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
delay(3000); // 3 second delay for recovery
|
|
||||||
Serial.begin(115200);
|
|
||||||
|
|
||||||
// tell FastLED about the LED strip configuration
|
|
||||||
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
|
|
||||||
//FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
|
|
||||||
|
|
||||||
// set master brightness control
|
|
||||||
FastLED.setBrightness(BRIGHTNESS);
|
|
||||||
|
|
||||||
int core = xPortGetCoreID();
|
|
||||||
Serial.print("Main code running on core ");
|
|
||||||
Serial.println(core);
|
|
||||||
|
|
||||||
// -- Create the FastLED show task
|
|
||||||
xTaskCreatePinnedToCore(FastLEDshowTask, "FastLEDshowTask", 2048, NULL, 2, &FastLEDshowTaskHandle, FASTLED_SHOW_CORE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// List of patterns to cycle through. Each is defined as a separate function below.
|
|
||||||
typedef void (*SimplePatternList[])();
|
|
||||||
SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm };
|
|
||||||
|
|
||||||
uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current
|
|
||||||
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
// Call the current pattern function once, updating the 'leds' array
|
|
||||||
gPatterns[gCurrentPatternNumber]();
|
|
||||||
|
|
||||||
// send the 'leds' array out to the actual LED strip
|
|
||||||
FastLEDshowESP32();
|
|
||||||
// FastLED.show();
|
|
||||||
// insert a delay to keep the framerate modest
|
|
||||||
FastLED.delay(1000/FRAMES_PER_SECOND);
|
|
||||||
|
|
||||||
// do some periodic updates
|
|
||||||
EVERY_N_MILLISECONDS( 20 ) { gHue++; } // slowly cycle the "base color" through the rainbow
|
|
||||||
EVERY_N_SECONDS( 10 ) { nextPattern(); } // change patterns periodically
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
|
|
||||||
|
|
||||||
void nextPattern()
|
|
||||||
{
|
|
||||||
// add one to the current pattern number, and wrap around at the end
|
|
||||||
gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rainbow()
|
|
||||||
{
|
|
||||||
// FastLED's built-in rainbow generator
|
|
||||||
fill_rainbow( leds, NUM_LEDS, gHue, 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rainbowWithGlitter()
|
|
||||||
{
|
|
||||||
// built-in FastLED rainbow, plus some random sparkly glitter
|
|
||||||
rainbow();
|
|
||||||
addGlitter(80);
|
|
||||||
}
|
|
||||||
|
|
||||||
void addGlitter( fract8 chanceOfGlitter)
|
|
||||||
{
|
|
||||||
if( random8() < chanceOfGlitter) {
|
|
||||||
leds[ random16(NUM_LEDS) ] += CRGB::White;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void confetti()
|
|
||||||
{
|
|
||||||
// random colored speckles that blink in and fade smoothly
|
|
||||||
fadeToBlackBy( leds, NUM_LEDS, 10);
|
|
||||||
int pos = random16(NUM_LEDS);
|
|
||||||
leds[pos] += CHSV( gHue + random8(64), 200, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
void sinelon()
|
|
||||||
{
|
|
||||||
// a colored dot sweeping back and forth, with fading trails
|
|
||||||
fadeToBlackBy( leds, NUM_LEDS, 20);
|
|
||||||
int pos = beatsin16( 13, 0, NUM_LEDS-1 );
|
|
||||||
leds[pos] += CHSV( gHue, 255, 192);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bpm()
|
|
||||||
{
|
|
||||||
// colored stripes pulsing at a defined Beats-Per-Minute (BPM)
|
|
||||||
uint8_t BeatsPerMinute = 62;
|
|
||||||
CRGBPalette16 palette = PartyColors_p;
|
|
||||||
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
|
|
||||||
for( int i = 0; i < NUM_LEDS; i++) { //9948
|
|
||||||
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void juggle() {
|
|
||||||
// eight colored dots, weaving in and out of sync with each other
|
|
||||||
fadeToBlackBy( leds, NUM_LEDS, 20);
|
|
||||||
byte dothue = 0;
|
|
||||||
for( int i = 0; i < 8; i++) {
|
|
||||||
leds[beatsin16( i+7, 0, NUM_LEDS-1 )] |= CHSV(dothue, 200, 255);
|
|
||||||
dothue += 32;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@@ -1,70 +0,0 @@
|
|||||||
#include <FastLED.h>
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// RGB Calibration code
|
|
||||||
//
|
|
||||||
// Use this sketch to determine what the RGB ordering for your chipset should be. Steps for setting up to use:
|
|
||||||
|
|
||||||
// * Uncomment the line in setup that corresponds to the LED chipset that you are using. (Note that they
|
|
||||||
// all explicitly specify the RGB order as RGB)
|
|
||||||
// * Define DATA_PIN to the pin that data is connected to.
|
|
||||||
// * (Optional) if using software SPI for chipsets that are SPI based, define CLOCK_PIN to the clock pin
|
|
||||||
// * Compile/upload/run the sketch
|
|
||||||
|
|
||||||
// You should see six leds on. If the RGB ordering is correct, you should see 1 red led, 2 green
|
|
||||||
// leds, and 3 blue leds. If you see different colors, the count of each color tells you what the
|
|
||||||
// position for that color in the rgb orering should be. So, for example, if you see 1 Blue, and 2
|
|
||||||
// Red, and 3 Green leds then the rgb ordering should be BRG (Blue, Red, Green).
|
|
||||||
|
|
||||||
// You can then test this ordering by setting the RGB ordering in the addLeds line below to the new ordering
|
|
||||||
// and it should come out correctly, 1 red, 2 green, and 3 blue.
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#define NUM_LEDS 6
|
|
||||||
|
|
||||||
// Data pin that led data will be written out over
|
|
||||||
#define DATA_PIN 6
|
|
||||||
// Clock pin only needed for SPI based chipsets when not using hardware SPI
|
|
||||||
//#define CLOCK_PIN 8
|
|
||||||
|
|
||||||
CRGB leds[NUM_LEDS];
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
// sanity check delay - allows reprogramming if accidently blowing power w/leds
|
|
||||||
delay(2000);
|
|
||||||
|
|
||||||
// Uncomment one of the following lines for your leds arrangement.
|
|
||||||
// FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.setBrightness(CRGB(255,255,255));
|
|
||||||
// FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
|
|
||||||
// FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
|
|
||||||
FastLED.addLeds<LPD8806, 9, 10, RGB>(leds, NUM_LEDS);
|
|
||||||
|
|
||||||
// FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
// FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
leds[0] = CRGB(255,0,0);
|
|
||||||
leds[1] = CRGB(0,255,0);
|
|
||||||
leds[2] = CRGB(0,255,0);
|
|
||||||
leds[3] = CRGB(0,0,255);
|
|
||||||
leds[4] = CRGB(0,0,255);
|
|
||||||
leds[5] = CRGB(0,0,255);
|
|
||||||
FastLED.show();
|
|
||||||
delay(1000);
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "fastpin_esp32.h"
|
|
||||||
#include "clockless_esp32.h"
|
|
||||||
// #include "clockless_block_esp32.h"
|
|
@@ -4,19 +4,16 @@
|
|||||||
///@file FastLED.h
|
///@file FastLED.h
|
||||||
/// central include file for FastLED, defines the CFastLED class/object
|
/// central include file for FastLED, defines the CFastLED class/object
|
||||||
|
|
||||||
#define xstr(s) str(s)
|
|
||||||
#define str(s) #s
|
|
||||||
|
|
||||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
|
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
|
||||||
#define FASTLED_HAS_PRAGMA_MESSAGE
|
#define FASTLED_HAS_PRAGMA_MESSAGE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FASTLED_VERSION 3002000
|
#define FASTLED_VERSION 3002009
|
||||||
#ifndef FASTLED_INTERNAL
|
#ifndef FASTLED_INTERNAL
|
||||||
# ifdef FASTLED_HAS_PRAGMA_MESSAGE
|
# ifdef FASTLED_HAS_PRAGMA_MESSAGE
|
||||||
# pragma message "FastLED version 3.002.000"
|
# pragma message "FastLED version 3.002.009"
|
||||||
# else
|
# else
|
||||||
# warning FastLED version 3.002.000 (Not really a warning, just telling you here.)
|
# warning FastLED version 3.002.009 (Not really a warning, just telling you here.)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -72,6 +69,7 @@ FASTLED_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
/// definitions for the spi chipset constants
|
/// definitions for the spi chipset constants
|
||||||
enum ESPIChipsets {
|
enum ESPIChipsets {
|
||||||
|
LPD6803,
|
||||||
LPD8806,
|
LPD8806,
|
||||||
WS2801,
|
WS2801,
|
||||||
WS2803,
|
WS2803,
|
||||||
@@ -92,6 +90,7 @@ template<uint8_t DATA_PIN, EOrder RGB_ORDER> class PIXIE : public PixieControlle
|
|||||||
|
|
||||||
#ifdef FASTLED_HAS_CLOCKLESS
|
#ifdef FASTLED_HAS_CLOCKLESS
|
||||||
template<uint8_t DATA_PIN> class NEOPIXEL : public WS2812Controller800Khz<DATA_PIN, GRB> {};
|
template<uint8_t DATA_PIN> class NEOPIXEL : public WS2812Controller800Khz<DATA_PIN, GRB> {};
|
||||||
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SM16703 : public SM16703Controller<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1829 : public TM1829Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1829 : public TM1829Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1812 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1812 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1809 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class TM1809 : public TM1809Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
@@ -104,6 +103,7 @@ template<uint8_t DATA_PIN, EOrder RGB_ORDER> class UCS2903 : public UCS2903Contr
|
|||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2852 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2852 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812B : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812B : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GS1903 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6812 : public SK6812Controller<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6812 : public SK6812Controller<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6822 : public SK6822Controller<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class SK6822 : public SK6822Controller<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA106 : public SK6822Controller<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA106 : public SK6822Controller<DATA_PIN, RGB_ORDER> {};
|
||||||
@@ -112,6 +112,7 @@ template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2811 : public WS2811Control
|
|||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2813 : public WS2813Controller<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2813 : public WS2813Controller<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA104 : public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class APA104 : public WS2811Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2811_400 : public WS2811Controller400Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2811_400 : public WS2811Controller400Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GE8822 : public GE8822Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GW6205 : public GW6205Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GW6205 : public GW6205Controller800Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GW6205_400 : public GW6205Controller400Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class GW6205_400 : public GW6205Controller400Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class LPD1886 : public LPD1886Controller1250Khz<DATA_PIN, RGB_ORDER> {};
|
template<uint8_t DATA_PIN, EOrder RGB_ORDER> class LPD1886 : public LPD1886Controller1250Khz<DATA_PIN, RGB_ORDER> {};
|
||||||
@@ -221,6 +222,7 @@ public:
|
|||||||
/// @returns a reference to the added controller
|
/// @returns a reference to the added controller
|
||||||
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER, uint8_t SPI_DATA_RATE > CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
|
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER, uint8_t SPI_DATA_RATE > CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
|
||||||
switch(CHIPSET) {
|
switch(CHIPSET) {
|
||||||
|
case LPD6803: { static LPD6803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_DATA_RATE> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
@@ -234,6 +236,7 @@ public:
|
|||||||
|
|
||||||
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
|
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
|
||||||
switch(CHIPSET) {
|
switch(CHIPSET) {
|
||||||
|
case LPD6803: { static LPD6803Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
@@ -247,6 +250,7 @@ public:
|
|||||||
|
|
||||||
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
|
template<ESPIChipsets CHIPSET, uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER > static CLEDController &addLeds(struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset = 0) {
|
||||||
switch(CHIPSET) {
|
switch(CHIPSET) {
|
||||||
|
case LPD6803: { static LPD6803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case LPD8806: { static LPD8806Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case WS2801: { static WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
||||||
case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
case WS2803: { static WS2803Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER> c; return addLeds(&c, data, nLedsOrOffset, nLedsIfOffset); }
|
@@ -1,9 +1,10 @@
|
|||||||
[](https://gitter.im/FastLED/public)
|
[](https://gitter.im/FastLED/public)
|
||||||
|
[](https://www.ardu-badge.com/FastLED)
|
||||||
|
|
||||||
IMPORTANT NOTE: For AVR based systems, avr-gcc 4.8.x is supported and tested. This means Arduino 1.6.5 and later.
|
IMPORTANT NOTE: For AVR based systems, avr-gcc 4.8.x is supported and tested. This means Arduino 1.6.5 and later.
|
||||||
|
|
||||||
|
|
||||||
FastLED 3.1
|
FastLED 3.2
|
||||||
===========
|
===========
|
||||||
|
|
||||||
This is a library for easily & efficiently controlling a wide variety of LED chipsets, like the ones
|
This is a library for easily & efficiently controlling a wide variety of LED chipsets, like the ones
|
||||||
@@ -22,7 +23,7 @@ We have multiple goals with this library:
|
|||||||
|
|
||||||
## Getting help
|
## Getting help
|
||||||
|
|
||||||
If you need help with using the library, please consider going to the google+ community first, which is at http://fastled.io/+ - there are hundreds of people in that group and many times you will get a quicker answer to your question there, as you will be likely to run into other people who have had the same issue. If you run into bugs with the library (compilation failures, the library doing the wrong thing), or if you'd like to request that we support a particular platform or LED chipset, then please open an issue at http://fastled.io/issues and we will try to figure out what is going wrong.
|
If you need help with using the library, please consider going to the reddit community first, which is at http://fastled.io/r (or https://reddit.com/r/FastLED) - there are hundreds of people in that group and many times you will get a quicker answer to your question there, as you will be likely to run into other people who have had the same issue. If you run into bugs with the library (compilation failures, the library doing the wrong thing), or if you'd like to request that we support a particular platform or LED chipset, then please open an issue at http://fastled.io/issues and we will try to figure out what is going wrong.
|
||||||
|
|
||||||
## Simple example
|
## Simple example
|
||||||
|
|
||||||
@@ -54,9 +55,10 @@ Here's a list of all the LED chipsets are supported. More details on the led ch
|
|||||||
* P9813 - aka Cool Neon's Total Control Lighting
|
* P9813 - aka Cool Neon's Total Control Lighting
|
||||||
* DMX - send rgb data out over DMX using arduino DMX libraries
|
* DMX - send rgb data out over DMX using arduino DMX libraries
|
||||||
* SmartMatrix panels - needs the SmartMatrix library - https://github.com/pixelmatix/SmartMatrix
|
* SmartMatrix panels - needs the SmartMatrix library - https://github.com/pixelmatix/SmartMatrix
|
||||||
|
* LPD6803 - SPI based chpiset, chip CMODE pin must be set to 1 (inside oscillator mode)
|
||||||
|
|
||||||
|
|
||||||
LPD6803, HL1606, and "595"-style shift registers are no longer supported by the library. The older Version 1 of the library ("FastSPI_LED") has support for these, but is missing many of the advanced features of current versions and is no longer being maintained.
|
HL1606, and "595"-style shift registers are no longer supported by the library. The older Version 1 of the library ("FastSPI_LED") has support for these, but is missing many of the advanced features of current versions and is no longer being maintained.
|
||||||
|
|
||||||
|
|
||||||
## Supported platforms
|
## Supported platforms
|
@@ -143,6 +143,53 @@ protected:
|
|||||||
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(25)>
|
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(25)>
|
||||||
class WS2803Controller : public WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {};
|
class WS2803Controller : public WS2801Controller<DATA_PIN, CLOCK_PIN, RGB_ORDER, SPI_SPEED> {};
|
||||||
|
|
||||||
|
/// LPD6803 controller class (LPD1101).
|
||||||
|
/// 16 bit (1 bit - const "1", 5 bit - red, 5 bit - green, 5 bit blue).
|
||||||
|
/// In chip CMODE pin must be set to 1 (inside oscillator mode).
|
||||||
|
/// Datasheet: https://cdn-shop.adafruit.com/datasheets/LPD6803.pdf
|
||||||
|
/// @tparam DATA_PIN the data pin for these leds
|
||||||
|
/// @tparam CLOCK_PIN the clock pin for these leds
|
||||||
|
/// @tparam RGB_ORDER the RGB ordering for these leds
|
||||||
|
/// @tparam SPI_SPEED the clock divider used for these leds. Set using the DATA_RATE_MHZ/DATA_RATE_KHZ macros. Defaults to DATA_RATE_MHZ(12)
|
||||||
|
template <uint8_t DATA_PIN, uint8_t CLOCK_PIN, EOrder RGB_ORDER = RGB, uint8_t SPI_SPEED = DATA_RATE_MHZ(12)>
|
||||||
|
class LPD6803Controller : public CPixelLEDController<RGB_ORDER> {
|
||||||
|
typedef SPIOutput<DATA_PIN, CLOCK_PIN, SPI_SPEED> SPI;
|
||||||
|
SPI mSPI;
|
||||||
|
|
||||||
|
void startBoundary() { mSPI.writeByte(0); mSPI.writeByte(0); mSPI.writeByte(0); mSPI.writeByte(0); }
|
||||||
|
|
||||||
|
public:
|
||||||
|
LPD6803Controller() {}
|
||||||
|
|
||||||
|
virtual void init() {
|
||||||
|
mSPI.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
|
||||||
|
mSPI.select();
|
||||||
|
|
||||||
|
startBoundary();
|
||||||
|
while(pixels.has(1)) {
|
||||||
|
register uint16_t command;
|
||||||
|
command = 0x8000;
|
||||||
|
command |= (pixels.loadAndScale0() & 0xF8) << 7; // red is the high 5 bits
|
||||||
|
command |= (pixels.loadAndScale1() & 0xF8) << 2; // green is the middle 5 bits
|
||||||
|
mSPI.writeByte((command >> 8) & 0xFF);
|
||||||
|
command |= pixels.loadAndScale2() >> 3 ; // blue is the low 5 bits
|
||||||
|
mSPI.writeByte(command & 0xFF);
|
||||||
|
|
||||||
|
pixels.stepDithering();
|
||||||
|
pixels.advanceData();
|
||||||
|
}
|
||||||
|
//endBoundary(pixels.size());
|
||||||
|
mSPI.waitFully();
|
||||||
|
mSPI.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// APA102 definition - takes data/clock/select pin values (N.B. should take an SPI definition?)
|
// APA102 definition - takes data/clock/select pin values (N.B. should take an SPI definition?)
|
||||||
@@ -162,8 +209,19 @@ class APA102Controller : public CPixelLEDController<RGB_ORDER> {
|
|||||||
void startBoundary() { mSPI.writeWord(0); mSPI.writeWord(0); }
|
void startBoundary() { mSPI.writeWord(0); mSPI.writeWord(0); }
|
||||||
void endBoundary(int nLeds) { int nDWords = (nLeds/32); do { mSPI.writeByte(0xFF); mSPI.writeByte(0x00); mSPI.writeByte(0x00); mSPI.writeByte(0x00); } while(nDWords--); }
|
void endBoundary(int nLeds) { int nDWords = (nLeds/32); do { mSPI.writeByte(0xFF); mSPI.writeByte(0x00); mSPI.writeByte(0x00); mSPI.writeByte(0x00); } while(nDWords--); }
|
||||||
|
|
||||||
inline void writeLed(uint8_t b0, uint8_t b1, uint8_t b2) __attribute__((always_inline)) {
|
inline void writeLed(uint8_t brightness, uint8_t b0, uint8_t b1, uint8_t b2) __attribute__((always_inline)) {
|
||||||
mSPI.writeByte(0xFF); mSPI.writeByte(b0); mSPI.writeByte(b1); mSPI.writeByte(b2);
|
#ifdef FASTLED_SPI_BYTE_ONLY
|
||||||
|
mSPI.writeByte(0xE0 | brightness);
|
||||||
|
mSPI.writeByte(b0);
|
||||||
|
mSPI.writeByte(b1);
|
||||||
|
mSPI.writeByte(b2);
|
||||||
|
#else
|
||||||
|
uint16_t b = 0xE000 | (brightness << 8) | (uint16_t)b0;
|
||||||
|
mSPI.writeWord(b);
|
||||||
|
uint16_t w = b1 << 8;
|
||||||
|
w |= b2;
|
||||||
|
mSPI.writeWord(w);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -178,24 +236,25 @@ protected:
|
|||||||
virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
|
virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
|
||||||
mSPI.select();
|
mSPI.select();
|
||||||
|
|
||||||
startBoundary();
|
uint8_t s0 = pixels.getScale0(), s1 = pixels.getScale1(), s2 = pixels.getScale2();
|
||||||
while(pixels.has(1)) {
|
#if FASTLED_USE_GLOBAL_BRIGHTNESS == 1
|
||||||
#ifdef FASTLED_SPI_BYTE_ONLY
|
const uint16_t maxBrightness = 0x1F;
|
||||||
mSPI.writeByte(0xFF);
|
uint16_t brightness = ((((uint16_t)max(max(s0, s1), s2) + 1) * maxBrightness - 1) >> 8) + 1;
|
||||||
mSPI.writeByte(pixels.loadAndScale0());
|
s0 = (maxBrightness * s0 + (brightness >> 1)) / brightness;
|
||||||
mSPI.writeByte(pixels.loadAndScale1());
|
s1 = (maxBrightness * s1 + (brightness >> 1)) / brightness;
|
||||||
mSPI.writeByte(pixels.loadAndScale2());
|
s2 = (maxBrightness * s2 + (brightness >> 1)) / brightness;
|
||||||
#else
|
#else
|
||||||
uint16_t b = 0xFF00 | (uint16_t)pixels.loadAndScale0();
|
const uint8_t brightness = 0x1F;
|
||||||
mSPI.writeWord(b);
|
|
||||||
uint16_t w = pixels.loadAndScale1() << 8;
|
|
||||||
w |= pixels.loadAndScale2();
|
|
||||||
mSPI.writeWord(w);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
startBoundary();
|
||||||
|
while (pixels.has(1)) {
|
||||||
|
writeLed(brightness, pixels.loadAndScale0(0, s0), pixels.loadAndScale1(0, s1), pixels.loadAndScale2(0, s2));
|
||||||
pixels.stepDithering();
|
pixels.stepDithering();
|
||||||
pixels.advanceData();
|
pixels.advanceData();
|
||||||
}
|
}
|
||||||
endBoundary(pixels.size());
|
endBoundary(pixels.size());
|
||||||
|
|
||||||
mSPI.waitFully();
|
mSPI.waitFully();
|
||||||
mSPI.release();
|
mSPI.release();
|
||||||
}
|
}
|
||||||
@@ -215,8 +274,19 @@ class SK9822Controller : public CPixelLEDController<RGB_ORDER> {
|
|||||||
void startBoundary() { mSPI.writeWord(0); mSPI.writeWord(0); }
|
void startBoundary() { mSPI.writeWord(0); mSPI.writeWord(0); }
|
||||||
void endBoundary(int nLeds) { int nLongWords = (nLeds/32); do { mSPI.writeByte(0x00); mSPI.writeByte(0x00); mSPI.writeByte(0x00); mSPI.writeByte(0x00); } while(nLongWords--); }
|
void endBoundary(int nLeds) { int nLongWords = (nLeds/32); do { mSPI.writeByte(0x00); mSPI.writeByte(0x00); mSPI.writeByte(0x00); mSPI.writeByte(0x00); } while(nLongWords--); }
|
||||||
|
|
||||||
inline void writeLed(uint8_t b0, uint8_t b1, uint8_t b2) __attribute__((always_inline)) {
|
inline void writeLed(uint8_t brightness, uint8_t b0, uint8_t b1, uint8_t b2) __attribute__((always_inline)) {
|
||||||
mSPI.writeByte(0xFF); mSPI.writeByte(b0); mSPI.writeByte(b1); mSPI.writeByte(b2);
|
#ifdef FASTLED_SPI_BYTE_ONLY
|
||||||
|
mSPI.writeByte(0xE0 | brightness);
|
||||||
|
mSPI.writeByte(b0);
|
||||||
|
mSPI.writeByte(b1);
|
||||||
|
mSPI.writeByte(b2);
|
||||||
|
#else
|
||||||
|
uint16_t b = 0xE000 | (brightness << 8) | (uint16_t)b0;
|
||||||
|
mSPI.writeWord(b);
|
||||||
|
uint16_t w = b1 << 8;
|
||||||
|
w |= b2;
|
||||||
|
mSPI.writeWord(w);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -231,20 +301,20 @@ protected:
|
|||||||
virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
|
virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
|
||||||
mSPI.select();
|
mSPI.select();
|
||||||
|
|
||||||
startBoundary();
|
uint8_t s0 = pixels.getScale0(), s1 = pixels.getScale1(), s2 = pixels.getScale2();
|
||||||
while(pixels.has(1)) {
|
#if FASTLED_USE_GLOBAL_BRIGHTNESS == 1
|
||||||
#ifdef FASTLED_SPI_BYTE_ONLY
|
const uint16_t maxBrightness = 0x1F;
|
||||||
mSPI.writeByte(0xFF);
|
uint16_t brightness = ((((uint16_t)max(max(s0, s1), s2) + 1) * maxBrightness - 1) >> 8) + 1;
|
||||||
mSPI.writeByte(pixels.loadAndScale0());
|
s0 = (maxBrightness * s0 + (brightness >> 1)) / brightness;
|
||||||
mSPI.writeByte(pixels.loadAndScale1());
|
s1 = (maxBrightness * s1 + (brightness >> 1)) / brightness;
|
||||||
mSPI.writeByte(pixels.loadAndScale2());
|
s2 = (maxBrightness * s2 + (brightness >> 1)) / brightness;
|
||||||
#else
|
#else
|
||||||
uint16_t b = 0xFF00 | (uint16_t)pixels.loadAndScale0();
|
const uint8_t brightness = 0x1F;
|
||||||
mSPI.writeWord(b);
|
|
||||||
uint16_t w = pixels.loadAndScale1() << 8;
|
|
||||||
w |= pixels.loadAndScale2();
|
|
||||||
mSPI.writeWord(w);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
startBoundary();
|
||||||
|
while (pixels.has(1)) {
|
||||||
|
writeLed(brightness, pixels.loadAndScale0(0, s0), pixels.loadAndScale1(0, s1), pixels.loadAndScale2(0, s2));
|
||||||
pixels.stepDithering();
|
pixels.stepDithering();
|
||||||
pixels.advanceData();
|
pixels.advanceData();
|
||||||
}
|
}
|
||||||
@@ -358,6 +428,16 @@ protected:
|
|||||||
//
|
//
|
||||||
// Clockless template instantiations - see clockless.h for how the timing values are used
|
// Clockless template instantiations - see clockless.h for how the timing values are used
|
||||||
//
|
//
|
||||||
|
// Base template for clockless controllers. These controllers have 3 control points in their cycle for each bit.
|
||||||
|
// At T=0 : the line is raised hi to start a bit
|
||||||
|
// At T=T1 : the line is dropped low to transmit a zero bit
|
||||||
|
// At T=T1+T2 : the line is dropped low to transmit a one bit
|
||||||
|
// At T=T1+T2+T3 : the cycle is concluded (next bit can be sent)
|
||||||
|
//
|
||||||
|
// The units used for T1, T2, and T3 is nanoseconds.
|
||||||
|
// For 8MHz/16MHz/24MHz frequencies, these values are also guaranteed
|
||||||
|
// to be integral multiples of an 8MHz clock (125ns increments).
|
||||||
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef FASTLED_HAS_CLOCKLESS
|
#ifdef FASTLED_HAS_CLOCKLESS
|
||||||
@@ -365,10 +445,21 @@ protected:
|
|||||||
/// Provides timing definitions for the variety of clockless controllers supplied by the library.
|
/// Provides timing definitions for the variety of clockless controllers supplied by the library.
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
// Allow clock that clockless controller is based on to have different
|
||||||
|
// frequency than the CPU.
|
||||||
|
#if !defined(CLOCKLESS_FREQUENCY)
|
||||||
|
#define CLOCKLESS_FREQUENCY F_CPU
|
||||||
|
#endif
|
||||||
|
|
||||||
// We want to force all avr's to use the Trinket controller when running at 8Mhz, because even the 328's at 8Mhz
|
// We want to force all avr's to use the Trinket controller when running at 8Mhz, because even the 328's at 8Mhz
|
||||||
// need the more tightly defined timeframes.
|
// need the more tightly defined timeframes.
|
||||||
#if (F_CPU == 8000000 || F_CPU == 16000000 || F_CPU == 24000000) // || F_CPU == 48000000 || F_CPU == 96000000) // 125ns/clock
|
#if (CLOCKLESS_FREQUENCY == 8000000 || CLOCKLESS_FREQUENCY == 16000000 || CLOCKLESS_FREQUENCY == 24000000) // || CLOCKLESS_FREQUENCY == 48000000 || CLOCKLESS_FREQUENCY == 96000000) // 125ns/clock
|
||||||
#define FMUL (F_CPU/8000000)
|
#define FMUL (CLOCKLESS_FREQUENCY/8000000)
|
||||||
|
|
||||||
|
// GE8822
|
||||||
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
|
class GE8822Controller800Khz : public ClocklessController<DATA_PIN, 3 * FMUL, 5 * FMUL, 3 * FMUL, RGB_ORDER, 4> {};
|
||||||
|
|
||||||
// LPD1886
|
// LPD1886
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class LPD1886Controller1250Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 3 * FMUL, 2 * FMUL, RGB_ORDER, 4> {};
|
class LPD1886Controller1250Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 3 * FMUL, 2 * FMUL, RGB_ORDER, 4> {};
|
||||||
@@ -393,6 +484,9 @@ class WS2811Controller400Khz : public ClocklessController<DATA_PIN, 4 * FMUL, 10
|
|||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class SK6822Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
|
class SK6822Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
|
||||||
|
|
||||||
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
|
class SM16703Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 4 * FMUL, 3 * FMUL, RGB_ORDER> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class SK6812Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 3 * FMUL, 4 * FMUL, RGB_ORDER> {};
|
class SK6812Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 3 * FMUL, 4 * FMUL, RGB_ORDER> {};
|
||||||
|
|
||||||
@@ -415,7 +509,7 @@ template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
|||||||
class TM1803Controller400Khz : public ClocklessController<DATA_PIN, 6 * FMUL, 9 * FMUL, 6 * FMUL, RGB_ORDER> {};
|
class TM1803Controller400Khz : public ClocklessController<DATA_PIN, 6 * FMUL, 9 * FMUL, 6 * FMUL, RGB_ORDER> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class TM1829Controller800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 5 * FMUL, 3 * FMUL, RGB_ORDER> {};
|
class TM1829Controller800Khz : public ClocklessController<DATA_PIN, 2 * FMUL, 5 * FMUL, 3 * FMUL, RGB_ORDER, 0, true, 500> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class GW6205Controller400Khz : public ClocklessController<DATA_PIN, 6 * FMUL, 7 * FMUL, 6 * FMUL, RGB_ORDER, 4> {};
|
class GW6205Controller400Khz : public ClocklessController<DATA_PIN, 6 * FMUL, 7 * FMUL, 6 * FMUL, RGB_ORDER, 4> {};
|
||||||
@@ -427,75 +521,87 @@ template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
|||||||
class PL9823Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
|
class PL9823Controller : public ClocklessController<DATA_PIN, 3 * FMUL, 8 * FMUL, 3 * FMUL, RGB_ORDER> {};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
// Similar to NS() macro, this calculates the number of cycles for
|
||||||
|
// the clockless chipset (which may differ from CPU cycles)
|
||||||
|
#define C_NS(_NS) (((_NS * ((CLOCKLESS_FREQUENCY / 1000000L)) + 999)) / 1000)
|
||||||
|
|
||||||
|
// GE8822 - 350ns 660ns 350ns
|
||||||
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
|
class GE8822Controller800Khz : public ClocklessController<DATA_PIN, C_NS(350), C_NS(660), C_NS(350), RGB_ORDER, 4> {};
|
||||||
|
|
||||||
// GW6205@400khz - 800ns, 800ns, 800ns
|
// GW6205@400khz - 800ns, 800ns, 800ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class GW6205Controller400Khz : public ClocklessController<DATA_PIN, NS(800), NS(800), NS(800), RGB_ORDER, 4> {};
|
class GW6205Controller400Khz : public ClocklessController<DATA_PIN, C_NS(800), C_NS(800), C_NS(800), RGB_ORDER, 4> {};
|
||||||
|
|
||||||
// GW6205@400khz - 400ns, 400ns, 400ns
|
// GW6205@400khz - 400ns, 400ns, 400ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class GW6205Controller800Khz : public ClocklessController<DATA_PIN, NS(400), NS(400), NS(400), RGB_ORDER, 4> {};
|
class GW6205Controller800Khz : public ClocklessController<DATA_PIN, C_NS(400), C_NS(400), C_NS(400), RGB_ORDER, 4> {};
|
||||||
|
|
||||||
// UCS1903 - 500ns, 1500ns, 500ns
|
// UCS1903 - 500ns, 1500ns, 500ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class UCS1903Controller400Khz : public ClocklessController<DATA_PIN, NS(500), NS(1500), NS(500), RGB_ORDER> {};
|
class UCS1903Controller400Khz : public ClocklessController<DATA_PIN, C_NS(500), C_NS(1500), C_NS(500), RGB_ORDER> {};
|
||||||
|
|
||||||
// UCS1903B - 400ns, 450ns, 450ns
|
// UCS1903B - 400ns, 450ns, 450ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class UCS1903BController800Khz : public ClocklessController<DATA_PIN, NS(400), NS(450), NS(450), RGB_ORDER> {};
|
class UCS1903BController800Khz : public ClocklessController<DATA_PIN, C_NS(400), C_NS(450), C_NS(450), RGB_ORDER> {};
|
||||||
|
|
||||||
// UCS1904 - 400ns, 400ns, 450ns
|
// UCS1904 - 400ns, 400ns, 450ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class UCS1904Controller800Khz : public ClocklessController<DATA_PIN, NS(400), NS(400), NS(450), RGB_ORDER> {};
|
class UCS1904Controller800Khz : public ClocklessController<DATA_PIN, C_NS(400), C_NS(400), C_NS(450), RGB_ORDER> {};
|
||||||
|
|
||||||
// UCS2903 - 250ns, 750ns, 250ns
|
// UCS2903 - 250ns, 750ns, 250ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class UCS2903Controller : public ClocklessController<DATA_PIN, NS(250), NS(750), NS(250), RGB_ORDER> {};
|
class UCS2903Controller : public ClocklessController<DATA_PIN, C_NS(250), C_NS(750), C_NS(250), RGB_ORDER> {};
|
||||||
|
|
||||||
// TM1809 - 350ns, 350ns, 550ns
|
// TM1809 - 350ns, 350ns, 550ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class TM1809Controller800Khz : public ClocklessController<DATA_PIN, NS(350), NS(350), NS(450), RGB_ORDER> {};
|
class TM1809Controller800Khz : public ClocklessController<DATA_PIN, C_NS(350), C_NS(350), C_NS(450), RGB_ORDER> {};
|
||||||
|
|
||||||
// WS2811 - 320ns, 320ns, 640ns
|
// WS2811 - 320ns, 320ns, 640ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class WS2811Controller800Khz : public ClocklessController<DATA_PIN, NS(320), NS(320), NS(640), RGB_ORDER> {};
|
class WS2811Controller800Khz : public ClocklessController<DATA_PIN, C_NS(320), C_NS(320), C_NS(640), RGB_ORDER> {};
|
||||||
|
|
||||||
// WS2813 - 320ns, 320ns, 640ns
|
// WS2813 - 320ns, 320ns, 640ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class WS2813Controller : public ClocklessController<DATA_PIN, NS(320), NS(320), NS(640), RGB_ORDER> {};
|
class WS2813Controller : public ClocklessController<DATA_PIN, C_NS(320), C_NS(320), C_NS(640), RGB_ORDER> {};
|
||||||
|
|
||||||
// WS2812 - 250ns, 625ns, 375ns
|
// WS2812 - 250ns, 625ns, 375ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class WS2812Controller800Khz : public ClocklessController<DATA_PIN, NS(250), NS(625), NS(375), RGB_ORDER> {};
|
class WS2812Controller800Khz : public ClocklessController<DATA_PIN, C_NS(250), C_NS(625), C_NS(375), RGB_ORDER> {};
|
||||||
|
|
||||||
// WS2811@400khz - 800ns, 800ns, 900ns
|
// WS2811@400khz - 800ns, 800ns, 900ns
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class WS2811Controller400Khz : public ClocklessController<DATA_PIN, NS(800), NS(800), NS(900), RGB_ORDER> {};
|
class WS2811Controller400Khz : public ClocklessController<DATA_PIN, C_NS(800), C_NS(800), C_NS(900), RGB_ORDER> {};
|
||||||
|
|
||||||
// 750NS, 750NS, 750NS
|
// 750NS, 750NS, 750NS
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class TM1803Controller400Khz : public ClocklessController<DATA_PIN, NS(700), NS(1100), NS(700), RGB_ORDER> {};
|
class TM1803Controller400Khz : public ClocklessController<DATA_PIN, C_NS(700), C_NS(1100), C_NS(700), RGB_ORDER> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class TM1829Controller800Khz : public ClocklessController<DATA_PIN, NS(340), NS(340), NS(550), RGB_ORDER, 0, true, 500> {};
|
class TM1829Controller800Khz : public ClocklessController<DATA_PIN, C_NS(340), C_NS(340), C_NS(550), RGB_ORDER, 0, true, 500> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class TM1829Controller1600Khz : public ClocklessController<DATA_PIN, NS(100), NS(300), NS(200), RGB_ORDER, 0, true, 500> {};
|
class TM1829Controller1600Khz : public ClocklessController<DATA_PIN, C_NS(100), C_NS(300), C_NS(200), RGB_ORDER, 0, true, 500> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class LPD1886Controller1250Khz : public ClocklessController<DATA_PIN, NS(200), NS(400), NS(200), RGB_ORDER, 4> {};
|
class LPD1886Controller1250Khz : public ClocklessController<DATA_PIN, C_NS(200), C_NS(400), C_NS(200), RGB_ORDER, 4> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class LPD1886Controller1250Khz_8bit : public ClocklessController<DATA_PIN, NS(200), NS(400), NS(200), RGB_ORDER> {};
|
class LPD1886Controller1250Khz_8bit : public ClocklessController<DATA_PIN, C_NS(200), C_NS(400), C_NS(200), RGB_ORDER> {};
|
||||||
|
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class SK6822Controller : public ClocklessController<DATA_PIN, NS(375), NS(1000), NS(375), RGB_ORDER> {};
|
class SK6822Controller : public ClocklessController<DATA_PIN, C_NS(375), C_NS(1000), C_NS(375), RGB_ORDER> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class SK6812Controller : public ClocklessController<DATA_PIN, NS(300), NS(300), NS(600), RGB_ORDER> {};
|
class SK6812Controller : public ClocklessController<DATA_PIN, C_NS(300), C_NS(300), C_NS(600), RGB_ORDER> {};
|
||||||
|
|
||||||
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
class PL9823Controller : public ClocklessController<DATA_PIN, NS(350), NS(1010), NS(350), RGB_ORDER> {};
|
class SM16703Controller : public ClocklessController<DATA_PIN, C_NS(300), C_NS(600), C_NS(300), RGB_ORDER> {};
|
||||||
|
|
||||||
|
template <uint8_t DATA_PIN, EOrder RGB_ORDER = RGB>
|
||||||
|
class PL9823Controller : public ClocklessController<DATA_PIN, C_NS(350), C_NS(1010), C_NS(350), RGB_ORDER> {};
|
||||||
#endif
|
#endif
|
||||||
///@}
|
///@}
|
||||||
|
|
1
libraries/FastLED-3.2.9/component.mk
Normal file
1
libraries/FastLED-3.2.9/component.mk
Normal file
@@ -0,0 +1 @@
|
|||||||
|
COMPONENT_ADD_INCLUDEDIRS := .
|
@@ -357,11 +357,18 @@ struct PixelController {
|
|||||||
|
|
||||||
template<int SLOT> __attribute__((always_inline)) inline static uint8_t advanceAndLoadAndScale(PixelController & pc) { pc.advanceData(); return pc.loadAndScale<SLOT>(pc); }
|
template<int SLOT> __attribute__((always_inline)) inline static uint8_t advanceAndLoadAndScale(PixelController & pc) { pc.advanceData(); return pc.loadAndScale<SLOT>(pc); }
|
||||||
template<int SLOT> __attribute__((always_inline)) inline static uint8_t advanceAndLoadAndScale(PixelController & pc, int lane) { pc.advanceData(); return pc.loadAndScale<SLOT>(pc, lane); }
|
template<int SLOT> __attribute__((always_inline)) inline static uint8_t advanceAndLoadAndScale(PixelController & pc, int lane) { pc.advanceData(); return pc.loadAndScale<SLOT>(pc, lane); }
|
||||||
|
template<int SLOT> __attribute__((always_inline)) inline static uint8_t advanceAndLoadAndScale(PixelController & pc, int lane, uint8_t scale) { pc.advanceData(); return pc.loadAndScale<SLOT>(pc, lane, scale); }
|
||||||
|
|
||||||
template<int SLOT> __attribute__((always_inline)) inline static uint8_t getd(PixelController & pc) { return pc.d[RO(SLOT)]; }
|
template<int SLOT> __attribute__((always_inline)) inline static uint8_t getd(PixelController & pc) { return pc.d[RO(SLOT)]; }
|
||||||
template<int SLOT> __attribute__((always_inline)) inline static uint8_t getscale(PixelController & pc) { return pc.mScale.raw[RO(SLOT)]; }
|
template<int SLOT> __attribute__((always_inline)) inline static uint8_t getscale(PixelController & pc) { return pc.mScale.raw[RO(SLOT)]; }
|
||||||
|
|
||||||
// Helper functions to get around gcc stupidities
|
// Helper functions to get around gcc stupidities
|
||||||
|
__attribute__((always_inline)) inline uint8_t loadAndScale0(int lane, uint8_t scale) { return loadAndScale<0>(*this, lane, scale); }
|
||||||
|
__attribute__((always_inline)) inline uint8_t loadAndScale1(int lane, uint8_t scale) { return loadAndScale<1>(*this, lane, scale); }
|
||||||
|
__attribute__((always_inline)) inline uint8_t loadAndScale2(int lane, uint8_t scale) { return loadAndScale<2>(*this, lane, scale); }
|
||||||
|
__attribute__((always_inline)) inline uint8_t advanceAndLoadAndScale0(int lane, uint8_t scale) { return advanceAndLoadAndScale<0>(*this, lane, scale); }
|
||||||
|
__attribute__((always_inline)) inline uint8_t stepAdvanceAndLoadAndScale0(int lane, uint8_t scale) { stepDithering(); return advanceAndLoadAndScale<0>(*this, lane, scale); }
|
||||||
|
|
||||||
__attribute__((always_inline)) inline uint8_t loadAndScale0(int lane) { return loadAndScale<0>(*this, lane); }
|
__attribute__((always_inline)) inline uint8_t loadAndScale0(int lane) { return loadAndScale<0>(*this, lane); }
|
||||||
__attribute__((always_inline)) inline uint8_t loadAndScale1(int lane) { return loadAndScale<1>(*this, lane); }
|
__attribute__((always_inline)) inline uint8_t loadAndScale1(int lane) { return loadAndScale<1>(*this, lane); }
|
||||||
__attribute__((always_inline)) inline uint8_t loadAndScale2(int lane) { return loadAndScale<2>(*this, lane); }
|
__attribute__((always_inline)) inline uint8_t loadAndScale2(int lane) { return loadAndScale<2>(*this, lane); }
|
||||||
@@ -373,6 +380,10 @@ struct PixelController {
|
|||||||
__attribute__((always_inline)) inline uint8_t loadAndScale2() { return loadAndScale<2>(*this); }
|
__attribute__((always_inline)) inline uint8_t loadAndScale2() { return loadAndScale<2>(*this); }
|
||||||
__attribute__((always_inline)) inline uint8_t advanceAndLoadAndScale0() { return advanceAndLoadAndScale<0>(*this); }
|
__attribute__((always_inline)) inline uint8_t advanceAndLoadAndScale0() { return advanceAndLoadAndScale<0>(*this); }
|
||||||
__attribute__((always_inline)) inline uint8_t stepAdvanceAndLoadAndScale0() { stepDithering(); return advanceAndLoadAndScale<0>(*this); }
|
__attribute__((always_inline)) inline uint8_t stepAdvanceAndLoadAndScale0() { stepDithering(); return advanceAndLoadAndScale<0>(*this); }
|
||||||
|
|
||||||
|
__attribute__((always_inline)) inline uint8_t getScale0() { return getscale<0>(*this); }
|
||||||
|
__attribute__((always_inline)) inline uint8_t getScale1() { return getscale<1>(*this); }
|
||||||
|
__attribute__((always_inline)) inline uint8_t getScale2() { return getscale<2>(*this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<EOrder RGB_ORDER, int LANES=1, uint32_t MASK=0xFFFFFFFF> class CPixelLEDController : public CLEDController {
|
template<EOrder RGB_ORDER, int LANES=1, uint32_t MASK=0xFFFFFFFF> class CPixelLEDController : public CLEDController {
|
@@ -165,7 +165,7 @@ const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Additionl notes on FastLED compact palettes:
|
// Additional notes on FastLED compact palettes:
|
||||||
//
|
//
|
||||||
// Normally, in computer graphics, the palette (or "color lookup table")
|
// Normally, in computer graphics, the palette (or "color lookup table")
|
||||||
// has 256 entries, each containing a specific 24-bit RGB color. You can then
|
// has 256 entries, each containing a specific 24-bit RGB color. You can then
|
@@ -0,0 +1,72 @@
|
|||||||
|
#include "FastLED.h"
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// RGB Calibration code
|
||||||
|
//
|
||||||
|
// Use this sketch to determine what the RGB ordering for your chipset should be. Steps for setting up to use:
|
||||||
|
|
||||||
|
// * Uncomment the line in setup that corresponds to the LED chipset that you are using. (Note that they
|
||||||
|
// all explicitly specify the RGB order as RGB)
|
||||||
|
// * Define DATA_PIN to the pin that data is connected to.
|
||||||
|
// * (Optional) if using software SPI for chipsets that are SPI based, define CLOCK_PIN to the clock pin
|
||||||
|
// * Compile/upload/run the sketch
|
||||||
|
|
||||||
|
// You should see six leds on. If the RGB ordering is correct, you should see 1 red led, 2 green
|
||||||
|
// leds, and 3 blue leds. If you see different colors, the count of each color tells you what the
|
||||||
|
// position for that color in the rgb orering should be. So, for example, if you see 1 Blue, and 2
|
||||||
|
// Red, and 3 Green leds then the rgb ordering should be BRG (Blue, Red, Green).
|
||||||
|
|
||||||
|
// You can then test this ordering by setting the RGB ordering in the addLeds line below to the new ordering
|
||||||
|
// and it should come out correctly, 1 red, 2 green, and 3 blue.
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define NUM_LEDS 6
|
||||||
|
|
||||||
|
// Data pin that led data will be written out over
|
||||||
|
#define DATA_PIN 6
|
||||||
|
// Clock pin only needed for SPI based chipsets when not using hardware SPI
|
||||||
|
//#define CLOCK_PIN 8
|
||||||
|
|
||||||
|
CRGB leds[NUM_LEDS];
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// sanity check delay - allows reprogramming if accidently blowing power w/leds
|
||||||
|
delay(2000);
|
||||||
|
|
||||||
|
// Uncomment one of the following lines for your leds arrangement.
|
||||||
|
// FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.setBrightness(CRGB(255,255,255));
|
||||||
|
// FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
|
||||||
|
// FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<LPD8806, 9, 10, RGB>(leds, NUM_LEDS);
|
||||||
|
FastLED.addLeds<LPD6803, RGB>(leds, NUM_LEDS);
|
||||||
|
|
||||||
|
// FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
// FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
leds[0] = CRGB(255,0,0);
|
||||||
|
leds[1] = CRGB(0,255,0);
|
||||||
|
leds[2] = CRGB(0,255,0);
|
||||||
|
leds[3] = CRGB(0,0,255);
|
||||||
|
leds[4] = CRGB(0,0,255);
|
||||||
|
leds[5] = CRGB(0,0,255);
|
||||||
|
leds[6] = CRGB(0,0,0);
|
||||||
|
FastLED.show();
|
||||||
|
delay(1000);
|
||||||
|
}
|
@@ -61,5 +61,9 @@
|
|||||||
#define FASTLED_INTERRUPT_RETRY_COUNT 2
|
#define FASTLED_INTERRUPT_RETRY_COUNT 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Use this toggle to enable global brightness in contollers that support is (ADA102 and SK9822).
|
||||||
|
// It changes how color scaling works and uses global brightness before scaling down color values.
|
||||||
|
// This enable much more accurate color control on low brightness settings.
|
||||||
|
//#define FASTLED_USE_GLOBAL_BRIGHTNESS 1
|
||||||
|
|
||||||
#endif
|
#endif
|
@@ -69,7 +69,7 @@ FASTLED_NAMESPACE_BEGIN
|
|||||||
// force 4-byte alignment as needed. The FastLED gradient
|
// force 4-byte alignment as needed. The FastLED gradient
|
||||||
// palette code uses 'read dword', and now uses this macro
|
// palette code uses 'read dword', and now uses this macro
|
||||||
// to make sure that gradient palettes are 4-byte aligned.
|
// to make sure that gradient palettes are 4-byte aligned.
|
||||||
#ifdef FASTLED_ARM
|
#if defined(FASTLED_ARM) || defined(ESP32)
|
||||||
#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
|
#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
|
||||||
#else
|
#else
|
||||||
#define FL_ALIGN_PROGMEM
|
#define FL_ALIGN_PROGMEM
|
@@ -40,6 +40,11 @@ template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER>
|
|||||||
class SPIOutput : public NRF51SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
|
class SPIOutput : public NRF51SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NRF52_SERIES) && defined(FASTLED_ALL_PINS_HARDWARE_SPI)
|
||||||
|
template<uint8_t _DATA_PIN, uint8_t _CLOCK_PIN, uint8_t _SPI_CLOCK_DIVIDER>
|
||||||
|
class SPIOutput : public NRF52SPIOutput<_DATA_PIN, _CLOCK_PIN, _SPI_CLOCK_DIVIDER> {};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SPI_DATA) && defined(SPI_CLOCK)
|
#if defined(SPI_DATA) && defined(SPI_CLOCK)
|
||||||
|
|
||||||
#if defined(FASTLED_TEENSY3) && defined(ARM_HARDWARE_SPI)
|
#if defined(FASTLED_TEENSY3) && defined(ARM_HARDWARE_SPI)
|
@@ -123,12 +123,24 @@ public:
|
|||||||
//cli();
|
//cli();
|
||||||
if(b & (1 << BIT)) {
|
if(b & (1 << BIT)) {
|
||||||
FastPin<DATA_PIN>::hi();
|
FastPin<DATA_PIN>::hi();
|
||||||
|
#ifdef ESP32
|
||||||
|
// try to ensure we never have adjacent write opcodes to the same register
|
||||||
|
FastPin<CLOCK_PIN>::lo();
|
||||||
|
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
|
||||||
|
FastPin<CLOCK_PIN>::toggle(); CLOCK_LO_DELAY;
|
||||||
|
#else
|
||||||
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
|
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
|
||||||
FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY;
|
FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
FastPin<DATA_PIN>::lo();
|
FastPin<DATA_PIN>::lo();
|
||||||
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
|
FastPin<CLOCK_PIN>::hi(); CLOCK_HI_DELAY;
|
||||||
|
#ifdef ESP32
|
||||||
|
// try to ensure we never have adjacent write opcodes to the same register
|
||||||
|
FastPin<CLOCK_PIN>::toggle(); CLOCK_HI_DELAY;
|
||||||
|
#else
|
||||||
FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY;
|
FastPin<CLOCK_PIN>::lo(); CLOCK_LO_DELAY;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//sei();
|
//sei();
|
||||||
}
|
}
|
@@ -9,6 +9,7 @@
|
|||||||
CFastLED KEYWORD1
|
CFastLED KEYWORD1
|
||||||
CHSV KEYWORD1
|
CHSV KEYWORD1
|
||||||
CRGB KEYWORD1
|
CRGB KEYWORD1
|
||||||
|
CRGBArray KEYWORD1
|
||||||
LEDS KEYWORD1
|
LEDS KEYWORD1
|
||||||
FastLED KEYWORD1
|
FastLED KEYWORD1
|
||||||
FastPin KEYWORD1
|
FastPin KEYWORD1
|
||||||
@@ -34,10 +35,14 @@ setBrightness KEYWORD2
|
|||||||
getBrightness KEYWORD2
|
getBrightness KEYWORD2
|
||||||
show KEYWORD2
|
show KEYWORD2
|
||||||
clear KEYWORD2
|
clear KEYWORD2
|
||||||
|
clearData KEYWORD2
|
||||||
showColor KEYWORD2
|
showColor KEYWORD2
|
||||||
setTemperature KEYWORD2
|
setTemperature KEYWORD2
|
||||||
setCorrection KEYWORD2
|
setCorrection KEYWORD2
|
||||||
setDither KEYWORD2
|
setDither KEYWORD2
|
||||||
|
setMaxPowerInMilliWatts KEYWORD2
|
||||||
|
setMaxPowerInVoltsAndMilliamps KEYWORD2
|
||||||
|
setMaxRefreshRate KEYWORD2
|
||||||
countFPS KEYWORD2
|
countFPS KEYWORD2
|
||||||
getFPS KEYWORD2
|
getFPS KEYWORD2
|
||||||
|
|
||||||
@@ -289,6 +294,7 @@ CRGB::YellowGreen KEYWORD2
|
|||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
# Chipsets
|
# Chipsets
|
||||||
|
LPD6803 LITERAL1
|
||||||
LPD8806 LITERAL1
|
LPD8806 LITERAL1
|
||||||
WS2801 LITERAL1
|
WS2801 LITERAL1
|
||||||
WS2803 LITERAL1
|
WS2803 LITERAL1
|
||||||
@@ -318,6 +324,11 @@ OCTOWS2811_400 LITERAL1
|
|||||||
OCTOWS2813 LITERAL1
|
OCTOWS2813 LITERAL1
|
||||||
WS2812SERIAL LITERAL1
|
WS2812SERIAL LITERAL1
|
||||||
SMART_MATRIX LITERAL1
|
SMART_MATRIX LITERAL1
|
||||||
|
GE8822 LITERAL1
|
||||||
|
SM16703 LITERAL1
|
||||||
|
GS1903 LITERAL1
|
||||||
|
LPD6803 LITERAL1
|
||||||
|
|
||||||
|
|
||||||
# RGB orderings
|
# RGB orderings
|
||||||
RGB LITERAL1
|
RGB LITERAL1
|
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#if defined(NRF51) || defined(__RFduino__) || defined (__Simblee__)
|
#if defined(NRF51) || defined(__RFduino__) || defined (__Simblee__)
|
||||||
#include "platforms/arm/nrf51/led_sysdefs_arm_nrf51.h"
|
#include "platforms/arm/nrf51/led_sysdefs_arm_nrf51.h"
|
||||||
|
#elif defined(NRF52_SERIES)
|
||||||
|
#include "platforms/arm/nrf52/led_sysdefs_arm_nrf52.h"
|
||||||
#elif defined(__MK20DX128__) || defined(__MK20DX256__)
|
#elif defined(__MK20DX128__) || defined(__MK20DX256__)
|
||||||
// Include k20/T3 headers
|
// Include k20/T3 headers
|
||||||
#include "platforms/arm/k20/led_sysdefs_arm_k20.h"
|
#include "platforms/arm/k20/led_sysdefs_arm_k20.h"
|
||||||
@@ -19,9 +21,9 @@
|
|||||||
#elif defined(__SAM3X8E__)
|
#elif defined(__SAM3X8E__)
|
||||||
// Include sam/due headers
|
// Include sam/due headers
|
||||||
#include "platforms/arm/sam/led_sysdefs_arm_sam.h"
|
#include "platforms/arm/sam/led_sysdefs_arm_sam.h"
|
||||||
#elif defined(STM32F10X_MD)
|
#elif defined(STM32F10X_MD) || defined(__STM32F1__)
|
||||||
#include "platforms/arm/stm32/led_sysdefs_arm_stm32.h"
|
#include "platforms/arm/stm32/led_sysdefs_arm_stm32.h"
|
||||||
#elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__)
|
#elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || defined(__SAMD51G19A__) || defined(__SAMD51J19A__)
|
||||||
#include "platforms/arm/d21/led_sysdefs_arm_d21.h"
|
#include "platforms/arm/d21/led_sysdefs_arm_d21.h"
|
||||||
#elif defined(ESP8266)
|
#elif defined(ESP8266)
|
||||||
#include "platforms/esp/8266/led_sysdefs_esp8266.h"
|
#include "platforms/esp/8266/led_sysdefs_esp8266.h"
|
@@ -477,7 +477,7 @@ LIB8STATIC uint16_t lerp16by16( uint16_t a, uint16_t b, fract16 frac)
|
|||||||
uint16_t result;
|
uint16_t result;
|
||||||
if( b > a ) {
|
if( b > a ) {
|
||||||
uint16_t delta = b - a;
|
uint16_t delta = b - a;
|
||||||
uint32_t scaled = scale16(delta, frac);
|
uint16_t scaled = scale16(delta, frac);
|
||||||
result = a + scaled;
|
result = a + scaled;
|
||||||
} else {
|
} else {
|
||||||
uint16_t delta = a - b;
|
uint16_t delta = a - b;
|
@@ -312,6 +312,35 @@ LIB8STATIC uint8_t addmod8( uint8_t a, uint8_t b, uint8_t m)
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Subtract two numbers, and calculate the modulo
|
||||||
|
/// of the difference and a third number, M.
|
||||||
|
/// In other words, it returns (A-B) % M.
|
||||||
|
/// It is designed as a compact mechanism for
|
||||||
|
/// incrementing a 'mode' switch and wrapping
|
||||||
|
/// around back to 'mode 0' when the switch
|
||||||
|
/// goes past the end of the available range.
|
||||||
|
/// e.g. if you have seven modes, this switches
|
||||||
|
/// to the next one and wraps around if needed:
|
||||||
|
/// mode = addmod8( mode, 1, 7);
|
||||||
|
///LIB8STATIC_ALWAYS_INLINESee 'mod8' for notes on performance.
|
||||||
|
LIB8STATIC uint8_t submod8( uint8_t a, uint8_t b, uint8_t m)
|
||||||
|
{
|
||||||
|
#if defined(__AVR__)
|
||||||
|
asm volatile (
|
||||||
|
" sub %[a],%[b] \n\t"
|
||||||
|
"L_%=: sub %[a],%[m] \n\t"
|
||||||
|
" brcc L_%= \n\t"
|
||||||
|
" add %[a],%[m] \n\t"
|
||||||
|
: [a] "+r" (a)
|
||||||
|
: [b] "r" (b), [m] "r" (m)
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
a -= b;
|
||||||
|
while( a >= m) a -= m;
|
||||||
|
#endif
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
/// 8x8 bit multiplication, with 8 bit result
|
/// 8x8 bit multiplication, with 8 bit result
|
||||||
LIB8STATIC_ALWAYS_INLINE uint8_t mul8( uint8_t i, uint8_t j)
|
LIB8STATIC_ALWAYS_INLINE uint8_t mul8( uint8_t i, uint8_t j)
|
||||||
{
|
{
|
@@ -18,12 +18,23 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/FastLED/FastLED.git"
|
"url": "https://github.com/FastLED/FastLED.git"
|
||||||
},
|
},
|
||||||
"version": "3.2.0",
|
"version": "3.2.9",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "http://fastled.io",
|
"homepage": "http://fastled.io",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "atmelavr, atmelsam, freescalekinetis, nordicnrf51, nxplpc, ststm32, teensy, espressif8266, espressif32",
|
"platforms": "atmelavr, atmelsam, freescalekinetis, nordicnrf51, nxplpc, ststm32, teensy, espressif8266, espressif32, nordicnrf52",
|
||||||
|
"export": {
|
||||||
|
"exclude": [
|
||||||
|
"docs",
|
||||||
|
"extras"
|
||||||
|
]
|
||||||
|
},
|
||||||
"build": {
|
"build": {
|
||||||
|
"srcFilter": [
|
||||||
|
"+<*.c>",
|
||||||
|
"+<*.cpp>",
|
||||||
|
"+<*.h>"
|
||||||
|
],
|
||||||
"libArchive": false
|
"libArchive": false
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
name=FastLED
|
name=FastLED
|
||||||
version=3.2.0
|
version=3.2.9
|
||||||
author=Daniel Garcia
|
author=Daniel Garcia
|
||||||
maintainer=Daniel Garcia <dgarcia@fastled.io>
|
maintainer=Daniel Garcia <dgarcia@fastled.io>
|
||||||
sentence=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions.
|
sentence=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions.
|
@@ -478,10 +478,14 @@ struct CRGB {
|
|||||||
uint8_t max = red;
|
uint8_t max = red;
|
||||||
if( green > max) max = green;
|
if( green > max) max = green;
|
||||||
if( blue > max) max = blue;
|
if( blue > max) max = blue;
|
||||||
uint16_t factor = ((uint16_t)(limit) * 256) / max;
|
|
||||||
red = (red * factor) / 256;
|
// stop div/0 when color is black
|
||||||
green = (green * factor) / 256;
|
if(max > 0) {
|
||||||
blue = (blue * factor) / 256;
|
uint16_t factor = ((uint16_t)(limit) * 256) / max;
|
||||||
|
red = (red * factor) / 256;
|
||||||
|
green = (green * factor) / 256;
|
||||||
|
blue = (blue * factor) / 256;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// return a new CRGB object after performing a linear interpolation between this object and the passed in object
|
/// return a new CRGB object after performing a linear interpolation between this object and the passed in object
|
40
libraries/FastLED-3.2.9/platforms.cpp
Normal file
40
libraries/FastLED-3.2.9/platforms.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#define FASTLED_INTERNAL
|
||||||
|
|
||||||
|
|
||||||
|
// Interrupt handlers cannot be defined in the header.
|
||||||
|
// They must be defined as C functions, or they won't
|
||||||
|
// be found (due to name mangling), and thus won't
|
||||||
|
// override any default weak definition.
|
||||||
|
#if defined(NRF52_SERIES)
|
||||||
|
|
||||||
|
#include "platforms/arm/nrf52/led_sysdefs_arm_nrf52.h"
|
||||||
|
#include "platforms/arm/nrf52/arbiter_nrf52.h"
|
||||||
|
|
||||||
|
uint32_t isrCount;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
// NOTE: Update platforms.cpp in root of FastLED library if this changes
|
||||||
|
#if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE0)
|
||||||
|
void PWM0_IRQHandler(void) { isrCount++; PWM_Arbiter<0>::isr_handler(); }
|
||||||
|
#endif
|
||||||
|
#if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE1)
|
||||||
|
void PWM1_IRQHandler(void) { isrCount++; PWM_Arbiter<1>::isr_handler(); }
|
||||||
|
#endif
|
||||||
|
#if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE2)
|
||||||
|
void PWM2_IRQHandler(void) { isrCount++; PWM_Arbiter<2>::isr_handler(); }
|
||||||
|
#endif
|
||||||
|
#if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE3)
|
||||||
|
void PWM3_IRQHandler(void) { isrCount++; PWM_Arbiter<3>::isr_handler(); }
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // defined(NRF52_SERIES)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// FASTLED_NAMESPACE_BEGIN
|
||||||
|
// FASTLED_NAMESPACE_END
|
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#if defined(NRF51)
|
#if defined(NRF51)
|
||||||
#include "platforms/arm/nrf51/fastled_arm_nrf51.h"
|
#include "platforms/arm/nrf51/fastled_arm_nrf51.h"
|
||||||
|
#elif defined(NRF52_SERIES)
|
||||||
|
#include "platforms/arm/nrf52/fastled_arm_nrf52.h"
|
||||||
#elif defined(__MK20DX128__) || defined(__MK20DX256__)
|
#elif defined(__MK20DX128__) || defined(__MK20DX256__)
|
||||||
// Include k20/T3 headers
|
// Include k20/T3 headers
|
||||||
#include "platforms/arm/k20/fastled_arm_k20.h"
|
#include "platforms/arm/k20/fastled_arm_k20.h"
|
||||||
@@ -19,10 +21,12 @@
|
|||||||
#elif defined(__SAM3X8E__)
|
#elif defined(__SAM3X8E__)
|
||||||
// Include sam/due headers
|
// Include sam/due headers
|
||||||
#include "platforms/arm/sam/fastled_arm_sam.h"
|
#include "platforms/arm/sam/fastled_arm_sam.h"
|
||||||
#elif defined(STM32F10X_MD)
|
#elif defined(STM32F10X_MD) || defined(__STM32F1__)
|
||||||
#include "platforms/arm/stm32/fastled_arm_stm32.h"
|
#include "platforms/arm/stm32/fastled_arm_stm32.h"
|
||||||
#elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__)
|
#elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__)
|
||||||
#include "platforms/arm/d21/fastled_arm_d21.h"
|
#include "platforms/arm/d21/fastled_arm_d21.h"
|
||||||
|
#elif defined(__SAMD51G19A__) || defined(__SAMD51J19A__)
|
||||||
|
#include "platforms/arm/d51/fastled_arm_d51.h"
|
||||||
#elif defined(ESP8266)
|
#elif defined(ESP8266)
|
||||||
#include "platforms/esp/8266/fastled_esp8266.h"
|
#include "platforms/esp/8266/fastled_esp8266.h"
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
@@ -210,12 +210,12 @@ showLedData(volatile uint32_t *_port, uint32_t _bitmask, const uint8_t *_leds, u
|
|||||||
// now for some convinience macros to make building our lines a bit cleaner
|
// now for some convinience macros to make building our lines a bit cleaner
|
||||||
#define LOOP " loop_%=:"
|
#define LOOP " loop_%=:"
|
||||||
#define HI2 " qset2 %[bitmask], %[port], %[hi_off];"
|
#define HI2 " qset2 %[bitmask], %[port], %[hi_off];"
|
||||||
#define D1 " mod_delay %c[T1],2,0,%[scratch];"
|
#define _D1 " mod_delay %c[T1],2,0,%[scratch];"
|
||||||
#define QLO4 " qlo4 %[b],%[bitmask],%[port], %[lo_off];"
|
#define QLO4 " qlo4 %[b],%[bitmask],%[port], %[lo_off];"
|
||||||
#define LOADLEDS3(X) " loadleds3 %[leds], %[bn], %[led" #X "] ,%[scratch];"
|
#define LOADLEDS3(X) " loadleds3 %[leds], %[bn], %[led" #X "] ,%[scratch];"
|
||||||
#define D2(ADJ) " mod_delay %c[T2],4," #ADJ ",%[scratch];"
|
#define _D2(ADJ) " mod_delay %c[T2],4," #ADJ ",%[scratch];"
|
||||||
#define LO2 " qset2 %[bitmask], %[port], %[lo_off];"
|
#define LO2 " qset2 %[bitmask], %[port], %[lo_off];"
|
||||||
#define D3(ADJ) " mod_delay %c[T3],2," #ADJ ",%[scratch];"
|
#define _D3(ADJ) " mod_delay %c[T3],2," #ADJ ",%[scratch];"
|
||||||
#define LOADDITHER7(X) " loaddither7 %[bn], %[d], %[base], %[led" #X "];"
|
#define LOADDITHER7(X) " loaddither7 %[bn], %[d], %[base], %[led" #X "];"
|
||||||
#define DITHER5 " dither5 %[bn], %[d];"
|
#define DITHER5 " dither5 %[bn], %[d];"
|
||||||
#define SCALE4(X) " scale4 %[bn], %[base], %[scale" #X "], %[scratch];"
|
#define SCALE4(X) " scale4 %[bn], %[base], %[scale" #X "], %[scratch];"
|
||||||
@@ -225,7 +225,122 @@ showLedData(volatile uint32_t *_port, uint32_t _bitmask, const uint8_t *_leds, u
|
|||||||
#define CMPLOOP5 " cmploop5 %[counter], loop_%=;"
|
#define CMPLOOP5 " cmploop5 %[counter], loop_%=;"
|
||||||
#define NOTHING ""
|
#define NOTHING ""
|
||||||
|
|
||||||
#if !(defined(SEI_CHK) && (FASTLED_ALLOW_INTERRUPTS == 1))
|
#if (defined(SEI_CHK) && (FASTLED_ALLOW_INTERRUPTS == 1))
|
||||||
|
// We're allowing interrupts and have hardware timer support defined -
|
||||||
|
// track the loop outside the asm code, to allow inserting the interrupt
|
||||||
|
// overrun checks.
|
||||||
|
asm __volatile__ (
|
||||||
|
// pre-load byte 0
|
||||||
|
LOADLEDS3(0) LOADDITHER7(0) DITHER5 SCALE4(0) ADJDITHER7(0) SWAPBBN1
|
||||||
|
M0_ASM_ARGS);
|
||||||
|
|
||||||
|
do {
|
||||||
|
asm __volatile__ (
|
||||||
|
// Write out byte 0, prepping byte 1
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADLEDS3(1) _D2(3) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADDITHER7(1) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SCALE4(1) _D2(4) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 ADJDITHER7(1) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(0)
|
||||||
|
|
||||||
|
// Write out byte 1, prepping byte 2
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADLEDS3(2) _D2(3) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADDITHER7(2) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SCALE4(2) _D2(4) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 ADJDITHER7(2) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(0)
|
||||||
|
|
||||||
|
// Write out byte 2, prepping byte 0
|
||||||
|
HI2 _D1 QLO4 INCLEDS3 _D2(3) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADLEDS3(0) _D2(3) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADDITHER7(0) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SCALE4(0) _D2(4) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 ADJDITHER7(0) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(5)
|
||||||
|
|
||||||
|
M0_ASM_ARGS
|
||||||
|
);
|
||||||
|
SEI_CHK; INNER_SEI; --counter; CLI_CHK;
|
||||||
|
} while(counter);
|
||||||
|
#elif (FASTLED_ALLOW_INTERRUPTS == 1)
|
||||||
|
// We're allowing interrupts - track the loop outside the asm code, and
|
||||||
|
// re-enable interrupts in between each iteration.
|
||||||
|
asm __volatile__ (
|
||||||
|
// pre-load byte 0
|
||||||
|
LOADLEDS3(0) LOADDITHER7(0) DITHER5 SCALE4(0) ADJDITHER7(0) SWAPBBN1
|
||||||
|
M0_ASM_ARGS);
|
||||||
|
|
||||||
|
do {
|
||||||
|
asm __volatile__ (
|
||||||
|
// Write out byte 0, prepping byte 1
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADLEDS3(1) _D2(3) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADDITHER7(1) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SCALE4(1) _D2(4) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 ADJDITHER7(1) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(0)
|
||||||
|
|
||||||
|
// Write out byte 1, prepping byte 2
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADLEDS3(2) _D2(3) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADDITHER7(2) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SCALE4(2) _D2(4) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 ADJDITHER7(2) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 INCLEDS3 _D2(3) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(0)
|
||||||
|
|
||||||
|
// Write out byte 2, prepping byte 0
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADLEDS3(0) _D2(3) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 LOADDITHER7(0) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SCALE4(0) _D2(4) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 ADJDITHER7(0) _D2(7) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(5)
|
||||||
|
|
||||||
|
M0_ASM_ARGS
|
||||||
|
);
|
||||||
|
|
||||||
|
uint32_t ticksBeforeInterrupts = SysTick->VAL;
|
||||||
|
sei();
|
||||||
|
--counter;
|
||||||
|
cli();
|
||||||
|
|
||||||
|
// If more than 45 uSecs have elapsed, give up on this frame and start over.
|
||||||
|
// Note: this isn't completely correct. It's possible that more than one
|
||||||
|
// millisecond will elapse, and so SysTick->VAL will lap
|
||||||
|
// ticksBeforeInterrupts.
|
||||||
|
// Note: ticksBeforeInterrupts DECREASES
|
||||||
|
const uint32_t kTicksPerMs = VARIANT_MCK / 1000;
|
||||||
|
const uint32_t kTicksPerUs = kTicksPerMs / 1000;
|
||||||
|
const uint32_t kTicksIn45us = kTicksPerUs * 45;
|
||||||
|
|
||||||
|
const uint32_t currentTicks = SysTick->VAL;
|
||||||
|
|
||||||
|
if (ticksBeforeInterrupts < currentTicks) {
|
||||||
|
// Timer started over
|
||||||
|
if ((ticksBeforeInterrupts + (kTicksPerMs - currentTicks)) > kTicksIn45us) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((ticksBeforeInterrupts - currentTicks) > kTicksIn45us) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while(counter);
|
||||||
|
#else
|
||||||
// We're not allowing interrupts - run the entire loop in asm to keep things
|
// We're not allowing interrupts - run the entire loop in asm to keep things
|
||||||
// as tight as possible. In an ideal world, we should be pushing out ws281x
|
// as tight as possible. In an ideal world, we should be pushing out ws281x
|
||||||
// leds (or other 3-wire leds) with zero gaps between pixels.
|
// leds (or other 3-wire leds) with zero gaps between pixels.
|
||||||
@@ -236,81 +351,37 @@ showLedData(volatile uint32_t *_port, uint32_t _bitmask, const uint8_t *_leds, u
|
|||||||
// loop over writing out the data
|
// loop over writing out the data
|
||||||
LOOP
|
LOOP
|
||||||
// Write out byte 0, prepping byte 1
|
// Write out byte 0, prepping byte 1
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 LOADLEDS3(1) D2(3) LO2 D3(0)
|
HI2 _D1 QLO4 LOADLEDS3(1) _D2(3) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 LOADDITHER7(1) D2(7) LO2 D3(0)
|
HI2 _D1 QLO4 LOADDITHER7(1) _D2(7) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 DITHER5 D2(5) LO2 D3(0)
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 SCALE4(1) D2(4) LO2 D3(0)
|
HI2 _D1 QLO4 SCALE4(1) _D2(4) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 ADJDITHER7(1) D2(7) LO2 D3(0)
|
HI2 _D1 QLO4 ADJDITHER7(1) _D2(7) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 SWAPBBN1 D2(1) LO2 D3(0)
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(0)
|
||||||
|
|
||||||
// Write out byte 1, prepping byte 2
|
// Write out byte 1, prepping byte 2
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 LOADLEDS3(2) D2(3) LO2 D3(0)
|
HI2 _D1 QLO4 LOADLEDS3(2) _D2(3) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 LOADDITHER7(2) D2(7) LO2 D3(0)
|
HI2 _D1 QLO4 LOADDITHER7(2) _D2(7) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 DITHER5 D2(5) LO2 D3(0)
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 SCALE4(2) D2(4) LO2 D3(0)
|
HI2 _D1 QLO4 SCALE4(2) _D2(4) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 ADJDITHER7(2) D2(7) LO2 D3(0)
|
HI2 _D1 QLO4 ADJDITHER7(2) _D2(7) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 INCLEDS3 D2(3) LO2 D3(0)
|
HI2 _D1 QLO4 INCLEDS3 _D2(3) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 SWAPBBN1 D2(1) LO2 D3(0)
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(0)
|
||||||
|
|
||||||
// Write out byte 2, prepping byte 0
|
// Write out byte 2, prepping byte 0
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 LOADLEDS3(0) D2(3) LO2 D3(0)
|
HI2 _D1 QLO4 LOADLEDS3(0) _D2(3) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 LOADDITHER7(0) D2(7) LO2 D3(0)
|
HI2 _D1 QLO4 LOADDITHER7(0) _D2(7) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 DITHER5 D2(5) LO2 D3(0)
|
HI2 _D1 QLO4 DITHER5 _D2(5) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 SCALE4(0) D2(4) LO2 D3(0)
|
HI2 _D1 QLO4 SCALE4(0) _D2(4) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 ADJDITHER7(0) D2(7) LO2 D3(0)
|
HI2 _D1 QLO4 ADJDITHER7(0) _D2(7) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
HI2 _D1 QLO4 NOTHING _D2(0) LO2 _D3(0)
|
||||||
HI2 D1 QLO4 SWAPBBN1 D2(1) LO2 D3(5) CMPLOOP5
|
HI2 _D1 QLO4 SWAPBBN1 _D2(1) LO2 _D3(5) CMPLOOP5
|
||||||
|
|
||||||
M0_ASM_ARGS
|
M0_ASM_ARGS
|
||||||
);
|
);
|
||||||
#else
|
|
||||||
// We're allowing interrupts - track the loop outside the asm code, to allow
|
|
||||||
// inserting the interrupt overrun checks.
|
|
||||||
asm __volatile__ (
|
|
||||||
// pre-load byte 0
|
|
||||||
LOADLEDS3(0) LOADDITHER7(0) DITHER5 SCALE4(0) ADJDITHER7(0) SWAPBBN1
|
|
||||||
M0_ASM_ARGS);
|
|
||||||
|
|
||||||
do {
|
|
||||||
asm __volatile__ (
|
|
||||||
// Write out byte 0, prepping byte 1
|
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 LOADLEDS3(1) D2(3) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 LOADDITHER7(1) D2(7) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 DITHER5 D2(5) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 SCALE4(1) D2(4) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 ADJDITHER7(1) D2(7) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 SWAPBBN1 D2(1) LO2 D3(0)
|
|
||||||
|
|
||||||
// Write out byte 1, prepping byte 2
|
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 LOADLEDS3(2) D2(3) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 LOADDITHER7(2) D2(7) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 DITHER5 D2(5) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 SCALE4(2) D2(4) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 ADJDITHER7(2) D2(7) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 SWAPBBN1 D2(1) LO2 D3(0)
|
|
||||||
|
|
||||||
// Write out byte 2, prepping byte 0
|
|
||||||
HI2 D1 QLO4 INCLEDS3 D2(3) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 LOADLEDS3(0) D2(3) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 LOADDITHER7(0) D2(7) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 DITHER5 D2(5) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 SCALE4(0) D2(4) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 ADJDITHER7(0) D2(7) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 NOTHING D2(0) LO2 D3(0)
|
|
||||||
HI2 D1 QLO4 SWAPBBN1 D2(1) LO2 D3(5)
|
|
||||||
|
|
||||||
M0_ASM_ARGS
|
|
||||||
);
|
|
||||||
SEI_CHK; INNER_SEI; --counter; CLI_CHK;
|
|
||||||
} while(counter);
|
|
||||||
#endif
|
#endif
|
||||||
return num_leds;
|
return num_leds;
|
||||||
}
|
}
|
@@ -34,24 +34,23 @@ public:
|
|||||||
inline static void setOutput() { pinMode(PIN, OUTPUT); } // TODO: perform MUX config { _PDDR::r() |= _MASK; }
|
inline static void setOutput() { pinMode(PIN, OUTPUT); } // TODO: perform MUX config { _PDDR::r() |= _MASK; }
|
||||||
inline static void setInput() { pinMode(PIN, INPUT); } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; }
|
inline static void setInput() { pinMode(PIN, INPUT); } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; }
|
||||||
|
|
||||||
inline static void hi() __attribute__ ((always_inline)) { PORT->Group[_GRP].OUTSET.reg = _MASK; }
|
inline static void hi() __attribute__ ((always_inline)) { PORT_IOBUS->Group[_GRP].OUTSET.reg = _MASK; }
|
||||||
inline static void lo() __attribute__ ((always_inline)) { PORT->Group[_GRP].OUTCLR.reg = _MASK; }
|
inline static void lo() __attribute__ ((always_inline)) { PORT_IOBUS->Group[_GRP].OUTCLR.reg = _MASK; }
|
||||||
// inline static void lo() __attribute__ ((always_inline)) { PORT->Group[_GRP].BSRR = (_MASK<<16); }
|
inline static void set(register port_t val) __attribute__ ((always_inline)) { PORT_IOBUS->Group[_GRP].OUT.reg = val; }
|
||||||
inline static void set(register port_t val) __attribute__ ((always_inline)) { PORT->Group[_GRP].OUT.reg = val; }
|
|
||||||
|
|
||||||
inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); }
|
inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); }
|
||||||
|
|
||||||
inline static void toggle() __attribute__ ((always_inline)) { PORT->Group[_GRP].OUTTGL.reg = _MASK; }
|
inline static void toggle() __attribute__ ((always_inline)) { PORT_IOBUS->Group[_GRP].OUTTGL.reg = _MASK; }
|
||||||
|
|
||||||
inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); }
|
inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); }
|
||||||
inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); }
|
inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); }
|
||||||
inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; }
|
inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; }
|
||||||
|
|
||||||
inline static port_t hival() __attribute__ ((always_inline)) { return PORT->Group[_GRP].OUT.reg | _MASK; }
|
inline static port_t hival() __attribute__ ((always_inline)) { return PORT_IOBUS->Group[_GRP].OUT.reg | _MASK; }
|
||||||
inline static port_t loval() __attribute__ ((always_inline)) { return PORT->Group[_GRP].OUT.reg & ~_MASK; }
|
inline static port_t loval() __attribute__ ((always_inline)) { return PORT_IOBUS->Group[_GRP].OUT.reg & ~_MASK; }
|
||||||
inline static port_ptr_t port() __attribute__ ((always_inline)) { return &PORT->Group[_GRP].OUT.reg; }
|
inline static port_ptr_t port() __attribute__ ((always_inline)) { return &PORT_IOBUS->Group[_GRP].OUT.reg; }
|
||||||
inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &PORT->Group[_GRP].OUTSET.reg; }
|
inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &PORT_IOBUS->Group[_GRP].OUTSET.reg; }
|
||||||
inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &PORT->Group[_GRP].OUTCLR.reg; }
|
inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &PORT_IOBUS->Group[_GRP].OUTCLR.reg; }
|
||||||
inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; }
|
inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -74,6 +73,31 @@ _DEFPIN_ARM(A1,0, 5); _DEFPIN_ARM(A2,0, 6); _DEFPIN_ARM(A3,0, 7); _DEFPIN_ARM(A0
|
|||||||
|
|
||||||
#define HAS_HARDWARE_PIN_SUPPORT 1
|
#define HAS_HARDWARE_PIN_SUPPORT 1
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(ADAFRUIT_HALLOWING)
|
||||||
|
|
||||||
|
#define MAX_PIN 20
|
||||||
|
// 0 & 1
|
||||||
|
_DEFPIN_ARM( 0, 0, 9); _DEFPIN_ARM( 1, 0, 10);
|
||||||
|
// 2, 3, 4
|
||||||
|
_DEFPIN_ARM( 2, 0, 14); _DEFPIN_ARM( 3, 0, 11); _DEFPIN_ARM( 4, 0, 8);
|
||||||
|
// 5, 6, 7
|
||||||
|
_DEFPIN_ARM( 5, 0, 15); _DEFPIN_ARM( 6, 0, 18); _DEFPIN_ARM( 7, 0, 0);
|
||||||
|
// 8, 9, 10
|
||||||
|
_DEFPIN_ARM( 8, 0, 12); _DEFPIN_ARM( 9, 0, 19); _DEFPIN_ARM(10, 0, 20);
|
||||||
|
// 11, 12, 13
|
||||||
|
_DEFPIN_ARM(11, 0, 21); _DEFPIN_ARM(12, 0, 22); _DEFPIN_ARM(13, 0, 23);
|
||||||
|
// 14, 15, 16 (A0 - A2)
|
||||||
|
_DEFPIN_ARM(14, 0, 2); _DEFPIN_ARM(15, 1, 8); _DEFPIN_ARM(16, 1, 9);
|
||||||
|
// 17, 18, 19 (A3 - A5)
|
||||||
|
_DEFPIN_ARM(17, 0, 4); _DEFPIN_ARM(18, 0, 5); _DEFPIN_ARM(19, 0, 6);
|
||||||
|
|
||||||
|
#define SPI_DATA PIN_SPI_MOSI
|
||||||
|
#define SPI_CLOCK PIN_SPI_SCK
|
||||||
|
|
||||||
|
#define HAS_HARDWARE_PIN_SUPPORT 1
|
||||||
|
|
||||||
|
|
||||||
#elif defined(ARDUINO_SAMD_ZERO)
|
#elif defined(ARDUINO_SAMD_ZERO)
|
||||||
|
|
||||||
#define MAX_PIN 42
|
#define MAX_PIN 42
|
||||||
@@ -148,24 +172,40 @@ _DEFPIN_ARM( 20, 0, 6); _DEFPIN_ARM( 21, 0, 7);
|
|||||||
#elif defined(ARDUINO_GEMMA_M0)
|
#elif defined(ARDUINO_GEMMA_M0)
|
||||||
|
|
||||||
#define MAX_PIN 4
|
#define MAX_PIN 4
|
||||||
_DEFPIN_ARM( 0, 0, 4); _DEFPIN_ARM( 1, 0, 2); _DEFPIN_ARM( 2, 0, 5);
|
_DEFPIN_ARM( 0, 0, 4); _DEFPIN_ARM( 1, 0, 2); _DEFPIN_ARM( 2, 0, 5);
|
||||||
_DEFPIN_ARM( 3, 0, 0); _DEFPIN_ARM( 4, 0, 1);
|
_DEFPIN_ARM( 3, 0, 0); _DEFPIN_ARM( 4, 0, 1);
|
||||||
|
|
||||||
#define HAS_HARDWARE_PIN_SUPPORT 1
|
#define HAS_HARDWARE_PIN_SUPPORT 1
|
||||||
|
|
||||||
#elif defined(ADAFRUIT_TRINKET_M0)
|
#elif defined(ADAFRUIT_TRINKET_M0)
|
||||||
|
|
||||||
#define MAX_PIN 5
|
#define MAX_PIN 7
|
||||||
_DEFPIN_ARM( 0, 0, 8); _DEFPIN_ARM( 1, 0, 2); _DEFPIN_ARM( 2, 0, 9);
|
_DEFPIN_ARM( 0, 0, 8); _DEFPIN_ARM( 1, 0, 2); _DEFPIN_ARM( 2, 0, 9);
|
||||||
_DEFPIN_ARM( 3, 0, 7); _DEFPIN_ARM( 4, 0, 6);
|
_DEFPIN_ARM( 3, 0, 7); _DEFPIN_ARM( 4, 0, 6); _DEFPIN_ARM( 7, 0, 0); _DEFPIN_ARM( 8, 0, 1);
|
||||||
|
|
||||||
#define SPI_DATA 4
|
#define SPI_DATA 4
|
||||||
#define SPI_CLOCK 3
|
#define SPI_CLOCK 3
|
||||||
|
|
||||||
#define HAS_HARDWARE_PIN_SUPPORT 1
|
#define HAS_HARDWARE_PIN_SUPPORT 1
|
||||||
|
|
||||||
#endif
|
#elif defined(ADAFRUIT_ITSYBITSY_M0)
|
||||||
|
|
||||||
|
#define MAX_PIN 16
|
||||||
|
_DEFPIN_ARM( 2, 0, 14); _DEFPIN_ARM( 3, 0, 9); _DEFPIN_ARM( 4, 0, 8);
|
||||||
|
_DEFPIN_ARM( 5, 0, 15); _DEFPIN_ARM( 6, 0, 20); _DEFPIN_ARM( 7, 0, 21);
|
||||||
|
_DEFPIN_ARM( 8, 0, 6); _DEFPIN_ARM( 9, 0, 7); _DEFPIN_ARM( 10, 0, 18);
|
||||||
|
_DEFPIN_ARM( 11, 0, 16); _DEFPIN_ARM( 12, 0, 19); _DEFPIN_ARM( 13, 0, 17);
|
||||||
|
_DEFPIN_ARM( 29, 0, 10); // MOSI
|
||||||
|
_DEFPIN_ARM( 30, 0, 11); // SCK
|
||||||
|
_DEFPIN_ARM( 40, 0, 0); //APA102 Clock
|
||||||
|
_DEFPIN_ARM( 41, 0, 1) //APA102 Data
|
||||||
|
|
||||||
|
#define SPI_DATA 29
|
||||||
|
#define SPI_CLOCK 30
|
||||||
|
|
||||||
|
#define HAS_HARDWARE_PIN_SUPPORT 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // FASTLED_FORCE_SOFTWARE_PINS
|
#endif // FASTLED_FORCE_SOFTWARE_PINS
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
// Default to allowing interrupts
|
// Default to allowing interrupts
|
||||||
#ifndef FASTLED_ALLOW_INTERRUPTS
|
#ifndef FASTLED_ALLOW_INTERRUPTS
|
||||||
#define FASTLED_ALLOW_INTERRUPTS 0
|
#define FASTLED_ALLOW_INTERRUPTS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FASTLED_ALLOW_INTERRUPTS == 1
|
#if FASTLED_ALLOW_INTERRUPTS == 1
|
4
libraries/FastLED-3.2.9/platforms/arm/d51/README.txt
Normal file
4
libraries/FastLED-3.2.9/platforms/arm/d51/README.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
FastLED updates for adafruit FEATHER M4 and fixes to ITSBITSY M4 compiles
|
||||||
|
SAMD51
|
||||||
|
|
||||||
|
only tested on FEATHER M4 with DOTSTAR and neopixel strips
|
128
libraries/FastLED-3.2.9/platforms/arm/d51/clockless_arm_d51.h
Normal file
128
libraries/FastLED-3.2.9/platforms/arm/d51/clockless_arm_d51.h
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
#ifndef __INC_CLOCKLESS_ARM_D51
|
||||||
|
#define __INC_CLOCKLESS_ARM_D51
|
||||||
|
|
||||||
|
FASTLED_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
// Definition for a single channel clockless controller for SAMD51
|
||||||
|
// See clockless.h for detailed info on how the template parameters are used.
|
||||||
|
#define ARM_DEMCR (*(volatile uint32_t *)0xE000EDFC) // Debug Exception and Monitor Control
|
||||||
|
#define ARM_DEMCR_TRCENA (1 << 24) // Enable debugging & monitoring blocks
|
||||||
|
#define ARM_DWT_CTRL (*(volatile uint32_t *)0xE0001000) // DWT control register
|
||||||
|
#define ARM_DWT_CTRL_CYCCNTENA (1 << 0) // Enable cycle count
|
||||||
|
#define ARM_DWT_CYCCNT (*(volatile uint32_t *)0xE0001004) // Cycle count register
|
||||||
|
|
||||||
|
|
||||||
|
#define FASTLED_HAS_CLOCKLESS 1
|
||||||
|
|
||||||
|
template <int DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB, int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 50>
|
||||||
|
class ClocklessController : public CPixelLEDController<RGB_ORDER> {
|
||||||
|
typedef typename FastPin<DATA_PIN>::port_ptr_t data_ptr_t;
|
||||||
|
typedef typename FastPin<DATA_PIN>::port_t data_t;
|
||||||
|
|
||||||
|
data_t mPinMask;
|
||||||
|
data_ptr_t mPort;
|
||||||
|
CMinWait<WAIT_TIME> mWait;
|
||||||
|
public:
|
||||||
|
virtual void init() {
|
||||||
|
FastPin<DATA_PIN>::setOutput();
|
||||||
|
mPinMask = FastPin<DATA_PIN>::mask();
|
||||||
|
mPort = FastPin<DATA_PIN>::port();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint16_t getMaxRefreshRate() const { return 400; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void showPixels(PixelController<RGB_ORDER> & pixels) {
|
||||||
|
mWait.wait();
|
||||||
|
if(!showRGBInternal(pixels)) {
|
||||||
|
sei(); delayMicroseconds(WAIT_TIME); cli();
|
||||||
|
showRGBInternal(pixels);
|
||||||
|
}
|
||||||
|
mWait.mark();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int BITS> __attribute__ ((always_inline)) inline static void writeBits(register uint32_t & next_mark, register data_ptr_t port, register data_t hi, register data_t lo, register uint8_t & b) {
|
||||||
|
for(register uint32_t i = BITS-1; i > 0; i--) {
|
||||||
|
while(ARM_DWT_CYCCNT < next_mark);
|
||||||
|
next_mark = ARM_DWT_CYCCNT + (T1+T2+T3);
|
||||||
|
FastPin<DATA_PIN>::fastset(port, hi);
|
||||||
|
if(b&0x80) {
|
||||||
|
while((next_mark - ARM_DWT_CYCCNT) > (T3+(2*(F_CPU/24000000))));
|
||||||
|
FastPin<DATA_PIN>::fastset(port, lo);
|
||||||
|
} else {
|
||||||
|
while((next_mark - ARM_DWT_CYCCNT) > (T2+T3+(2*(F_CPU/24000000))));
|
||||||
|
FastPin<DATA_PIN>::fastset(port, lo);
|
||||||
|
}
|
||||||
|
b <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(ARM_DWT_CYCCNT < next_mark);
|
||||||
|
next_mark = ARM_DWT_CYCCNT + (T1+T2+T3);
|
||||||
|
FastPin<DATA_PIN>::fastset(port, hi);
|
||||||
|
|
||||||
|
if(b&0x80) {
|
||||||
|
while((next_mark - ARM_DWT_CYCCNT) > (T3+(2*(F_CPU/24000000))));
|
||||||
|
FastPin<DATA_PIN>::fastset(port, lo);
|
||||||
|
} else {
|
||||||
|
while((next_mark - ARM_DWT_CYCCNT) > (T2+T3+(2*(F_CPU/24000000))));
|
||||||
|
FastPin<DATA_PIN>::fastset(port, lo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then
|
||||||
|
// gcc will use register Y for the this pointer.
|
||||||
|
static uint32_t showRGBInternal(PixelController<RGB_ORDER> pixels) {
|
||||||
|
// Get access to the clock
|
||||||
|
ARM_DEMCR |= ARM_DEMCR_TRCENA;
|
||||||
|
ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
|
||||||
|
ARM_DWT_CYCCNT = 0;
|
||||||
|
|
||||||
|
register data_ptr_t port = FastPin<DATA_PIN>::port();
|
||||||
|
register data_t hi = *port | FastPin<DATA_PIN>::mask();;
|
||||||
|
register data_t lo = *port & ~FastPin<DATA_PIN>::mask();;
|
||||||
|
*port = lo;
|
||||||
|
|
||||||
|
// Setup the pixel controller and load/scale the first byte
|
||||||
|
pixels.preStepFirstByteDithering();
|
||||||
|
register uint8_t b = pixels.loadAndScale0();
|
||||||
|
|
||||||
|
cli();
|
||||||
|
uint32_t next_mark = ARM_DWT_CYCCNT + (T1+T2+T3);
|
||||||
|
|
||||||
|
while(pixels.has(1)) {
|
||||||
|
pixels.stepDithering();
|
||||||
|
#if (FASTLED_ALLOW_INTERRUPTS == 1)
|
||||||
|
cli();
|
||||||
|
// if interrupts took longer than 45µs, punt on the current frame
|
||||||
|
if(ARM_DWT_CYCCNT > next_mark) {
|
||||||
|
if((ARM_DWT_CYCCNT-next_mark) > ((WAIT_TIME-INTERRUPT_THRESHOLD)*CLKS_PER_US)) { sei(); return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
hi = *port | FastPin<DATA_PIN>::mask();
|
||||||
|
lo = *port & ~FastPin<DATA_PIN>::mask();
|
||||||
|
#endif
|
||||||
|
// Write first byte, read next byte
|
||||||
|
writeBits<8+XTRA0>(next_mark, port, hi, lo, b);
|
||||||
|
b = pixels.loadAndScale1();
|
||||||
|
|
||||||
|
// Write second byte, read 3rd byte
|
||||||
|
writeBits<8+XTRA0>(next_mark, port, hi, lo, b);
|
||||||
|
b = pixels.loadAndScale2();
|
||||||
|
|
||||||
|
// Write third byte, read 1st byte of next pixel
|
||||||
|
writeBits<8+XTRA0>(next_mark, port, hi, lo, b);
|
||||||
|
b = pixels.advanceAndLoadAndScale0();
|
||||||
|
#if (FASTLED_ALLOW_INTERRUPTS == 1)
|
||||||
|
sei();
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
sei();
|
||||||
|
return ARM_DWT_CYCCNT;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
FASTLED_NAMESPACE_END
|
||||||
|
|
||||||
|
#endif
|
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef __INC_FASTLED_ARM_D51_H
|
||||||
|
#define __INC_FASTLED_ARM_D51_H
|
||||||
|
|
||||||
|
#include "fastpin_arm_d51.h"
|
||||||
|
#include "clockless_arm_d51.h"
|
||||||
|
|
||||||
|
#endif
|
116
libraries/FastLED-3.2.9/platforms/arm/d51/fastpin_arm_d51.h
Normal file
116
libraries/FastLED-3.2.9/platforms/arm/d51/fastpin_arm_d51.h
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
#ifndef __INC_FASTPIN_ARM_D51_H
|
||||||
|
#define __INC_FASTPIN_ARM_D51_H
|
||||||
|
|
||||||
|
FASTLED_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
#if defined(FASTLED_FORCE_SOFTWARE_PINS)
|
||||||
|
#warning "Software pin support forced, pin access will be slightly slower."
|
||||||
|
#define NO_HARDWARE_PIN_SUPPORT
|
||||||
|
#undef HAS_HARDWARE_PIN_SUPPORT
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/// Template definition for STM32 style ARM pins, providing direct access to the various GPIO registers. Note that this
|
||||||
|
/// uses the full port GPIO registers. In theory, in some way, bit-band register access -should- be faster, however I have found
|
||||||
|
/// that something about the way gcc does register allocation results in the bit-band code being slower. It will need more fine tuning.
|
||||||
|
/// The registers are data output, set output, clear output, toggle output, input, and direction
|
||||||
|
|
||||||
|
template<uint8_t PIN, uint8_t _BIT, uint32_t _MASK, int _GRP> class _ARMPIN {
|
||||||
|
public:
|
||||||
|
typedef volatile uint32_t * port_ptr_t;
|
||||||
|
typedef uint32_t port_t;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
inline static void setOutput() {
|
||||||
|
if(_BIT<8) {
|
||||||
|
_CRL::r() = (_CRL::r() & (0xF << (_BIT*4)) | (0x1 << (_BIT*4));
|
||||||
|
} else {
|
||||||
|
_CRH::r() = (_CRH::r() & (0xF << ((_BIT-8)*4))) | (0x1 << ((_BIT-8)*4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline static void setInput() { /* TODO */ } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline static void setOutput() { pinMode(PIN, OUTPUT); } // TODO: perform MUX config { _PDDR::r() |= _MASK; }
|
||||||
|
inline static void setInput() { pinMode(PIN, INPUT); } // TODO: preform MUX config { _PDDR::r() &= ~_MASK; }
|
||||||
|
|
||||||
|
inline static void hi() __attribute__ ((always_inline)) { PORT->Group[_GRP].OUTSET.reg = _MASK; }
|
||||||
|
inline static void lo() __attribute__ ((always_inline)) { PORT->Group[_GRP].OUTCLR.reg = _MASK; }
|
||||||
|
inline static void set(register port_t val) __attribute__ ((always_inline)) { PORT->Group[_GRP].OUT.reg = val; }
|
||||||
|
|
||||||
|
inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); }
|
||||||
|
|
||||||
|
inline static void toggle() __attribute__ ((always_inline)) { PORT->Group[_GRP].OUTTGL.reg = _MASK; }
|
||||||
|
|
||||||
|
inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); }
|
||||||
|
inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); }
|
||||||
|
inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; }
|
||||||
|
|
||||||
|
inline static port_t hival() __attribute__ ((always_inline)) { return PORT->Group[_GRP].OUT.reg | _MASK; }
|
||||||
|
inline static port_t loval() __attribute__ ((always_inline)) { return PORT->Group[_GRP].OUT.reg & ~_MASK; }
|
||||||
|
inline static port_ptr_t port() __attribute__ ((always_inline)) { return &PORT->Group[_GRP].OUT.reg; }
|
||||||
|
inline static port_ptr_t sport() __attribute__ ((always_inline)) { return &PORT->Group[_GRP].OUTSET.reg; }
|
||||||
|
inline static port_ptr_t cport() __attribute__ ((always_inline)) { return &PORT->Group[_GRP].OUTCLR.reg; }
|
||||||
|
inline static port_t mask() __attribute__ ((always_inline)) { return _MASK; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#define _R(T) struct __gen_struct_ ## T
|
||||||
|
#define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline volatile PortGroup * r() { return T; } };
|
||||||
|
|
||||||
|
#define _IO32(L) _RD32(GPIO ## L)
|
||||||
|
|
||||||
|
#define _DEFPIN_ARM(PIN, L, BIT) template<> class FastPin<PIN> : public _ARMPIN<PIN, BIT, 1 << BIT, L> {};
|
||||||
|
|
||||||
|
// Actual pin definitions
|
||||||
|
#if defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS)
|
||||||
|
|
||||||
|
#define MAX_PIN 19
|
||||||
|
// D0-D13, including D6+D8 (DotStar CLK + DATA)
|
||||||
|
_DEFPIN_ARM( 0, 0, 16); _DEFPIN_ARM( 1, 0, 17); _DEFPIN_ARM( 2, 0, 7); _DEFPIN_ARM( 3, 1, 22);
|
||||||
|
_DEFPIN_ARM( 4, 0, 14); _DEFPIN_ARM( 5, 0, 15); _DEFPIN_ARM( 6, 1, 2); _DEFPIN_ARM( 7, 0, 18);
|
||||||
|
_DEFPIN_ARM( 8, 1, 3); _DEFPIN_ARM( 9, 0, 19); _DEFPIN_ARM(10, 0, 20); _DEFPIN_ARM(11, 0, 21);
|
||||||
|
_DEFPIN_ARM(12, 0, 23); _DEFPIN_ARM(13, 0, 22);
|
||||||
|
// A0-A5
|
||||||
|
_DEFPIN_ARM(14, 0, 2); _DEFPIN_ARM(15, 0, 5); _DEFPIN_ARM(16, 1, 8); _DEFPIN_ARM(17, 1, 9);
|
||||||
|
_DEFPIN_ARM(18, 0, 4); _DEFPIN_ARM(19, 0, 6); /* A6 is present in variant.h but couldn't find it on the schematic */
|
||||||
|
// SDA/SCL
|
||||||
|
_DEFPIN_ARM(21, 0, 12); _DEFPIN_ARM(22, 0, 13);
|
||||||
|
|
||||||
|
// 23..25 MISO/SCK/MOSI
|
||||||
|
_DEFPIN_ARM(23, 1, 23); _DEFPIN_ARM(24, 0, 1); _DEFPIN_ARM(25, 0, 0);
|
||||||
|
|
||||||
|
#define SPI_DATA 25
|
||||||
|
#define SPI_CLOCK 24
|
||||||
|
|
||||||
|
#define HAS_HARDWARE_PIN_SUPPORT 1
|
||||||
|
|
||||||
|
#elif defined(ADAFRUIT_FEATHER_M4_EXPRESS)
|
||||||
|
|
||||||
|
#define MAX_PIN 19
|
||||||
|
// D0-D13, including D8 (neopixel) no pins 2 3
|
||||||
|
_DEFPIN_ARM( 0, 1, 17); _DEFPIN_ARM( 1, 1, 16);
|
||||||
|
_DEFPIN_ARM( 4, 0, 14); _DEFPIN_ARM( 5, 0, 16); _DEFPIN_ARM( 6, 0, 18);
|
||||||
|
_DEFPIN_ARM( 8, 1, 3); _DEFPIN_ARM( 9, 0, 19); _DEFPIN_ARM(10, 0, 20); _DEFPIN_ARM(11, 0, 21);
|
||||||
|
_DEFPIN_ARM(12, 0, 22); _DEFPIN_ARM(13, 0, 23);
|
||||||
|
// A0-A5
|
||||||
|
_DEFPIN_ARM(14, 0, 2); _DEFPIN_ARM(15, 0, 5); _DEFPIN_ARM(16, 1, 8); _DEFPIN_ARM(17, 1, 9);
|
||||||
|
_DEFPIN_ARM(18, 0, 4); _DEFPIN_ARM(19, 0, 6); /* A6 is present in variant.h but couldn't find it on the schematic */
|
||||||
|
// SDA/SCL
|
||||||
|
_DEFPIN_ARM(21, 0, 12); _DEFPIN_ARM(22, 0, 13);
|
||||||
|
// 23..25 MISO/MOSI/SCK
|
||||||
|
_DEFPIN_ARM(23, 1, 22); _DEFPIN_ARM(24, 1, 23); _DEFPIN_ARM(25, 0, 17);
|
||||||
|
|
||||||
|
#define SPI_DATA 24
|
||||||
|
#define SPI_CLOCK 25
|
||||||
|
|
||||||
|
#define HAS_HARDWARE_PIN_SUPPORT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // FASTLED_FORCE_SOFTWARE_PINS
|
||||||
|
|
||||||
|
FASTLED_NAMESPACE_END
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __INC_FASTPIN_ARM_D51_H
|
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef __INC_LED_SYSDEFS_ARM_D51_H
|
||||||
|
#define __INC_LED_SYSDEFS_ARM_D51_H
|
||||||
|
|
||||||
|
|
||||||
|
#define FASTLED_ARM
|
||||||
|
// Note this is an M4, not an M0+, but this enables the shared m0clockless.h
|
||||||
|
#define FASTLED_ARM_M0_PLUS
|
||||||
|
|
||||||
|
#ifndef INTERRUPT_THRESHOLD
|
||||||
|
#define INTERRUPT_THRESHOLD 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Default to allowing interrupts
|
||||||
|
#ifndef FASTLED_ALLOW_INTERRUPTS
|
||||||
|
#define FASTLED_ALLOW_INTERRUPTS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FASTLED_ALLOW_INTERRUPTS == 1
|
||||||
|
#define FASTLED_ACCURATE_CLOCK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// reusing/abusing cli/sei defs for due
|
||||||
|
#define cli() __disable_irq();
|
||||||
|
#define sei() __enable_irq();
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user