Skip to content

Instantly share code, notes, and snippets.

@electronut
Created August 18, 2017 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electronut/c1899c5617b60eb63453b022c484d1ce to your computer and use it in GitHub Desktop.
Save electronut/c1899c5617b60eb63453b022c484d1ce to your computer and use it in GitHub Desktop.
set led data
void set_led_data()
{
for(int i = 0; i < 3*NLEDS; i += 3) {
if (i == 3*nled) {
switch(g_demo_mode)
{
case 0:
{
m_buffer_tx[i] = 0x88888888;
m_buffer_tx[i+1] = caclChannelValue(128);
m_buffer_tx[i+2] = 0x88888888;
}
break;
case 1:
{
m_buffer_tx[i] = caclChannelValue(128);;
m_buffer_tx[i+1] = 0x88888888;
m_buffer_tx[i+2] = 0x88888888;
}
break;
case 2:
{
m_buffer_tx[i] = 0x88888888;
m_buffer_tx[i+1] = 0x88888888;
m_buffer_tx[i+2] = caclChannelValue(128);
}
break;
default:
break;
}
}
else {
m_buffer_tx[i] = 0x88888888;
m_buffer_tx[i+1] = 0x88888888;
m_buffer_tx[i+2] = 0x88888888;
}
}
// reset
for(int i = 3*NLEDS; i < I2S_BUFFER_SIZE; i++) {
m_buffer_tx[i] = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment