#include "tlc_animations.h"
#include "tlc_fades.h"
#include "tlc_progmem_utils.h"
#include "tlc_servos.h"
#include "tlc_shifts.h"
Modules | |
| Functions that Require VPRG_ENABLED | |
| Functions that require VPRG_ENABLED == 1. | |
Functions | |
| void | tlc_playAnimation (prog_uint8_t *animation, uint16_t frames, uint16_t periodsPerFrame) |
| Plays an animation from progmem in the "background" (with interrupts). | |
| volatile void | tlc_animationXLATCallback (void) |
| This is called by the XLAT interrupt every PWM period to do stuff. | |
| uint8_t | tlc_addFade (struct Tlc_Fade *fade) |
| Adds a fade to the buffer. | |
| uint8_t | tlc_addFade (TLC_CHANNEL_TYPE channel, int16_t startValue, int16_t endValue, uint32_t startMillis, uint32_t endMillis) |
| Adds a fade to the fade buffer. | |
| uint8_t | tlc_isFading (TLC_CHANNEL_TYPE channel) |
| Checks to see if any fades are happening on channel. | |
| uint8_t | tlc_removeFades (TLC_CHANNEL_TYPE channel) |
| Removes any fades from the fade buffer on this channel. | |
| uint8_t | tlc_updateFades () |
| Updates fades using millis(). | |
| uint8_t | tlc_updateFades (uint32_t currentMillis) |
| Updates any running fades. | |
| void | tlc_setGSfromProgmem (prog_uint8_t *gsArray) |
| Sets the grayscale data from an array in progmem. | |
| void | tlc_initServos (uint8_t initAngle) |
| Initializes the tlc. | |
| void | tlc_setServo (TLC_CHANNEL_TYPE channel, uint8_t angle) |
| Sets a servo on channel to angle. | |
| uint8_t | tlc_getServo (TLC_CHANNEL_TYPE channel) |
| Gets the current angle that channel is set to. | |
| uint16_t | tlc_angleToVal (uint8_t angle) |
| Converts and angle (0 - SERVO_MAX_ANGLE) to the inverted tlc channel value (4095 - 0). | |
| uint8_t | tlc_valToAngle (uint16_t value) |
| Converts an inverted tlc channel value (4095 - 0) into an angle (0 - SERVO_MAX_ANGLE). | |
| uint16_t | tlc_shiftUp (uint16_t zeroValue) |
| Shifts all the channel data up (OUT0 becomes OUT1 . | |
| uint16_t | tlc_shiftDown (uint16_t topValue) |
| Shifts all the channel data down (OUT 15 -> OUT 14 . | |
| uint8_t tlc_addFade | ( | TLC_CHANNEL_TYPE | channel, | |
| int16_t | startValue, | |||
| int16_t | endValue, | |||
| uint32_t | startMillis, | |||
| uint32_t | endMillis | |||
| ) |
Adds a fade to the fade buffer.
| channel | the ouput channel this fade is on | |
| startValue | the value at the start of the fade | |
| endValue | the value at the end of the fade | |
| startMillis | the millis() when to start the fade | |
| endMillis | the millis() when to end the fade |
| uint8_t tlc_addFade | ( | struct Tlc_Fade * | fade | ) |
Adds a fade to the buffer.
| fade | the fade to be copied into the buffer |
| uint16_t tlc_angleToVal | ( | uint8_t | angle | ) |
Converts and angle (0 - SERVO_MAX_ANGLE) to the inverted tlc channel value (4095 - 0).
| volatile void tlc_animationXLATCallback | ( | void | ) |
This is called by the XLAT interrupt every PWM period to do stuff.
| uint8_t tlc_getServo | ( | TLC_CHANNEL_TYPE | channel | ) |
Gets the current angle that channel is set to.
| channel | which channel to get |
| void tlc_initServos | ( | uint8_t | initAngle | ) |
Initializes the tlc.
| initAngle | the initial angle to set all servos to (0 - SERVO_MAX_ANGLE). |
| uint8_t tlc_isFading | ( | TLC_CHANNEL_TYPE | channel | ) |
Checks to see if any fades are happening on channel.
| channel | the channel to check |
| void tlc_playAnimation | ( | prog_uint8_t * | animation, | |
| uint16_t | frames, | |||
| uint16_t | periodsPerFrame | |||
| ) |
Plays an animation from progmem in the "background" (with interrupts).
| animation | A progmem array of grayscale data, length NUM_TLCS * 24 * frames, in reverse order. Ensure that there is not an update waiting to happen before calling this. | |
| frames | the number of frames in animation | |
| 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. |
| uint8_t tlc_removeFades | ( | TLC_CHANNEL_TYPE | channel | ) |
Removes any fades from the fade buffer on this channel.
| channel | which channel the fades are on |
| void tlc_setGSfromProgmem | ( | prog_uint8_t * | gsArray | ) |
Sets the grayscale data from an array in progmem.
This doesn't shift out any data: call Tlc.update(). An example:
#include "tlc_progmem_utils.h" prog_uint8_t 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), GS_DUO((4095 * 4)/16, (4095 * 3)/16), GS_DUO((4095 * 2)/16, (4095 * 1)/16), }; // sometime after Tlc.init() tlc_setGSfromProgmem(gsArray1); Tlc.update();
The format of the grayscale array is explained in tlc_GSData.
| gsArray | A progmem array of grayscale data. |
| void tlc_setServo | ( | TLC_CHANNEL_TYPE | channel, | |
| uint8_t | angle | |||
| ) |
Sets a servo on channel to angle.
| channel | which channel to set | |
| angle | (0 - SERVO_MAX_ANGLE) |
| uint16_t tlc_shiftDown | ( | uint16_t | topValue | ) |
Shifts all the channel data down (OUT 15 -> OUT 14 .
..). Needs a Tlc.update() after.
| topValue | the value of Tlc (n) channel 15. |
| uint16_t tlc_shiftUp | ( | uint16_t | zeroValue | ) |
Shifts all the channel data up (OUT0 becomes OUT1 .
..). Needs a Tlc.update() after.
| zeroValue | the value of channel 0. |
| uint8_t tlc_updateFades | ( | uint32_t | currentMillis | ) |
Updates any running fades.
| currentMillis | the current millis() time. |
| uint8_t tlc_updateFades | ( | ) |
Updates fades using millis().
| uint8_t tlc_valToAngle | ( | uint16_t | value | ) |
Converts an inverted tlc channel value (4095 - 0) into an angle (0 - SERVO_MAX_ANGLE).
1.5.6