16 #include <avr/pgmspace.h>
22 #define WARN TLC59116Warn // FIXME: how about a include? or 2 copies (sed'ed)?
23 #define DEV TLC59116Dev
24 #define LOWD TLC59116LowLevel
116 bool with_delay =
true
177 word bits = 1 << led_num;
204 const byte brightness[]
207 TLC59116&
pwm(byte led_num_start, byte led_num_end,
const byte brightness[] ) {
return set_outputs(led_num_start, led_num_end, brightness); }
213 TLC59116&
pwm(byte led_num_start, byte led_num_end, byte pwm_value) {
214 const byte register_count = led_num_end - led_num_start +1;
216 byte pwm_buff[register_count];
217 memset(pwm_buff, pwm_value, register_count);
218 return set_outputs(led_num_start, led_num_end, pwm_buff);
275 ) {
return group_blink(0xFFFF,blink_period,on_ratio); }
284 double blink_length_secs,
285 double on_percent=50.0
287 return group_blink(0xFFFF,blink_length_secs,on_percent);
296 (byte)
int(blink_length_secs/0.041666667 + .0001),
297 (byte)
int(on_percent * 256.0/100.0)
304 return group_blink((word)bit_pattern, blink_length_secs,
int(on_percent * 256.0/100.0));
463 void reset_happened();
464 void modify_control_register(byte register_num, byte mask, byte bits);
465 void modify_control_register(byte register_num, byte value);
468 void update_registers(
const byte want[] , byte start_r, byte end_r);
475 void reset_shadow_registers() {
479 void sync_shadow_registers() { }
502 void propagate_register(byte register_num);
551 ) :
i2cbus(w), init_frequency(frequency), reset_actions(dothings) { }
573 if (index >= device_ct) {
575 return *(devices[0]);
578 return *(devices[index]);
bool is_inited()
Definition: TLC59116.h:563
bool is_allcall_address()
Is broadcast enabled?
Definition: TLC59116.h:339
TLC59116 & pwm(byte led_num, byte brightness)
PWM for one channel.
Definition: TLC59116.h:232
TLC59116 & set_milliamps(byte ma, int Rext=Rext_Min)
Definition: TLC59116.cpp:436
static const byte MaxDevicesPerI2C
Definition: TLC59116.h:528
static byte SUBADRx_Register(byte i)
Definition: TLC59116_Unmanaged.h:228
static const byte IREF_Register
Definition: TLC59116_Unmanaged.h:234
TLC59116 & pwm(byte led_num_start, byte led_num_end, const byte brightness[])
Alias of set_outputs() above.
Definition: TLC59116.h:207
static const byte Reset
Definition: TLC59116.h:534
TLC59116 & SUBADR_address_disable(byte which)
TLC59116 & group_blink(unsigned int bit_pattern, int blink_length_secs, double on_percent=50.0)
Definition: TLC59116.h:303
static const byte MODE1_ALLCALL_mask
Definition: TLC59116_Unmanaged.h:182
void TLC59116Warn(const T msg, int format=0)
Definition: TLC59116_Unmanaged.h:105
byte SUBADR_address(byte which)
Get the SUBADR_n address.
Definition: TLC59116.h:351
bool is_enable_outputs()
Is master power on?
Definition: TLC59116.h:120
TLC59116 & on(int led_num)
Turn one on.
Definition: TLC59116.h:180
TLC59116 & group_pwm(word bit_pattern, byte brightness)
Definition: TLC59116.cpp:245
TLC59116Manager()
Definition: TLC59116.h:542
#define DEV
Definition: TLC59116.h:23
Broadcast(TwoWire &bus, TLC59116Manager &m)
Definition: TLC59116.h:490
TLC59116 & group_blink(byte blink_period, byte on_ratio=128)
Blink all the LEDs, at their current/last PWM setting.
Definition: TLC59116.h:272
static const byte WireInit
Definition: TLC59116.h:531
TLC59116 & pwm(const byte(&brightness)[16])
Set all 16 PWM according to the brightness list, same as above.
Definition: TLC59116.h:226
static const byte EnableOutputs
Definition: TLC59116.h:533
static const byte Control_Register_Max
Definition: TLC59116_Unmanaged.h:247
byte Reset_address()
The reset-address, unchangeable.
Definition: TLC59116.h:319
static const byte MODE1_Register
Definition: TLC59116_Unmanaged.h:175
Holds all of the devices.
Definition: TLC59116.h:520
byte device_count()
Definition: TLC59116.h:581
static const byte Reset_Addr
Definition: TLC59116_Unmanaged.h:149
int milliamps(int Rext=Rext_Min)
Definition: TLC59116.h:406
byte allcall_address()
Get broadcast address, see below to set/enable.
Definition: TLC59116.h:322
TLC59116 & group_blink(word bit_pattern, double blink_length_secs, double on_percent=50.0)
Definition: TLC59116.h:292
TLC59116 & pwm(byte led_num_start, byte led_num_end, byte pwm_value)
PWM, start..end same brightness.
Definition: TLC59116.h:213
void init()
Definition: TLC59116.cpp:36
virtual TLC59116 & enable_outputs(bool yes=true, bool with_delay=true)
Master power switch (the TLC59116Manager sets this on/true by default)
Definition: TLC59116.cpp:142
TLC59116 & group_blink(double blink_length_secs, double on_percent=50.0)
Definition: TLC59116.h:283
TLC59116 & pattern(word bit_pattern, word bit_which=0xFFFF)
Alias for set_outputs()
Definition: TLC59116.h:154
TLC59116 & describe_shadow()
Print the registers, as we've cached them. cf. describe_actual()
Definition: TLC59116.cpp:361
static const byte Already
Definition: TLC59116.h:535
Definition: TLC59116.h:488
High Level interface to a single TLC59116 using Wire (I2C) interface.
Definition: TLC59116.h:103
TLC59116 & allcall_address_disable()
Disable broadcast.
Definition: TLC59116.cpp:425
static const int Rext_Min
Definition: TLC59116_Unmanaged.h:238
int reset()
Definition: TLC59116.cpp:120
Definition: TLC59116_Unmanaged.h:133
TLC59116 & SUBADR_address_enable(byte which)
Enable SUBADR_n.
static const byte AllCall_Addr_Register
Definition: TLC59116_Unmanaged.h:233
TwoWire & i2cbus
Definition: TLC59116_Unmanaged.h:285
bool is_SUBADR_bit(byte mode1_value, byte which)
Definition: TLC59116_Unmanaged.h:181
TLC59116Manager(TwoWire &w, long frequency=Default_Frequency, byte dothings=WireInit|EnableOutputs|Reset)
Definition: TLC59116.h:546
TLC59116 & set(int led_num, bool offon)
Turn one on/off, much like DigitalWrite.
Definition: TLC59116.h:176
static const byte AllCall_Addr
Definition: TLC59116_Unmanaged.h:146
bool is_SUBADR_address(byte which)
Is SUBADR_n enabled?
Definition: TLC59116.h:352
static const long Default_Frequency
Definition: TLC59116.h:537
TLC59116::Broadcast & broadcast()
Definition: TLC59116.h:587
TLC59116 & delay(int msec)
Definition: TLC59116.h:422
byte address()
Definition: TLC59116_Unmanaged.h:303
TLC59116 & on_pattern(word pattern)
Turn on by bit pattern.
Definition: TLC59116.h:162
TLC59116 & set_outputs(const byte brightness[16])
Set all 16 PWM according to the brightness list.
Definition: TLC59116.h:225
bool is_enabled()
Definition: TLC59116.h:121
bool is_OSC_bit(byte mode1_value)
Definition: TLC59116_Unmanaged.h:177
static byte i_out(byte CM, byte HC, byte CC, int Rext=Rext_Min)
Definition: TLC59116_Unmanaged.cpp:145
TLC59116 & allcall_address_enable()
Enable broadcast.
Definition: TLC59116.cpp:419
TLC59116 & set_outputs(word pattern, word which)
Only change the channels (that are marked in bit_which) to on/off as marked in bit_pattern ...
Definition: TLC59116.cpp:177
TLC59116 & resync_shadow_registers()
Definition: TLC59116.cpp:431
Broadcast & enable_outputs(bool yes=true, bool with_delay=true)
Master power switch (the TLC59116Manager sets this on/true by default)
Definition: TLC59116.cpp:446
TLC59116 & off(int led_num)
Turn one off.
Definition: TLC59116.h:181
TLC59116 & operator[](byte index)
Definition: TLC59116.h:572
static Scan & scan(void)
Definition: TLC59116_Unmanaged.h:399
TLC59116 & off_pattern(word pattern)
Turn off by bit pattern.
Definition: TLC59116.h:170