TLC59116 Library  v0.2
TLC59116_Unmanaged.h (Sat Jun 20 14:19:53 2015 -0400)
Go to the documentation of this file.
1 #ifndef TLC59116_Unmanaged_h
2 #define TLC59116_Unmanaged_h
3 
4 /* \todo
5  - group functions, and constants
6 */
7 
8 /*
9  Pins:
10  TLC59116: 27:SDA, 26:SCL
11  UNO: A4:SDA, A5:SCL
12  mega: as marked
13  teensy: ...
14 
15  In your setup():
16  Wire.begin();
17  Serial.init(nnnnn); // if you do TLC59116_WARNINGS=1, or use any of the describes
18  // Run the I2C faster (default is 100000L):
19  const long want_freq = 340000L; // 100000L; .. 340000L for 1, not termination
20  TWBR = ((F_CPU / want_freq) - 16) / 2; // aka want_freq = F_CPU/(2*TWBR +16). F_CPU is supplied by arduino-ide
21 
22 
23  ?? What does a read on AllCall get?
24  TLC59108 is supposedly the same except only 8 channels.
25  8 output channels
26  64 addresses : quad-value pins A0,A1,A2 (see datasheet)
27  16..47,80..103,112..119
28 
29  TLC59208F : 4channel, similar, pin changes, up to 64 devices, etc.
30 
31  Dandelion address jumpers:
32  Don't use the "reserved", you can use "programmable reserved"
33  A B C D
34  0 0 0 0 = 0x60
35  0 0 0 1 = 0x61
36  ...
37  0 1 1 1 = 0x67
38  1 0 0 0 = 0x68 (AllCall, reserved)
39  1 0 0 1 = 0x69 (SUBADR1, programmable reserved)
40  1 0 1 0 = 0x6A (SUBADR2, programmable reserved)
41  1 0 1 1 = 0x6B (RESET, reserved)
42  1 1 0 0 = 0x6C (SUBADR3, programmable reserved)
43  1 1 0 1 = 0x6D
44  1 1 1 1 = 0x6E
45 
46  !! erratic flashes seen when using GRPPWM and decreasing it over time
47  claimed to happen at same point every time (speed dependant I think)
48  !! I see flickering when: many LEDs (14) are pwm on fairly dim (20), and I on/off blink another LED.
49  adjustng Vext seems to improve the situation (so, current?)
50  "As the value of GRPFREQ increases, the GRPPWM duty cycle dynamic range decreases" -- Karl M
51  http://e2e.ti.com/support/power_management/led_driver/f/192/p/201430/1048227.aspx#1048227
52  http://e2e.ti.com/support/power_management/led_driver/f/192/t/153172.aspx
53  !! This stuff appears to work in a timer-service-routine, but you must (re-)enable interrupts in the isr: sei();
54 
55  Consider merging with https://github.com/jrowberg/i2cdevlib
56 
57  todo: post to arduino playground
58 
59 */
60 
61 #include <Arduino.h>
62 
63 // Set this to 1/true for lowlevel debugging messages
64 #ifndef TLC59116_LOWLEVEL
65  #define TLC59116_LOWLEVEL 0
66 #endif
67 
68 // Set this to 1/true to turn on lower-level development debugging
69 // Don't forget to Serial.begin(some-speed)
70 #ifndef TLC59116_DEV
71  #if TLC59116_LOWLEVEL
72  #define TLC59116_DEV 1
73  #else
74  #define TLC59116_DEV 0
75  #endif
76 #endif
77 
78 // Set this to 1/true to turn on Warnings & info
79 #ifndef TLC59116_WARNINGS
80  #if TLC59116_DEV
81  #define TLC59116_WARNINGS 1
82  #else
83  #define TLC59116_WARNINGS 0
84  #endif
85 #endif
86 
87 // inline the Warn() function, when disabled, no code
88 #if TLC59116_WARNINGS
89  template <typename T> void inline TLC59116Warn(const T msg) {Serial.print(msg);}
90  template <typename T> void inline TLC59116Warn(T msg, int format) { // and inlined
91  if (format == BIN) {
92  Serial.print(F("0b")); // so tired
93  for(byte i=0; i < (sizeof(msg) * 8); i++) {
94  Serial.print( (msg & ((T)1 << (sizeof(msg) * 8 - 1))) ? "1" : "0");
95  msg <<= 1;
96  }
97  }
98  else {
99  if (format == HEX) Serial.print(F("0x")); // so tired
100  Serial.print(msg, format);
101  }
102  }
103  void inline TLC59116Warn() { Serial.println();}
104 #else
105  template <typename T> void inline TLC59116Warn(const T msg, int format=0) {}
106  void inline TLC59116Warn() {}
107 #endif
108 
109 #if TLC59116_DEV
110  template <typename T> void inline TLC59116Dev(const T msg) {TLC59116Warn(msg);}
111  template <typename T> void inline TLC59116Dev(T msg, int format) {TLC59116Warn(msg, format);}
112  void inline TLC59116Dev() {TLC59116Warn();}
113 #else
114  template <typename T> void inline TLC59116Dev(const T msg) {}
115  template <typename T> void inline TLC59116Dev(T msg, int format) {}
116  void inline TLC59116Dev() {}
117 #endif
118 
119 #if TLC59116_LOWLEVEL
120  template <typename T> void inline TLC59116LowLevel(T msg) {TLC59116Warn(msg);}
121  template <typename T> void inline TLC59116LowLevel(T msg, int format) {TLC59116Warn(msg, format);}
122  void inline TLC59116LowLevel() {TLC59116Warn();}
123 #else
124  template <typename T> void inline TLC59116LowLevel(T msg) {}
125  template <typename T> void inline TLC59116LowLevel(T msg, int format) {}
126  void inline TLC59116LowLevel() {}
127 #endif
128 
129 // for .c
130 #include <Wire.h> // does nothing in the .h
131 extern TwoWire Wire;
132 
134 
135  public:
136  class Scan;
137 
138  public: // constants
139  static const byte Channels = 16; // number of channels
140 
141  // Addresses (7 bits, as per Wire library)
142  // these are defined by the device (datasheet)
143  // 11 are Unassigned, 14 available, at power up; 1 more if allcall is disabled.
144  static const byte Base_Addr = 0x60; // 0b110xxxx
145  // + 0x00 .. 0x07 // Unassigned at on/reset
146  static const byte AllCall_Addr = Base_Addr + 0x08; // +0b1000 Programmable Enabled at on/reset
147  static const byte SUBADR1 = Base_Addr + 0x09; // +0b1001 Programmable Disabled at on/reset
148  static const byte SUBADR2 = Base_Addr + 0x0A; // +0b1010 Programmable Disabled at on/reset
149  static const byte Reset_Addr = Base_Addr + 0x0B; // +0b1011
150  // The byte(s) sent for Reset_Addr are not increment+address, it's a special mode
151  static const word Reset_Bytes = 0xA55A;
152  static const byte SUBADR3 = Base_Addr + 0x0C; // +0b1100 Programmable Disabled at on/reset
153  // + 0x0D .. 0x0F // Unassigned at on/reset
154  static const byte Max_Addr = Base_Addr + 0xF; // 14 typically available
155  static bool is_device_range_addr(byte address) { return address >= Base_Addr && address <= Max_Addr; } // inline
156 
157  // Does not take into account changed/enabled
158  static bool is_default_SUBADR(byte address) { return address == SUBADR1 || address == SUBADR2 || address == SUBADR3; }
159  // Is a single device: not AllCall,Reset,or SUBADRx
160  // does not take into account programmable addresses, nor whether they are enabled
161  static bool is_default_single_addr(byte address) {
162  return is_device_range_addr(address) && address != Reset_Addr && address != AllCall_Addr && !is_default_SUBADR(address);
163  }
164 
165  public: // Low-Level constants
166  // Auto-increment mode bits
167  // default is Auto_none, same register can be written to multiple times
168  static const byte Auto_All = 0b10000000; // 0..Control_Register_Max
169  static const byte Auto_PWM = 0b10100000; // PWM0_Register .. (Channels-1)
170  static const byte Auto_GRP = 0b11000000; // GRPPWM..GRPFREQ
171  static const byte Auto_PWM_GRP = 0b11100000; // PWM0_Register..n, GRPPWM..GRPFREQ
172 
173  // Control Registers FIXME: move to "low level"
174  static const byte Control_Register_Min = 0;
175  static const byte MODE1_Register = 0x00;
176  static const byte MODE1_OSC_mask = 0b10000;
177  bool is_OSC_bit(byte mode1_value) { return mode1_value & MODE1_OSC_mask; } // OSC is inverted for enable!
178  static const byte MODE1_SUB1_mask = 0b1000;
179  static const byte MODE1_SUB2_mask = 0b100;
180  static const byte MODE1_SUB3_mask = 0b10;
181  bool is_SUBADR_bit(byte mode1_value, byte which) { return mode1_value & (MODE1_SUB1_mask >> (which-1)); }
182  static const byte MODE1_ALLCALL_mask = 0b1;
183  static const byte MODE2_Register = 0x01;
184  static const byte MODE2_DMBLNK = 1 << 5; // 0 = group dimming, 1 = group blinking
185  static const byte MODE2_EFCLR = 1 << 7; // 0 to enable, 1 to clear
186  static const byte MODE2_OCH = 1 << 3; // 0 = "latch" on Stop, 1 = latch on ACK
187  static const byte PWM0_Register = 0x02;
188  static byte PWMx_Register(byte led_num) { LEDOUTx_CHECK(__LINE__,led_num); return PWM0_Register + led_num; }
189  static const byte GRPPWM_Register = 0x12; // aka blink-duty-cycle-register
190  static const byte GRPFREQ_Register = 0x13; // aka blink-length 0=~24hz, 255=~10sec
191  static const byte LEDOUT0_Register = 0x14; // len_num -> LEDOUTx_Register number. Registers are: {0x14, 0x15, 0x16, 0x17}
192  static const byte LEDOUTx_Max = Channels-1; // 0..15
193  const static byte LEDOUT_Mask = 0b11; // 2 bits per led
194  const static byte LEDOUT_PWM = 0b10;
195  const static byte LEDOUT_GRPPWM = 0b11; // also "group blink" when mode2[dmblnk] = 1
196  const static byte LEDOUT_DigitalOn = 0b01;
197  const static byte LEDOUT_DigitalOff = 0b00;
198  static byte LEDOUTx_Register(byte led_num) { return LEDOUT0_Register + (led_num >> 2); } // 4 leds per register
199  static byte is_valid_led(byte v) { return v <= LEDOUTx_Max; };
200  static void LEDOUTx_CHECK(int line, byte led_num) {
201  if (led_num > LEDOUTx_Max) {
202  TLC59116Warn(F("led_num out of range "));TLC59116Warn(led_num);
203  TLC59116Warn(F(" @")); TLC59116Warn(line); TLC59116Warn();
204  }
205  }
206  // FIXME: check for usage of these
207  static byte LEDx_Register_mask(byte led_num) { // bit mask for led mode bits
208  LEDOUTx_CHECK(__LINE__, led_num);
209  return LEDOUT_Mask << (2 * (led_num % 4));
210  }
211  static byte LEDx_Register_bits(byte led_num, byte register_value) { // extract bits for led
212  LEDOUTx_CHECK(__LINE__, led_num);
213  return register_value & LEDx_Register_mask(led_num);
214  }
215  static byte LEDx_to_Register_bits(byte led_num, byte out_mode) { return (LEDOUT_Mask & out_mode) << (2 * (led_num % 4));} // 2 bits in a LEDOUTx_Register
216  static byte LEDx_set_mode(byte was, byte led_num, byte mode) {
217  LEDOUTx_CHECK(__LINE__, led_num);
218  return set_with_mask(was, LEDx_Register_mask(led_num), LEDx_to_Register_bits(led_num, mode));
219  }
220  static void LEDx_set_mode(byte registers[] /*[4]*/, byte to_what, word which);
221 
222  static byte LEDx_pwm_bits(byte led_num) {return LEDx_to_Register_bits(led_num, LEDOUT_PWM);}
223  static byte LEDx_gpwm_bits(byte led_num) {return LEDx_to_Register_bits(led_num, LEDOUT_GRPPWM);}
224  static byte LEDx_digital_off_bits(byte led_num) { return 0; }; // no calc needed (cheating)
225  static byte LEDx_digital_on_bits(byte led_num) { return LEDx_to_Register_bits(led_num, LEDOUT_DigitalOn);}
226  // LEDOUT3_Register = 0x17; // cf. LEDOUTx_max. FIXME: maybe the list, maybe a max?
227  static const byte SUBADR1_Register = 0x18;
228  static byte SUBADRx_Register(byte i) {
229  if (i>3) {TLC59116Dev(F("SUBADRx out of range")); TLC59116Dev();}
230  return SUBADR1_Register - 1 + i;
231  }
232  // SUBADR3_Register = 0x1A; // FIXME: a _max, a list?
233  static const byte AllCall_Addr_Register = 0x1B;
234  static const byte IREF_Register = 0x1C;
235  static const byte IREF_CM_mask = 1<<7;
236  static const byte IREF_HC_mask = 1<<6;
237  static const byte IREF_CC_mask = 0b111111; // 6 bits
238  static const int Rext_Min = 156; // in ohms, gives 120ma at reset
239  static byte best_iref(byte ma, int Rext=Rext_Min); // from milliamps. 937 for 20ma.
240  static byte i_out(byte CM, byte HC, byte CC, int Rext=Rext_Min); // milliamps for register setting
241  static byte i_out(byte iref_value, int Rext=Rext_Min) {
242  return i_out( iref_value >> 7 & 1, iref_value >> 6 & 1, iref_value & IREF_CC_mask, Rext );
243  }
244  static byte i_out_d(byte CM, byte HC, byte D, int Rext=Rext_Min); // D=CC with bits reversed
245  static const byte EFLAG1_Register = 0x1D;
246  static const byte EFLAG2_Register = EFLAG1_Register + 1;
247  static const byte Control_Register_Max = 0x1E; // NB, no 0x1F !
248  static bool is_control_register(byte register_num) {
249  return (register_num >= Control_Register_Min && register_num <= Control_Register_Max);
250  }
251 
252  static const char* Device; // holds "TLC59116" for convenience for debug messages
253 
254  public: // class
255 
256  // utility
257  static byte normalize_address(byte address) { // return a Wire i2c address (7bit)
258  if (address <= (Max_Addr - Base_Addr)) // 0..15
259  return Base_Addr+address;
260  else if (address >= Base_Addr && address <= Max_Addr) // Wire's I2C address: 0x60...
261  return address;
262  else if (address >= (Base_Addr<<1) && address <= (Max_Addr<<1)) // I2C protocol address: 0x60<<1
263  return address >> 1;
264  else
265  return 0; // Not
266  }
267  static byte set_with_mask(byte was, byte mask, byte new_bits) { // only set the bits marked by mask
268  byte to_change = mask & new_bits; // sanity
269  byte unchanged = ~mask & was; // the bits of interest are 0 here
270  byte new_value = unchanged | to_change;
271  return new_value;
272  }
273  static void set_with_mask(byte *was, byte mask, byte new_bits) { *was = set_with_mask(*was, mask, new_bits); }
274 
275  static void describe_registers(byte* registers /*[Control_Register_Max]*/);
276 
277  static byte inline reverse_cc(byte CC) { // CC<->D (reverse 6 bits)
278  // CC<->D (reverse 6 bits)
279  byte D=0;
280  for(byte i=0;i<6;i++) D |= ((CC>>i) & 0b1)<<(5-i);
281  return D;
282  }
283 
284  public: // instance
285  TwoWire& i2cbus; // r/o
286 
287  // fixme: move up
288  // Constructors (plus ::Each, ::Broadcast)
289  // NB: The initial state is "outputs off"
290  TLC59116_Unmanaged(TwoWire &bus, byte address) : i2cbus(bus), i2c_address(address) {}
291  TLC59116_Unmanaged(const TLC59116_Unmanaged&); // none
293  ~TLC59116_Unmanaged() {} // managed destructor....
294 
295  byte fetch_registers(byte start_r, byte count, byte registers[]); // returns 0 for success, I2C status otherwise
297  static void describe_group_mode(byte* registers); // for debugging
298 
299  // FIXME: implement error bits (reset, read).
300 
301  /// \name Info Functions
302  ///@{
303  byte address() { return i2c_address; }
304  ///@}
305 
306  // Low Level interface: writes bash the whole register
307  byte control_register(byte register_num); // get. Failure returns 0, set TLC59116_WARNINGS=1 and check monitor
308  void control_register(byte register_num, byte data); // set
309  void control_register(byte count, const byte *register_num, const byte data[]); // set a bunch FIXME not using...
310  void get_control_registers(byte count, const byte *register_num, byte data[]); // get a bunch (more efficient)
311 
312  void _begin_trans(byte register_num) { TLC59116_Unmanaged::_begin_trans(i2cbus,address(),register_num); }
313  void _begin_trans(byte auto_mode, byte register_num) {
314  TLC59116_Unmanaged::_begin_trans(i2cbus, address(), auto_mode, register_num);
315  }
316 
317  static void _begin_trans(TwoWire& bus, byte addr, byte register_num) {
318  TLC59116LowLevel(F("send R "));TLC59116LowLevel(register_num & 0x1f,HEX);TLC59116LowLevel(F("/"));TLC59116LowLevel((register_num & (byte)0xe0 >> 5),BIN);TLC59116LowLevel(F(" to "));TLC59116LowLevel(addr,HEX);TLC59116LowLevel(F(" on bus "));TLC59116LowLevel((unsigned long)&bus, HEX);TLC59116LowLevel();
319  bus.beginTransmission(addr);
320  bus.write(register_num);
321  TLC59116LowLevel(F(" begin data..."));TLC59116LowLevel();
322  }
323  static void _begin_trans(TwoWire& bus, byte addr, byte auto_mode, byte register_num) { // with auto-mode
324  _begin_trans(bus, addr, auto_mode ^ register_num);
325  }
326 
328 
329  static int _end_trans(TwoWire &bus) {
330  TLC59116LowLevel(F("end_transmission..."));TLC59116LowLevel();
331  int stat = bus.endTransmission();
332 
333  if (stat != 0) {
334  TLC59116Warn(F("endTransmission error, = "));TLC59116Warn(stat);TLC59116Warn();
335  }
337  return stat;
338  }
339 
340  byte shadow_registers[Control_Register_Max + 1]; // FIXME: dumping them, maybe a method?
341 
342  private:
343  TLC59116_Unmanaged(); // not allowed
344 
345 
346  // our identity is the bus address (w/in a bus)
347  // Addresses are 7 bits (lsb missing)
348  byte i2c_address;
349 
350  static void describe_iref(byte* registers);
351  static void describe_addresses(byte* registers);
352  static void describe_mode2(byte *registers);
353  static void describe_outputs(byte* registers);
354  static void describe_error_flag(byte* registers);
355 
356  void update_ledx_registers(byte addr, byte to_what, byte led_start_i, byte led_end_i);
357  void update_ledx_registers(byte addr, const byte* want_ledx /* [4] */, byte led_start_i, byte led_end_i);
358  void update_ledx_registers(byte addr, byte to_what, word bit_pattern);
359 
360  public:
361  class Scan {
362  public:
363 
364  // We only want one scanner
365  static Scan& scanner() {static Scan instance; return instance;} // singleton. didn't bother with clone & =
366  Scan& print();
367 
368  bool is_any() { return found > 0; }
369  byte count() { return found; }
370  const byte* device_addresses() { return addresses; } // FIXME: I want the contents to be const
371  byte first_addr() { // debug message and 0xff if none
372  // return a good address or fall through
373  for(byte i=0; i<found; i++) {
374  if (is_default_single_addr(addresses[i])) return addresses[i];
375  }
376 
377  TLC59116Warn(F("Error: There is no first address for a "));TLC59116Warn(Device);TLC59116Warn();
378 
379  return 0xff;
380  }
381  bool is_AllCall_default(); // is something at the default AllCall_Addr?
382 
383  // Find all the TLC59116 addresses, including broadcast(s)
384  // If group-addresses are turned on, we might get collisions and count them as bad.
385  // You should call TLC59116.reset() first (as appropriate),
386  // Otherwise, this reads the current state.
387  // Scan::scanner.print() is useful with this.
388  Scan& rescan(); // FIXME: not defined, steal back from TLC59116?
389 
390  private:
391  Scan() {
392  this->rescan();
393  }
394 
395  byte found; // number of addresses found
396  byte addresses[Max_Addr - Base_Addr - 2]; // reset/all are excluded, so only 16 possible
397  };
398 
399  static Scan& scan(void) { // convenience, same as TLC59116_Unmanaged::Scan::scanner();
400  return Scan::scanner();
401  };
402 
403  class Broadcast { // FIXME: unused?
404  byte dumy;
405  };
406 
407 };
408 
409 
410 #endif
static const byte MODE2_EFCLR
Definition: TLC59116_Unmanaged.h:185
static const byte LEDOUT_PWM
Definition: TLC59116_Unmanaged.h:194
static const byte Auto_PWM_GRP
Definition: TLC59116_Unmanaged.h:171
static byte SUBADRx_Register(byte i)
Definition: TLC59116_Unmanaged.h:228
static const byte MODE1_OSC_mask
Definition: TLC59116_Unmanaged.h:176
static byte LEDx_digital_on_bits(byte led_num)
Definition: TLC59116_Unmanaged.h:225
static const byte IREF_Register
Definition: TLC59116_Unmanaged.h:234
static void _begin_trans(TwoWire &bus, byte addr, byte register_num)
Definition: TLC59116_Unmanaged.h:317
static bool is_device_range_addr(byte address)
Definition: TLC59116_Unmanaged.h:155
static const byte Max_Addr
Definition: TLC59116_Unmanaged.h:154
static const byte MODE1_ALLCALL_mask
Definition: TLC59116_Unmanaged.h:182
void TLC59116Warn(const T msg, int format=0)
Definition: TLC59116_Unmanaged.h:105
static const byte Base_Addr
Definition: TLC59116_Unmanaged.h:144
static const byte LEDOUT_DigitalOff
Definition: TLC59116_Unmanaged.h:197
static const byte EFLAG1_Register
Definition: TLC59116_Unmanaged.h:245
static const byte IREF_CC_mask
Definition: TLC59116_Unmanaged.h:237
static const byte LEDOUT0_Register
Definition: TLC59116_Unmanaged.h:191
static byte LEDx_pwm_bits(byte led_num)
Definition: TLC59116_Unmanaged.h:222
TLC59116_Unmanaged & describe_actual()
Definition: TLC59116_Unmanaged.cpp:83
TLC59116_Unmanaged & operator=(const TLC59116_Unmanaged &)
static const byte MODE2_DMBLNK
Definition: TLC59116_Unmanaged.h:184
static const byte MODE1_SUB2_mask
Definition: TLC59116_Unmanaged.h:179
bool is_any()
Definition: TLC59116_Unmanaged.h:368
static const byte IREF_HC_mask
Definition: TLC59116_Unmanaged.h:236
static const byte LEDOUT_Mask
Definition: TLC59116_Unmanaged.h:193
void _begin_trans(byte register_num)
Definition: TLC59116_Unmanaged.h:312
void _begin_trans(byte auto_mode, byte register_num)
Definition: TLC59116_Unmanaged.h:313
static const byte MODE2_Register
Definition: TLC59116_Unmanaged.h:183
static byte PWMx_Register(byte led_num)
Definition: TLC59116_Unmanaged.h:188
static const byte SUBADR1
Definition: TLC59116_Unmanaged.h:147
byte shadow_registers[Control_Register_Max+1]
Definition: TLC59116_Unmanaged.h:340
static const byte Control_Register_Max
Definition: TLC59116_Unmanaged.h:247
byte fetch_registers(byte start_r, byte count, byte registers[])
Definition: TLC59116_Unmanaged.cpp:58
byte first_addr()
Definition: TLC59116_Unmanaged.h:371
static byte normalize_address(byte address)
Definition: TLC59116_Unmanaged.h:257
static void _begin_trans(TwoWire &bus, byte addr, byte auto_mode, byte register_num)
Definition: TLC59116_Unmanaged.h:323
static byte set_with_mask(byte was, byte mask, byte new_bits)
Definition: TLC59116_Unmanaged.h:267
static const byte Channels
Definition: TLC59116_Unmanaged.h:139
static const byte MODE1_Register
Definition: TLC59116_Unmanaged.h:175
static const byte MODE1_SUB3_mask
Definition: TLC59116_Unmanaged.h:180
const byte * device_addresses()
Definition: TLC59116_Unmanaged.h:370
static byte LEDx_gpwm_bits(byte led_num)
Definition: TLC59116_Unmanaged.h:223
static const char * Device
Definition: TLC59116_Unmanaged.h:252
static const byte Reset_Addr
Definition: TLC59116_Unmanaged.h:149
static const byte GRPFREQ_Register
Definition: TLC59116_Unmanaged.h:190
static byte LEDx_Register_bits(byte led_num, byte register_value)
Definition: TLC59116_Unmanaged.h:211
static const byte IREF_CM_mask
Definition: TLC59116_Unmanaged.h:235
static const byte SUBADR3
Definition: TLC59116_Unmanaged.h:152
void TLC59116Dev(const T msg)
Definition: TLC59116_Unmanaged.h:114
static void describe_registers(byte *registers)
Definition: TLC59116_Unmanaged.cpp:98
static void set_with_mask(byte *was, byte mask, byte new_bits)
Definition: TLC59116_Unmanaged.h:273
static const byte GRPPWM_Register
Definition: TLC59116_Unmanaged.h:189
static const byte LEDOUT_GRPPWM
Definition: TLC59116_Unmanaged.h:195
TwoWire Wire
static Scan & scanner()
Definition: TLC59116_Unmanaged.h:365
static const byte PWM0_Register
Definition: TLC59116_Unmanaged.h:187
static void describe_group_mode(byte *registers)
Definition: TLC59116_Unmanaged.cpp:228
static const int Rext_Min
Definition: TLC59116_Unmanaged.h:238
Definition: TLC59116_Unmanaged.h:133
static byte best_iref(byte ma, int Rext=Rext_Min)
Definition: TLC59116_Unmanaged.cpp:156
static const byte AllCall_Addr_Register
Definition: TLC59116_Unmanaged.h:233
static const byte MODE1_SUB1_mask
Definition: TLC59116_Unmanaged.h:178
static const byte EFLAG2_Register
Definition: TLC59116_Unmanaged.h:246
static const byte LEDOUT_DigitalOn
Definition: TLC59116_Unmanaged.h:196
Definition: TLC59116_Unmanaged.h:403
static byte LEDx_to_Register_bits(byte led_num, byte out_mode)
Definition: TLC59116_Unmanaged.h:215
void TLC59116LowLevel(T msg)
Definition: TLC59116_Unmanaged.h:124
int _end_trans()
Definition: TLC59116_Unmanaged.h:327
TwoWire & i2cbus
Definition: TLC59116_Unmanaged.h:285
static bool is_default_SUBADR(byte address)
Definition: TLC59116_Unmanaged.h:158
static byte LEDx_Register_mask(byte led_num)
Definition: TLC59116_Unmanaged.h:207
bool is_SUBADR_bit(byte mode1_value, byte which)
Definition: TLC59116_Unmanaged.h:181
void get_control_registers(byte count, const byte *register_num, byte data[])
TLC59116_Unmanaged(TwoWire &bus, byte address)
Definition: TLC59116_Unmanaged.h:290
static void LEDOUTx_CHECK(int line, byte led_num)
Definition: TLC59116_Unmanaged.h:200
static const byte AllCall_Addr
Definition: TLC59116_Unmanaged.h:146
~TLC59116_Unmanaged()
Definition: TLC59116_Unmanaged.h:293
static byte i_out_d(byte CM, byte HC, byte D, int Rext=Rext_Min)
Definition: TLC59116_Unmanaged.cpp:151
static const byte LEDOUTx_Max
Definition: TLC59116_Unmanaged.h:192
static byte LEDx_set_mode(byte was, byte led_num, byte mode)
Definition: TLC59116_Unmanaged.h:216
static byte LEDOUTx_Register(byte led_num)
Definition: TLC59116_Unmanaged.h:198
Definition: TLC59116_Unmanaged.h:361
byte address()
Definition: TLC59116_Unmanaged.h:303
static const byte SUBADR2
Definition: TLC59116_Unmanaged.h:148
static const byte Auto_All
Definition: TLC59116_Unmanaged.h:168
static bool is_control_register(byte register_num)
Definition: TLC59116_Unmanaged.h:248
bool is_OSC_bit(byte mode1_value)
Definition: TLC59116_Unmanaged.h:177
static const byte MODE2_OCH
Definition: TLC59116_Unmanaged.h:186
static bool is_default_single_addr(byte address)
Definition: TLC59116_Unmanaged.h:161
static const byte Auto_PWM
Definition: TLC59116_Unmanaged.h:169
static byte i_out(byte CM, byte HC, byte CC, int Rext=Rext_Min)
Definition: TLC59116_Unmanaged.cpp:145
static const byte Auto_GRP
Definition: TLC59116_Unmanaged.h:170
byte control_register(byte register_num)
static const byte SUBADR1_Register
Definition: TLC59116_Unmanaged.h:227
static byte is_valid_led(byte v)
Definition: TLC59116_Unmanaged.h:199
static byte reverse_cc(byte CC)
Definition: TLC59116_Unmanaged.h:277
static const byte Control_Register_Min
Definition: TLC59116_Unmanaged.h:174
static int _end_trans(TwoWire &bus)
Definition: TLC59116_Unmanaged.h:329
static byte LEDx_digital_off_bits(byte led_num)
Definition: TLC59116_Unmanaged.h:224
static Scan & scan(void)
Definition: TLC59116_Unmanaged.h:399
byte count()
Definition: TLC59116_Unmanaged.h:369
static const word Reset_Bytes
Definition: TLC59116_Unmanaged.h:151
static byte i_out(byte iref_value, int Rext=Rext_Min)
Definition: TLC59116_Unmanaged.h:241