Merge 213778278b into a4230afbf4
This commit is contained in:
commit
5b58da9c1a
|
|
@ -46,32 +46,32 @@ int luckfox_spi_init(char *dev, uint32_t mode, uint8_t bits, uint32_t speed)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set SPI mode
|
// Set SPI mode
|
||||||
ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
|
|
||||||
if (ret == -1)
|
|
||||||
{
|
|
||||||
printf("SPI_IOC_RD_MODE error......\n ");
|
|
||||||
goto fd_close;
|
|
||||||
}
|
|
||||||
ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
|
ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
printf("SPI_IOC_WR_MODE error......\n ");
|
printf("SPI_IOC_WR_MODE error......\n ");
|
||||||
goto fd_close;
|
goto fd_close;
|
||||||
}
|
}
|
||||||
|
ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
|
||||||
// Set the length of SPI communication
|
|
||||||
ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
printf("SPI_IOC_RD_BITS_PER_WORD error......\n ");
|
printf("SPI_IOC_RD_MODE error......\n ");
|
||||||
goto fd_close;
|
goto fd_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the length of SPI communication
|
||||||
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
|
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
printf("SPI_IOC_WR_BITS_PER_WORD error......\n ");
|
printf("SPI_IOC_WR_BITS_PER_WORD error......\n ");
|
||||||
goto fd_close;
|
goto fd_close;
|
||||||
}
|
}
|
||||||
|
ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
|
||||||
|
if (ret == -1)
|
||||||
|
{
|
||||||
|
printf("SPI_IOC_RD_BITS_PER_WORD error......\n ");
|
||||||
|
goto fd_close;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the maximum working frequency of SPI
|
// Set the maximum working frequency of SPI
|
||||||
ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
|
ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user