Skip to content

Commit 64d729e

Browse files
NicoHoodfocalintent
authored andcommitted
Makefile Compilation Fix (FastLED#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: https://github.com/arduino/Arduino/issues/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>
1 parent e3125f1 commit 64d729e

9 files changed

+16
-10
lines changed

FastLED.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void CFastLED::showColor(const struct CRGB & color, uint8_t scale) {
105105
countFPS();
106106
}
107107

108-
void CFastLED::clear(boolean writeData) {
108+
void CFastLED::clear(bool writeData) {
109109
if(writeData) {
110110
showColor(CRGB(0,0,0), 0);
111111
}

FastLED.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ class CFastLED {
489489

490490
/// clear the leds, wiping the local array of data, optionally black out the leds as well
491491
/// @param writeData whether or not to write out to the leds as well
492-
void clear(boolean writeData = false);
492+
void clear(bool writeData = false);
493493

494494
/// clear out the local data array
495495
void clearData();

colorutils.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define __PROG_TYPES_COMPAT__
33

44
#include <stdint.h>
5+
#include <math.h>
56

67
#include "FastLED.h"
78

controller.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "led_sysdefs.h"
99
#include "pixeltypes.h"
1010
#include "color.h"
11+
#include <stddef.h>
1112

1213
FASTLED_NAMESPACE_BEGIN
1314

@@ -254,18 +255,18 @@ struct PixelController {
254255
#define VIRTUAL_BITS RECOMMENDED_VIRTUAL_BITS
255256

256257
// R is the digther signal 'counter'.
257-
static byte R = 0;
258+
static uint8_t R = 0;
258259
R++;
259260

260261
// R is wrapped around at 2^ditherBits,
261262
// so if ditherBits is 2, R will cycle through (0,1,2,3)
262-
byte ditherBits = VIRTUAL_BITS;
263+
uint8_t ditherBits = VIRTUAL_BITS;
263264
R &= (0x01 << ditherBits) - 1;
264265

265266
// Q is the "unscaled dither signal" itself.
266267
// It's initialized to the reversed bits of R.
267268
// If 'ditherBits' is 2, Q here will cycle through (0,128,64,192)
268-
byte Q = 0;
269+
uint8_t Q = 0;
269270

270271
// Reverse bits in a byte
271272
{
@@ -293,7 +294,7 @@ struct PixelController {
293294

294295
// Setup the initial D and E values
295296
for(int i = 0; i < 3; i++) {
296-
byte s = mScale.raw[i];
297+
uint8_t s = mScale.raw[i];
297298
e[i] = s ? (256/s) + 1 : 0;
298299
d[i] = scale8(Q, e[i]);
299300
#if (FASTLED_SCALE8_FIXED == 1)

fastpin.h

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "FastLED.h"
55

66
#include "led_sysdefs.h"
7+
#include <stddef.h>
78

89
#pragma GCC diagnostic push
910
#pragma GCC diagnostic ignored "-Wignored-qualifiers"

noise.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#define FASTLED_INTERNAL
22
#include "FastLED.h"
3+
#include <string.h>
34

45
FASTLED_NAMESPACE_BEGIN
56

pixelset.h

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
#include "FastLED.h"
55

6+
#ifndef abs
7+
#include "stdlib.h"
8+
#endif
9+
610
/// Represents a set of CRGB led objects. Provides the [] array operator, and works like a normal array in that case.
711
/// This should be kept in sync with the set of functions provided by CRGB as well as functions in colorutils. Note
812
/// that a pixel set is a window into another set of led data, it is not its own set of led data.

platforms/avr/led_sysdefs_avr.h

-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
#include <avr/interrupt.h> // for cli/se definitions
1414

1515
// Define the register types
16-
#if defined(ARDUINO) // && ARDUINO < 150
1716
typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */
1817
typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */
19-
#endif
2018

2119

2220
// Default to disallowing interrupts (may want to gate this on teensy2 vs. other arm platforms, since the

power_mgt.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ uint8_t calculate_max_brightness_for_power_mW( uint8_t target_brightness, uint32
125125
if( requested_power_mW < max_power_mW) {
126126
#if POWER_LED > 0
127127
if( gMaxPowerIndicatorLEDPinNumber ) {
128-
digitalWrite(gMaxPowerIndicatorLEDPinNumber, LOW); // turn the LED off
128+
Pin(gMaxPowerIndicatorLEDPinNumber).lo(); // turn the LED off
129129
}
130130
#endif
131131
#if POWER_DEBUG_PRINT == 1
@@ -148,7 +148,7 @@ uint8_t calculate_max_brightness_for_power_mW( uint8_t target_brightness, uint32
148148

149149
#if POWER_LED > 0
150150
if( gMaxPowerIndicatorLEDPinNumber ) {
151-
digitalWrite( gMaxPowerIndicatorLEDPinNumber, HIGH); // turn the LED on
151+
Pin(gMaxPowerIndicatorLEDPinNumber).hi(); // turn the LED on
152152
}
153153
#endif
154154

0 commit comments

Comments
 (0)