diff --git a/examples/BasicAnimations/ani_arduino.h b/examples/BasicAnimations/ani_arduino.h index dc92f1a..9304658 100644 --- a/examples/BasicAnimations/ani_arduino.h +++ b/examples/BasicAnimations/ani_arduino.h @@ -1,5 +1,5 @@ #define ANI_ARDUINO_FRAMES 80 -uint8_t ani_arduino[NUM_TLCS * 24 * ANI_ARDUINO_FRAMES] PROGMEM = { +const uint8_t ani_arduino[NUM_TLCS * 24 * ANI_ARDUINO_FRAMES] PROGMEM = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,6,176,206, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,65,10,64,247,15,240,255, 0,0,0,0,0,0,0,0,0,0,0,0,1,160,122,13,192,255,15,240,254,11,192,89, diff --git a/tlc_animations.h b/tlc_animations.h index 0882db9..7e06ffd 100644 --- a/tlc_animations.h +++ b/tlc_animations.h @@ -30,7 +30,7 @@ #include "tlc_progmem_utils.h" /** The currently playing animation */ -prog_uint8_t *tlc_currentAnimation; +const uint8_t *tlc_currentAnimation; /** The number of frames in the current animation */ volatile uint16_t tlc_animationFrames; /** The number of PWM periods to display each frame - 1 */ @@ -39,11 +39,11 @@ volatile uint16_t tlc_animationPeriodsPerFrame; volatile uint16_t tlc_animationPeriodsWait; volatile void tlc_animationXLATCallback(void); -void tlc_playAnimation(prog_uint8_t *animation, uint16_t frames, uint16_t periodsPerFrame); +void tlc_playAnimation(const uint8_t PROGMEM *animation, uint16_t frames, uint16_t periodsPerFrame); /** \addtogroup ExtendedFunctions \code #include "tlc_animations.h" \endcode - - void tlc_playAnimation(prog_uint8_t *animation, uint16_t frames, + - void tlc_playAnimation(const uint8_t PROGMEM *animation, uint16_t frames, uint16_t periodsPerFrame) - plays an animation from progmem. */ /* @{ */ @@ -55,7 +55,7 @@ void tlc_playAnimation(prog_uint8_t *animation, uint16_t frames, uint16_t period \param periodsPerFrame number of PWM periods to wait between each frame (0 means play the animation as fast as possible). The default PWM period for a 16MHz clock is 1.024ms. */ -void tlc_playAnimation(prog_uint8_t *animation, uint16_t frames, uint16_t periodsPerFrame) +void tlc_playAnimation(const uint8_t PROGMEM *animation, uint16_t frames, uint16_t periodsPerFrame) { tlc_currentAnimation = animation; tlc_animationFrames = frames; diff --git a/tlc_progmem_utils.h b/tlc_progmem_utils.h index e87406e..e1f7c97 100644 --- a/tlc_progmem_utils.h +++ b/tlc_progmem_utils.h @@ -26,17 +26,17 @@ #include "Tlc5940.h" #include "pinouts/pin_functions.h" -void tlc_setGSfromProgmem(prog_uint8_t *gsArray); +void tlc_setGSfromProgmem(const uint8_t PROGMEM *gsArray); #if VPRG_ENABLED -void tlc_setDCfromProgmem(prog_uint8_t *dcArray); +void tlc_setDCfromProgmem(const uint8_t PROGMEM *dcArray); #endif /** \addtogroup ExtendedFunctions \code #include "tlc_progmem_utils.h" \endcode - - void tlc_setGSfromProgmem(prog_uint8_t *gsArray) - copies the progmem + - void tlc_setGSfromProgmem(const uint8_t PROGMEM *gsArray) - copies the progmem grayscale to current grayscale array. Requires a \link Tlc5940::update Tlc.update() \endlink. - - void tlc_setDCfromProgmem(prog_uint8_t *dcArray) - shifts the data from a + - void tlc_setDCfromProgmem(const uint8_t PROGMEM *dcArray) - shifts the data from a progmem dot correction array (doesn't need an update). */ /* @{ */ @@ -44,7 +44,7 @@ void tlc_setDCfromProgmem(prog_uint8_t *dcArray); any data: call Tlc.update(). An example: \code #include "tlc_progmem_utils.h" -prog_uint8_t gsArray1[NUM_TLCS * 24] = { +const uint8_t PROGMEM gsArray1[NUM_TLCS * 24] = { 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), @@ -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(prog_uint8_t *gsArray) +void tlc_setGSfromProgmem(const uint8_t PROGMEM *gsArray) { - prog_uint8_t *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++); @@ -78,14 +78,14 @@ void tlc_setGSfromProgmem(prog_uint8_t *gsArray) /** \addtogroup ReqVPRG_ENABLED From tlc_progmem_utils.h: - - tlc_setDCfromProgmem(prog_uint8_t *dcArray) - shifts the data from a + - tlc_setDCfromProgmem(const uint8_t PROGMEM *dcArray) - shifts the data from a progmem dot correction array (doesn't need an update). */ /* @{ */ /** Sets the dot correction data from an array in progmem. An example: \code #include "tlc_progmem_utils.h" -prog_uint8_t dcArray1[NUM_TLCS * 12] = { +const uint8_t PROGMEM dcArray1[NUM_TLCS * 12] = { DC_QUARTET(32, 63, 32, 63), DC_QUARTET(32, 63, 32, 63), DC_QUARTET(32, 63, 32, 63), DC_QUARTET(32, 63, 32, 63), }; @@ -103,12 +103,12 @@ tlc_setDCfromProgmem(dcArray1); \param dcArray A progmem array of dot correction data to be shifted out. \see \link Tlc5940::setAllDC Tlc.setAllDC \endlink */ -void tlc_setDCfromProgmem(prog_uint8_t *dcArray) +void tlc_setDCfromProgmem(const uint8_t PROGMEM *dcArray) { tlc_dcModeStart(); - prog_uint8_t *p = dcArray; - prog_uint8_t *dcArrayEnd = dcArray + NUM_TLCS * 12; + const uint8_t PROGMEM *p = dcArray; + const uint8_t PROGMEM *dcArrayEnd = dcArray + NUM_TLCS * 12; while (p < dcArrayEnd) { tlc_shift8(pgm_read_byte(p++)); }