Skip to content

Commit

Permalink
[Fix] always return -1
Browse files Browse the repository at this point in the history
  • Loading branch information
CoorFun committed Jan 2, 2019
1 parent 8e0db03 commit d0f2014
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cAPA102.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int cAPA102_Init(uint32_t led_num, uint8_t spi_bus, uint8_t spi_dev, uint8_t bri
cAPA012_BUF.brightness = 0xE0 | (0x1F & brightness);
cAPA012_BUF.pixels = (uint8_t *)malloc(cAPA012_BUF.number * 4);
cAPA012_BUF.fd_spi = cAPA102_Try_Open_SPI_Dev(RETRY_TIMES, RETRY_GAP_SEC, spi_bus, spi_dev);
if (cAPA012_BUF.fd_spi)
if ( -1 == cAPA012_BUF.fd_spi )
return -1;
cAPA102_Clear_All();
return 0;
Expand Down Expand Up @@ -189,4 +189,4 @@ static int cAPA102_Open_SPI_Dev(uint8_t spi_bus, uint8_t spi_dev){
ioctl(fd_temp, SPI_IOC_WR_MODE, SPI_MODE_0 | SPI_NO_CS);
ioctl(fd_temp, SPI_IOC_WR_MAX_SPEED_HZ, BITRATE);
return fd_temp;
}
}

0 comments on commit d0f2014

Please sign in to comment.