Permalink
Browse files

Makefile Compilation Fix (#490)

* renamed boolean to bool

* Rename byte to uint8_t

* Fix compilation error: 'NULL' was not declared in this scope

* Always typedef RoReg and RwReg for the AVR platform

* Include stdlib.h if abs() is not available
This is required as Arduino.h #define's its own abs() makro. Outside of Arduino environments stdlib is required.
Also see: arduino/Arduino#6684

* Replace digitalWrite() with Pin Class by FastLed

* Include string.h for memset function
This include is normally done by Arduino.h but still required for makefile environments
$ grep string.h . -r
./Arduino.h:#include <string.h>

* Include math.h for pow()
math.h is normally included by Arduino.h but required for a makefile build
$ grep math.h . -r
./Arduino.h:#include <math.h>
  • Loading branch information...
NicoHood authored and focalintent committed Nov 2, 2017
1 parent e3125f1 commit 64d729e6e6d6bbb8da239e65963d6eb82a7059a7
Showing with 16 additions and 10 deletions.
  1. +1 −1 FastLED.cpp
  2. +1 −1 FastLED.h
  3. +1 −0 colorutils.cpp
  4. +5 −4 controller.h
  5. +1 −0 fastpin.h
  6. +1 −0 noise.cpp
  7. +4 −0 pixelset.h
  8. +0 −2 platforms/avr/led_sysdefs_avr.h
  9. +2 −2 power_mgt.cpp
View
@@ -105,7 +105,7 @@ void CFastLED::showColor(const struct CRGB & color, uint8_t scale) {
countFPS();
}
void CFastLED::clear(boolean writeData) {
void CFastLED::clear(bool writeData) {
if(writeData) {
showColor(CRGB(0,0,0), 0);
}
View
@@ -489,7 +489,7 @@ class CFastLED {
/// clear the leds, wiping the local array of data, optionally black out the leds as well
/// @param writeData whether or not to write out to the leds as well
void clear(boolean writeData = false);
void clear(bool writeData = false);
/// clear out the local data array
void clearData();
View
@@ -2,6 +2,7 @@
#define __PROG_TYPES_COMPAT__
#include <stdint.h>
#include <math.h>
#include "FastLED.h"
View
@@ -8,6 +8,7 @@
#include "led_sysdefs.h"
#include "pixeltypes.h"
#include "color.h"
#include <stddef.h>
FASTLED_NAMESPACE_BEGIN
@@ -254,18 +255,18 @@ struct PixelController {
#define VIRTUAL_BITS RECOMMENDED_VIRTUAL_BITS
// R is the digther signal 'counter'.
static byte R = 0;
static uint8_t R = 0;
R++;
// R is wrapped around at 2^ditherBits,
// so if ditherBits is 2, R will cycle through (0,1,2,3)
byte ditherBits = VIRTUAL_BITS;
uint8_t ditherBits = VIRTUAL_BITS;
R &= (0x01 << ditherBits) - 1;
// Q is the "unscaled dither signal" itself.
// It's initialized to the reversed bits of R.
// If 'ditherBits' is 2, Q here will cycle through (0,128,64,192)
byte Q = 0;
uint8_t Q = 0;
// Reverse bits in a byte
{
@@ -293,7 +294,7 @@ struct PixelController {
// Setup the initial D and E values
for(int i = 0; i < 3; i++) {
byte s = mScale.raw[i];
uint8_t s = mScale.raw[i];
e[i] = s ? (256/s) + 1 : 0;
d[i] = scale8(Q, e[i]);
#if (FASTLED_SCALE8_FIXED == 1)
View
@@ -4,6 +4,7 @@
#include "FastLED.h"
#include "led_sysdefs.h"
#include <stddef.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
View
@@ -1,5 +1,6 @@
#define FASTLED_INTERNAL
#include "FastLED.h"
#include <string.h>
FASTLED_NAMESPACE_BEGIN
View
@@ -3,6 +3,10 @@
#include "FastLED.h"
#ifndef abs
#include "stdlib.h"
#endif
/// 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
/// that a pixel set is a window into another set of led data, it is not its own set of led data.
@@ -13,10 +13,8 @@
#include <avr/interrupt.h> // for cli/se definitions
// Define the register types
#if defined(ARDUINO) // && ARDUINO < 150
typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */
typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */
#endif
// Default to disallowing interrupts (may want to gate this on teensy2 vs. other arm platforms, since the
View
@@ -125,7 +125,7 @@ uint8_t calculate_max_brightness_for_power_mW( uint8_t target_brightness, uint32
if( requested_power_mW < max_power_mW) {
#if POWER_LED > 0
if( gMaxPowerIndicatorLEDPinNumber ) {
digitalWrite(gMaxPowerIndicatorLEDPinNumber, LOW); // turn the LED off
Pin(gMaxPowerIndicatorLEDPinNumber).lo(); // turn the LED off
}
#endif
#if POWER_DEBUG_PRINT == 1
@@ -148,7 +148,7 @@ uint8_t calculate_max_brightness_for_power_mW( uint8_t target_brightness, uint32
#if POWER_LED > 0
if( gMaxPowerIndicatorLEDPinNumber ) {
digitalWrite( gMaxPowerIndicatorLEDPinNumber, HIGH); // turn the LED on
Pin(gMaxPowerIndicatorLEDPinNumber).hi(); // turn the LED on
}
#endif

0 comments on commit 64d729e

Please sign in to comment.