Bugfixes part 3 #209

Open
andrey wants to merge 36 commits from bugfixes3 into master
Showing only changes of commit c8ad8ecaf4 - Show all commits
+6
View File
@@ -106,18 +106,24 @@ bool PISPI::openDevice() {
ret = ioctl(PRIVATE->fd, SPI_IOC_WR_MODE, &spi_mode);
if (ret == -1) {
piCoutObj << "can't set spi write mode";
::close(PRIVATE->fd);
PRIVATE->fd = -1;
return false;
}
// piCoutObj << "set bits" << spi_bits;
ret = ioctl(PRIVATE->fd, SPI_IOC_WR_BITS_PER_WORD, &spi_bits);
if (ret == -1) {
piCoutObj << "can't set bits per word";
::close(PRIVATE->fd);
PRIVATE->fd = -1;
return false;
}
// piCoutObj << "set speed" << spi_speed;
ret = ioctl(PRIVATE->fd, SPI_IOC_WR_MAX_SPEED_HZ, &spi_speed);
if (ret == -1) {
piCoutObj << "can't set max write speed hz";
::close(PRIVATE->fd);
PRIVATE->fd = -1;
return false;
}
piCoutObj << "SPI open" << path() << "speed:" << spi_speed / 1000 << "KHz"