Skip to content

Commit

Permalink
add missing memory allocation for SPI mode (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
bromor authored and jgarff committed Oct 8, 2017
1 parent 2db7cc4 commit f87db3d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ws2811.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,16 @@ static ws2811_return_t spi_init(ws2811_t *ws2811)
{
channel->strip_type=WS2811_STRIP_RGB;
}

// Set default uncorrected gamma table
if (!channel->gamma)
{
channel->gamma = malloc(sizeof(uint8_t) * 256);
int x;
for(x = 0; x < 256; x++){
channel->gamma[x] = x;
}
}

channel->wshift = (channel->strip_type >> 24) & 0xff;
channel->rshift = (channel->strip_type >> 16) & 0xff;
Expand Down

0 comments on commit f87db3d

Please sign in to comment.