Fix PROGMEM errors and warnings

This commit is contained in:
PaulStoffregen 2017-09-04 07:48:00 -07:00
parent 839dbf0a21
commit db6fca9763
3 changed files with 14 additions and 9 deletions

View File

@ -24,11 +24,14 @@
The pattern below will only work with 1 TLC. Copy + Paste the 4 lines The pattern below will only work with 1 TLC. Copy + Paste the 4 lines
inside the curly brackets for each additional TLC. */ inside the curly brackets for each additional TLC. */
const unsigned int TlcMax = 4095;
const uint8_t gsArray1[NUM_TLCS * 24] PROGMEM = { const uint8_t gsArray1[NUM_TLCS * 24] PROGMEM = {
GS_DUO((4095 * 16)/16, (4095 * 15)/16), GS_DUO((4095 * 14)/16, (4095 * 13)/16), GS_DUO((TlcMax * 16)/16, (TlcMax * 15)/16), GS_DUO((TlcMax * 14)/16, (TlcMax * 13)/16),
GS_DUO((4095 * 12)/16, (4095 * 11)/16), GS_DUO((4095 * 10)/16, (4095 * 9)/16), GS_DUO((TlcMax * 12)/16, (TlcMax * 11)/16), GS_DUO((TlcMax * 10)/16, (TlcMax * 9)/16),
GS_DUO((4095 * 8)/16, (4095 * 7)/16), GS_DUO((4095 * 6)/16, (4095 * 5)/16), GS_DUO((TlcMax * 8)/16, (TlcMax * 7)/16), GS_DUO((TlcMax * 6)/16, (TlcMax * 5)/16),
GS_DUO((4095 * 4)/16, (4095 * 3)/16), GS_DUO((4095 * 2)/16, (4095 * 1)/16), GS_DUO((TlcMax * 4)/16, (TlcMax * 3)/16), GS_DUO((TlcMax * 2)/16, (TlcMax * 1)/16),
}; };
void setup() void setup()

View File

@ -158,7 +158,9 @@
/** Arranges 2 grayscale values (0 - 4095) in the packed array format (3 bytes). /** Arranges 2 grayscale values (0 - 4095) in the packed array format (3 bytes).
This is for array initializers only: the output is three comma seperated This is for array initializers only: the output is three comma seperated
8-bit values. */ 8-bit values. */
#define GS_DUO(a, b) ((a) >> 4), ((a) << 4) | ((b) >> 8), (b) //#define GS_DUO(a, b) ((a) >> 4), ((a) << 4) | ((b) >> 8), (b)
#define GS_DUO(a, b) (uint8_t)((a) >> 4), (uint8_t)((a) << 4) | (uint8_t)((b) >> 8), (uint8_t)(b)
#if VPRG_ENABLED #if VPRG_ENABLED

View File

@ -26,9 +26,9 @@
#include "Tlc5940.h" #include "Tlc5940.h"
#include "pinouts/pin_functions.h" #include "pinouts/pin_functions.h"
void tlc_setGSfromProgmem(const uint8_t PROGMEM *gsArray); void tlc_setGSfromProgmem(const uint8_t /*PROGMEM*/ *gsArray);
#if VPRG_ENABLED #if VPRG_ENABLED
void tlc_setDCfromProgmem(const uint8_t PROGMEM *dcArray); void tlc_setDCfromProgmem(const uint8_t /*PROGMEM*/ *dcArray);
#endif #endif
/** \addtogroup ExtendedFunctions /** \addtogroup ExtendedFunctions
@ -62,9 +62,9 @@ Tlc.update();
The format of the grayscale array is explained in #tlc_GSData. The format of the grayscale array is explained in #tlc_GSData.
\param gsArray A progmem array of grayscale data. */ \param gsArray A progmem array of grayscale data. */
void tlc_setGSfromProgmem(const uint8_t PROGMEM *gsArray) void tlc_setGSfromProgmem(const uint8_t /*PROGMEM*/ *gsArray)
{ {
const uint8_t PROGMEM *gsArrayp = gsArray; const uint8_t /*PROGMEM*/ *gsArrayp = gsArray;
uint8_t *gsDatap = tlc_GSData; uint8_t *gsDatap = tlc_GSData;
while (gsDatap < tlc_GSData + NUM_TLCS * 24) { while (gsDatap < tlc_GSData + NUM_TLCS * 24) {
*gsDatap++ = pgm_read_byte(gsArrayp++); *gsDatap++ = pgm_read_byte(gsArrayp++);