mirror of
https://github.com/brmlab/ledbar.git
synced 2025-06-09 21:34:00 +02:00
autonomous: factor out setAllPinPWM() loop to ledbar.h:setbyc()
This commit is contained in:
parent
d5f7f7f52b
commit
3becad8fc3
2 changed files with 15 additions and 10 deletions
|
@ -152,16 +152,7 @@ void loop()
|
||||||
//grey(led);
|
//grey(led);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_TLCS; i++) {
|
setbyc(lb, c);
|
||||||
// XXX: We assume static allocation of channels to pins 0..14 (in order)
|
|
||||||
// TODO: Just use unsigned char for c[] ?
|
|
||||||
unsigned char dutycycles[16];
|
|
||||||
int *cblock = (int *) &c[i * LEDS_PER_TLC];
|
|
||||||
for (int j = 0; j < 16; j++) {
|
|
||||||
dutycycles[j] = cblock[j];
|
|
||||||
}
|
|
||||||
lb[i].setAllPinPWM(dutycycles);
|
|
||||||
}
|
|
||||||
|
|
||||||
delay(wait);
|
delay(wait);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,3 +135,17 @@ const int cmax[cpinsets][CH] = {
|
||||||
{ 100, 230, 188 },
|
{ 100, 230, 188 },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void setbyc(class Ledbar *lb, int (*c)[CH])
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NUM_TLCS; i++) {
|
||||||
|
// XXX: We assume static allocation of channels to pins 0..14 (in order)
|
||||||
|
// TODO: Just use unsigned char for c[] ?
|
||||||
|
unsigned char dutycycles[16];
|
||||||
|
int *cblock = (int *) &c[i * LEDS_PER_TLC];
|
||||||
|
for (int j = 0; j < 16; j++) {
|
||||||
|
dutycycles[j] = cblock[j];
|
||||||
|
}
|
||||||
|
lb[i].setAllPinPWM(dutycycles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue