diff --git a/examples/UsingProgmem/UsingProgmem.ino b/examples/UsingProgmem/UsingProgmem.ino index 3aa0b17..908d584 100644 --- a/examples/UsingProgmem/UsingProgmem.ino +++ b/examples/UsingProgmem/UsingProgmem.ino @@ -24,11 +24,14 @@ The pattern below will only work with 1 TLC. Copy + Paste the 4 lines inside the curly brackets for each additional TLC. */ + +const unsigned int TlcMax = 4095; + 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((4095 * 12)/16, (4095 * 11)/16), GS_DUO((4095 * 10)/16, (4095 * 9)/16), - GS_DUO((4095 * 8)/16, (4095 * 7)/16), GS_DUO((4095 * 6)/16, (4095 * 5)/16), - GS_DUO((4095 * 4)/16, (4095 * 3)/16), GS_DUO((4095 * 2)/16, (4095 * 1)/16), + GS_DUO((TlcMax * 16)/16, (TlcMax * 15)/16), GS_DUO((TlcMax * 14)/16, (TlcMax * 13)/16), + GS_DUO((TlcMax * 12)/16, (TlcMax * 11)/16), GS_DUO((TlcMax * 10)/16, (TlcMax * 9)/16), + GS_DUO((TlcMax * 8)/16, (TlcMax * 7)/16), GS_DUO((TlcMax * 6)/16, (TlcMax * 5)/16), + GS_DUO((TlcMax * 4)/16, (TlcMax * 3)/16), GS_DUO((TlcMax * 2)/16, (TlcMax * 1)/16), }; void setup() diff --git a/tlc_config.h b/tlc_config.h index 9a81d1e..a7382c6 100644 --- a/tlc_config.h +++ b/tlc_config.h @@ -158,7 +158,9 @@ /** 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 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 diff --git a/tlc_progmem_utils.h b/tlc_progmem_utils.h index e1f7c97..a87ae28 100644 --- a/tlc_progmem_utils.h +++ b/tlc_progmem_utils.h @@ -26,9 +26,9 @@ #include "Tlc5940.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 -void tlc_setDCfromProgmem(const uint8_t PROGMEM *dcArray); +void tlc_setDCfromProgmem(const uint8_t /*PROGMEM*/ *dcArray); #endif /** \addtogroup ExtendedFunctions @@ -62,9 +62,9 @@ Tlc.update(); The format of the grayscale array is explained in #tlc_GSData. \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; while (gsDatap < tlc_GSData + NUM_TLCS * 24) { *gsDatap++ = pgm_read_byte(gsArrayp++);