00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef TLC5940_H
00020 #define TLC5940_H
00021
00025 #include <stdint.h>
00026 #include "tlc_config.h"
00027
00028 #ifdef TLC_ATMEGA_8_H
00029
00032 #define set_XLAT_interrupt() TIFR |= _BV(TOV1); TIMSK = _BV(TOIE1)
00033
00034 #define clear_XLAT_interrupt() TIMSK = 0
00035
00036 #else
00037
00040 #define set_XLAT_interrupt() TIFR1 |= _BV(TOV1); TIMSK1 = _BV(TOIE1)
00041
00042 #define clear_XLAT_interrupt() TIMSK1 = 0
00043
00044 #endif
00045
00047 #define enable_XLAT_pulses() TCCR1A = _BV(COM1A1) | _BV(COM1B1)
00048
00049 #define disable_XLAT_pulses() TCCR1A = _BV(COM1B1)
00050
00051 extern volatile uint8_t tlc_needXLAT;
00052 extern volatile void (*tlc_onUpdateFinished)(void);
00053 extern uint8_t tlc_GSData[NUM_TLCS * 24];
00054
00057 class Tlc5940
00058 {
00059 public:
00060 void init(uint16_t initialValue = 0);
00061 void clear(void);
00062 uint8_t update(void);
00063 void set(TLC_CHANNEL_TYPE channel, uint16_t value);
00064 uint16_t get(TLC_CHANNEL_TYPE channel);
00065 void setAll(uint16_t value);
00066 #if VPRG_ENABLED
00067 void setAllDC(uint8_t value);
00068 #endif
00069 #if XERR_ENABLED
00070 uint8_t readXERR(void);
00071 #endif
00072
00073 };
00074
00075 void tlc_shift8_init(void);
00076 void tlc_shift8(uint8_t byte);
00077
00078 #if VPRG_ENABLED
00079 void tlc_dcModeStart(void);
00080 void tlc_dcModeStop(void);
00081 #endif
00082
00083
00084 extern Tlc5940 Tlc;
00085
00086 #endif
00087