Skip to content

Commit

Permalink
Arduion 1.6.6 and later, when you Include a library from the Sketch m…
Browse files Browse the repository at this point in the history
…enu, will include _every_ header file - instead of just the library's main header file. Guard against that particular [REDACTED].
  • Loading branch information
focalintent committed Dec 26, 2015
1 parent fc0d6b8 commit 39b75cc
Show file tree
Hide file tree
Showing 27 changed files with 70 additions and 16 deletions.
3 changes: 2 additions & 1 deletion README.md
@@ -1,6 +1,7 @@
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/FastLED/public) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/FastLED/public)


IMPORTANT NOTE: For AVR based systems, avr-gcc 4.8.x is supported, as is avr-gcc 4.3 and earlier. There are known issues with avr-gcc 4.7 and timing based chipsets like the WS2812B. If you are using a linux system make sure you are using avr-gcc 4.8.x not avr-gcc 4.7.x. 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.1
=========== ===========
Expand Down
2 changes: 2 additions & 0 deletions bitswap.h
@@ -1,6 +1,8 @@
#ifndef __INC_BITSWAP_H #ifndef __INC_BITSWAP_H
#define __INC_BITSWAP_H #define __INC_BITSWAP_H


#include "FastLED.h"

FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN


///@file bitswap.h ///@file bitswap.h
Expand Down
1 change: 1 addition & 0 deletions chipsets.h
@@ -1,6 +1,7 @@
#ifndef __INC_CHIPSETS_H #ifndef __INC_CHIPSETS_H
#define __INC_CHIPSETS_H #define __INC_CHIPSETS_H


#include "FastLED.h"
#include "pixeltypes.h" #include "pixeltypes.h"


///@file chipsets.h ///@file chipsets.h
Expand Down
2 changes: 2 additions & 0 deletions color.h
@@ -1,6 +1,8 @@
#ifndef __INC_COLOR_H #ifndef __INC_COLOR_H
#define __INC_COLOR_H #define __INC_COLOR_H


#include "FastLED.h"

FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN


///@file color.h ///@file color.h
Expand Down
1 change: 1 addition & 0 deletions colorpalettes.h
@@ -1,6 +1,7 @@
#ifndef __INC_COLORPALETTES_H #ifndef __INC_COLORPALETTES_H
#define __INC_COLORPALETTES_H #define __INC_COLORPALETTES_H


#include "FastLED.h"
#include "colorutils.h" #include "colorutils.h"


///@file colorpalettes.h ///@file colorpalettes.h
Expand Down
1 change: 1 addition & 0 deletions colorutils.h
Expand Up @@ -4,6 +4,7 @@
///@file colorutils.h ///@file colorutils.h
/// functions for color fill, paletters, blending, and more /// functions for color fill, paletters, blending, and more


#include "FastLED.h"
#include "pixeltypes.h" #include "pixeltypes.h"
#include "fastled_progmem.h" #include "fastled_progmem.h"


Expand Down
1 change: 1 addition & 0 deletions controller.h
Expand Up @@ -4,6 +4,7 @@
///@file controller.h ///@file controller.h
/// base definitions used by led controllers for writing out led data /// base definitions used by led controllers for writing out led data


#include "FastLED.h"
#include "led_sysdefs.h" #include "led_sysdefs.h"
#include "pixeltypes.h" #include "pixeltypes.h"
#include "color.h" #include "color.h"
Expand Down
2 changes: 2 additions & 0 deletions cpp_compat.h
@@ -1,6 +1,8 @@
#ifndef __INC_CPP_COMPAT_H #ifndef __INC_CPP_COMPAT_H
#define __INC_CPP_COMPAT_H #define __INC_CPP_COMPAT_H


#include "FastLED.h"

#if __cplusplus <= 199711L #if __cplusplus <= 199711L


#define static_assert(expression, message) #define static_assert(expression, message)
Expand Down
1 change: 1 addition & 0 deletions dmx.h
@@ -1,6 +1,7 @@
#ifndef __INC_DMX_H #ifndef __INC_DMX_H
#define __INC_DMX_H #define __INC_DMX_H


#include "FastLED.h"


#ifdef DmxSimple_h #ifdef DmxSimple_h
#include<DmxSimple.h> #include<DmxSimple.h>
Expand Down
2 changes: 2 additions & 0 deletions fastled_config.h
@@ -1,6 +1,8 @@
#ifndef __INC_FASTLED_CONFIG_H #ifndef __INC_FASTLED_CONFIG_H
#define __INC_FASTLED_CONFIG_H #define __INC_FASTLED_CONFIG_H


#include "FastLED.h"

///@file fastled_config.h ///@file fastled_config.h
/// contains definitions that can be used to configure FastLED at compile time /// contains definitions that can be used to configure FastLED at compile time


Expand Down
2 changes: 2 additions & 0 deletions fastled_delay.h
@@ -1,6 +1,8 @@
#ifndef __INC_FL_DELAY_H #ifndef __INC_FL_DELAY_H
#define __INC_FL_DELAY_H #define __INC_FL_DELAY_H


#include "FastLED.h"

///@file fastled_delay.h ///@file fastled_delay.h
///Utility functions and classes for managing delaycycles ///Utility functions and classes for managing delaycycles


Expand Down
2 changes: 2 additions & 0 deletions fastled_progmem.h
@@ -1,6 +1,8 @@
#ifndef __INC_FL_PROGMEM_H #ifndef __INC_FL_PROGMEM_H
#define __INC_FL_PROGMEM_H #define __INC_FL_PROGMEM_H


#include "FastLED.h"

///@file fastled_progmem.h ///@file fastled_progmem.h
/// wrapper definitions to allow seamless use of PROGMEM in environmens that have it /// wrapper definitions to allow seamless use of PROGMEM in environmens that have it


Expand Down
2 changes: 2 additions & 0 deletions fastpin.h
@@ -1,6 +1,8 @@
#ifndef __INC_FASTPIN_H #ifndef __INC_FASTPIN_H
#define __INC_FASTPIN_H #define __INC_FASTPIN_H


#include "FastLED.h"

#include "led_sysdefs.h" #include "led_sysdefs.h"


#pragma GCC diagnostic push #pragma GCC diagnostic push
Expand Down
2 changes: 2 additions & 0 deletions fastspi.h
@@ -1,6 +1,8 @@
#ifndef __INC_FASTSPI_H #ifndef __INC_FASTSPI_H
#define __INC_FASTSPI_H #define __INC_FASTSPI_H


#include "FastLED.h"

#include "controller.h" #include "controller.h"
#include "lib8tion.h" #include "lib8tion.h"


Expand Down
2 changes: 2 additions & 0 deletions fastspi_bitbang.h
@@ -1,6 +1,8 @@
#ifndef __INC_FASTSPI_BITBANG_H #ifndef __INC_FASTSPI_BITBANG_H
#define __INC_FASTSPI_BITBANG_H #define __INC_FASTSPI_BITBANG_H


#include "FastLED.h"

#include "fastled_delay.h" #include "fastled_delay.h"


FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN
Expand Down
5 changes: 5 additions & 0 deletions fastspi_nop.h
@@ -1,6 +1,10 @@
#ifndef __INC_FASTSPI_NOP_H #ifndef __INC_FASTSPI_NOP_H
#define __INC_FASTSPI_NOP_H #define __INC_FASTSPI_NOP_H


#if 0 // Guard against the arduino ide idiotically including every header file

#include "FastLED.h"

FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN


/// A nop/stub class, mostly to show the SPI methods that are needed/used by the various SPI chipset implementations. Should /// A nop/stub class, mostly to show the SPI methods that are needed/used by the various SPI chipset implementations. Should
Expand Down Expand Up @@ -57,3 +61,4 @@ class NOPSPIOutput {
FASTLED_NAMESPACE_END FASTLED_NAMESPACE_END


#endif #endif
#endif
6 changes: 6 additions & 0 deletions fastspi_ref.h
@@ -1,6 +1,9 @@
#ifndef __INC_FASTSPI_ARM_SAM_H #ifndef __INC_FASTSPI_ARM_SAM_H
#define __INC_FASTSPI_ARM_SAM_H #define __INC_FASTSPI_ARM_SAM_H


#if 0 // guard against the arduino ide idiotically including every header file
#include "FastLED.h"

FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN


// A skeletal implementation of hardware SPI support. Fill in the necessary code for init, waiting, and writing. The rest of // A skeletal implementation of hardware SPI support. Fill in the necessary code for init, waiting, and writing. The rest of
Expand Down Expand Up @@ -87,3 +90,6 @@ class REFHardwareSPIOutput {
FASTLED_NAMESPACE_END FASTLED_NAMESPACE_END


#endif #endif

#endif

2 changes: 2 additions & 0 deletions fastspi_types.h
@@ -1,6 +1,8 @@
#ifndef __INC_FASTSPI_TYPES_H #ifndef __INC_FASTSPI_TYPES_H
#define __INC_FASTSPI_TYPES_H #define __INC_FASTSPI_TYPES_H


#include "FastLED.h"

FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN


// Some helper macros for getting at mis-ordered byte values // Some helper macros for getting at mis-ordered byte values
Expand Down
2 changes: 2 additions & 0 deletions hsv2rgb.h
@@ -1,6 +1,8 @@
#ifndef __INC_HSV2RGB_H #ifndef __INC_HSV2RGB_H
#define __INC_HSV2RGB_H #define __INC_HSV2RGB_H


#include "FastLED.h"

#include "pixeltypes.h" #include "pixeltypes.h"


FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN
Expand Down
2 changes: 2 additions & 0 deletions led_sysdefs.h
@@ -1,6 +1,8 @@
#ifndef __INC_LED_SYSDEFS_H #ifndef __INC_LED_SYSDEFS_H
#define __INC_LED_SYSDEFS_H #define __INC_LED_SYSDEFS_H


#include "FastLED.h"

#include "fastled_config.h" #include "fastled_config.h"


#if defined(NRF51) || defined(__RFduino__) #if defined(NRF51) || defined(__RFduino__)
Expand Down
8 changes: 5 additions & 3 deletions lib8tion.h
@@ -1,10 +1,12 @@
#ifndef __INC_LIB8TION_H
#define __INC_LIB8TION_H

#include "FastLED.h"

#ifndef __INC_LED_SYSDEFS_H #ifndef __INC_LED_SYSDEFS_H
#error WTH? led_sysdefs needs to be included first #error WTH? led_sysdefs needs to be included first
#endif #endif


#ifndef __INC_LIB8TION_H
#define __INC_LIB8TION_H

FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN


/* /*
Expand Down
4 changes: 2 additions & 2 deletions noise.cpp
Expand Up @@ -655,7 +655,7 @@ void fill_noise8(CRGB *leds, int num_leds,
void fill_noise16(CRGB *leds, int num_leds, void fill_noise16(CRGB *leds, int num_leds,
uint8_t octaves, uint16_t x, int scale, uint8_t octaves, uint16_t x, int scale,
uint8_t hue_octaves, uint16_t hue_x, int hue_scale, uint8_t hue_octaves, uint16_t hue_x, int hue_scale,
uint16_t time) { uint16_t time, uint8_t hue_shift) {
uint8_t V[num_leds]; uint8_t V[num_leds];
uint8_t H[num_leds]; uint8_t H[num_leds];


Expand All @@ -666,7 +666,7 @@ void fill_noise16(CRGB *leds, int num_leds,
fill_raw_noise8(H,num_leds,hue_octaves,hue_x,hue_scale,time); fill_raw_noise8(H,num_leds,hue_octaves,hue_x,hue_scale,time);


for(int i = 0; i < num_leds; i++) { for(int i = 0; i < num_leds; i++) {
leds[i] = CHSV(H[i],255,V[i]); leds[i] = CHSV(H[i] + hue_shift,255,V[i]);
} }
} }


Expand Down
4 changes: 3 additions & 1 deletion noise.h
@@ -1,6 +1,8 @@
#ifndef __INC_NOISE_H #ifndef __INC_NOISE_H
#define __INC_NOISE_H #define __INC_NOISE_H


#include "FastLED.h"

FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN


///@file noise.h ///@file noise.h
Expand Down Expand Up @@ -81,7 +83,7 @@ void fill_noise8(CRGB *leds, int num_leds,
void fill_noise16(CRGB *leds, int num_leds, void fill_noise16(CRGB *leds, int num_leds,
uint8_t octaves, uint16_t x, int scale, uint8_t octaves, uint16_t x, int scale,
uint8_t hue_octaves, uint16_t hue_x, int hue_scale, uint8_t hue_octaves, uint16_t hue_x, int hue_scale,
uint16_t time); uint16_t time, uint8_t hue_shift=0);
void fill_2dnoise8(CRGB *leds, int width, int height, bool serpentine, void fill_2dnoise8(CRGB *leds, int width, int height, bool serpentine,
uint8_t octaves, uint16_t x, int xscale, uint16_t y, int yscale, uint16_t time, uint8_t octaves, uint16_t x, int xscale, uint16_t y, int yscale, uint16_t time,
uint8_t hue_octaves, uint16_t hue_x, int hue_xscale, uint16_t hue_y, uint16_t hue_yscale,uint16_t hue_time,bool blend); uint8_t hue_octaves, uint16_t hue_x, int hue_xscale, uint16_t hue_y, uint16_t hue_yscale,uint16_t hue_time,bool blend);
Expand Down
21 changes: 12 additions & 9 deletions pixelset.h
@@ -1,6 +1,8 @@
#ifndef __INC_PIXELSET_H #ifndef __INC_PIXELSET_H
#define __INC_PIXELSET_H #define __INC_PIXELSET_H


#include "FastLED.h"

/// Represents a set of CRGB led objects. Provides the [] array operator, and works like a normal array in that case. /// Represents a set of CRGB led objects. Provides the [] array operator, and works like a normal array in that case.
/// This should be kept in sync with the set of functions provided by CRGB as well as functions in colorutils. Note /// This should be kept in sync with the set of functions provided by CRGB as well as functions in colorutils. Note
/// that a pixel set is a window into another set of led data, it is not its own set of led data. /// that a pixel set is a window into another set of led data, it is not its own set of led data.
Expand All @@ -15,20 +17,20 @@ class CPixelView {
public: public:


/// PixelSet copy constructor /// PixelSet copy constructor
inline CPixelView(const CPixelView & other) : leds(other.leds), len(other.len), dir(other.dir), end_pos(other.end_pos) {} inline CPixelView(const CPixelView & other) : dir(other.dir), len(other.len), leds(other.leds), end_pos(other.end_pos) {}


/// pixelset constructor for a pixel set starting at the given PIXEL_TYPE* and going for _len leds. Note that the length /// pixelset constructor for a pixel set starting at the given PIXEL_TYPE* and going for _len leds. Note that the length
/// can be backwards, creating a PixelSet that walks backwards over the data /// can be backwards, creating a PixelSet that walks backwards over the data
/// @param leds point to the raw led data /// @param leds point to the raw led data
/// @param len how many leds in this set /// @param len how many leds in this set
inline CPixelView(PIXEL_TYPE *_leds, int _len) : leds(_leds), len(_len), dir(_len < 0 ? -1 : 1), end_pos(_leds + _len) {} inline CPixelView(PIXEL_TYPE *_leds, int _len) : dir(_len < 0 ? -1 : 1), len(_len), leds(_leds), end_pos(_leds + _len) {}


/// PixelSet constructor for the given set of leds, with start and end boundaries. Note that start can be after /// PixelSet constructor for the given set of leds, with start and end boundaries. Note that start can be after
/// end, resulting in a set that will iterate backwards /// end, resulting in a set that will iterate backwards
/// @param leds point to the raw led data /// @param leds point to the raw led data
/// @param start the start index of the leds for this array /// @param start the start index of the leds for this array
/// @param end the end index of the leds for this array /// @param end the end index of the leds for this array
inline CPixelView(PIXEL_TYPE *_leds, int _start, int _end) : leds(_leds), dir(((_end-_start)<0) ? -1 : 1), len((_end - _start) + dir), end_pos(_leds + len) {} inline CPixelView(PIXEL_TYPE *_leds, int _start, int _end) : dir(((_end-_start)<0) ? -1 : 1), len((_end - _start) + dir), leds(_leds + _start), end_pos(_leds + _start + len) {}


/// Get the size of this set /// Get the size of this set
/// @return the size of the set /// @return the size of the set
Expand All @@ -51,7 +53,7 @@ class CPixelView {
/// result in a reverse ordering for many functions (useful for mirroring) /// result in a reverse ordering for many functions (useful for mirroring)
/// @param start the first element from this set for the new subset /// @param start the first element from this set for the new subset
/// @param end the last element for the new subset /// @param end the last element for the new subset
inline CPixelView operator()(int start, int end) { return CPixelView(leds+start, start, end); } inline CPixelView operator()(int start, int end) { return CPixelView(leds, start, end); }


/// Access an inclusive subset of the leds in this set, starting from the first. /// Access an inclusive subset of the leds in this set, starting from the first.
/// @param end the last element for the new subset /// @param end the last element for the new subset
Expand All @@ -71,11 +73,12 @@ class CPixelView {
} }




// void dump() const { void dump() const {
// Serial.print("len: "); Serial.print(len); Serial.print(", dir:"); Serial.print((int)dir); Serial.print("len: "); Serial.print(len); Serial.print(", dir:"); Serial.print((int)dir);
// Serial.print(", range:"); Serial.print((uint32_t)leds); Serial.print("-"); Serial.print((uint32_t)end_pos); Serial.print(", range:"); Serial.print((uint32_t)leds); Serial.print("-"); Serial.print((uint32_t)end_pos);
// Serial.print(", diff:"); Serial.print((int32_t)(end_pos - leds)); Serial.print(", diff:"); Serial.print((int32_t)(end_pos - leds));
// } Serial.println("");
}


/// Copy the contents of the passed in set to our set. Note if one set is smaller than the other, only the /// Copy the contents of the passed in set to our set. Note if one set is smaller than the other, only the
/// smallest number of items will be copied over. /// smallest number of items will be copied over.
Expand Down
2 changes: 2 additions & 0 deletions pixeltypes.h
@@ -1,6 +1,8 @@
#ifndef __INC_PIXELS_H #ifndef __INC_PIXELS_H
#define __INC_PIXELS_H #define __INC_PIXELS_H


#include "FastLED.h"

#include <stdint.h> #include <stdint.h>
#include "lib8tion.h" #include "lib8tion.h"
#include "color.h" #include "color.h"
Expand Down
2 changes: 2 additions & 0 deletions platforms.h
@@ -1,6 +1,8 @@
#ifndef __INC_PLATFORMS_H #ifndef __INC_PLATFORMS_H
#define __INC_PLATFORMS_H #define __INC_PLATFORMS_H


#include "FastLED.h"

#include "fastled_config.h" #include "fastled_config.h"


#if defined(NRF51) #if defined(NRF51)
Expand Down
2 changes: 2 additions & 0 deletions power_mgt.h
@@ -1,6 +1,8 @@
#ifndef POWER_MGT_H #ifndef POWER_MGT_H
#define POWER_MGT_H #define POWER_MGT_H


#include "FastLED.h"

#include "pixeltypes.h" #include "pixeltypes.h"


FASTLED_NAMESPACE_BEGIN FASTLED_NAMESPACE_BEGIN
Expand Down

0 comments on commit 39b75cc

Please sign in to comment.