git-svn-id: svn://db.shs.com.ru/pip@574 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -38,7 +38,7 @@ bool PISPI::openDevice() {
|
||||
#ifndef WINDOWS
|
||||
int ret = 0;
|
||||
piCoutObj << "open device" << path();
|
||||
PRIVATE->fd = ::open(path().dataAscii(), O_RDWR);
|
||||
/* PRIVATE->fd = ::open(path().dataAscii(), O_RDWR);
|
||||
if (PRIVATE->fd < 0) {piCoutObj << "can't open device";return false;}
|
||||
piCoutObj << "set mode" << spi_mode;
|
||||
ret = ioctl(PRIVATE->fd, SPI_IOC_WR_MODE, &spi_mode);
|
||||
@@ -52,7 +52,7 @@ bool PISPI::openDevice() {
|
||||
piCoutObj << "SPI open" << path() << "speed:" << spi_speed/1000 << "KHz" << "mode" << spi_mode << "bits" << spi_bits;
|
||||
PRIVATE->spi_ioc_tr.delay_usecs = 0;
|
||||
PRIVATE->spi_ioc_tr.speed_hz = 0;
|
||||
PRIVATE->spi_ioc_tr.bits_per_word = spi_bits;
|
||||
PRIVATE->spi_ioc_tr.bits_per_word = spi_bits;*/
|
||||
return true;
|
||||
#else
|
||||
piCoutObj << "PISPI not implemented on windows";
|
||||
@@ -90,8 +90,8 @@ int PISPI::writeDevice(const void * data, int max_size) {
|
||||
memcpy(tx_buf.data(), data, max_size);
|
||||
int ret;
|
||||
piCoutObj << "write" << max_size << tx_buf.size();
|
||||
ret = ioctl(PRIVATE->fd, SPI_IOC_MESSAGE(1), &PRIVATE->spi_ioc_tr);
|
||||
if (ret < 1) {piCoutObj << "can't send spi message" << ret; return -1;}
|
||||
*/ret = ioctl(PRIVATE->fd, SPI_IOC_MESSAGE(1), &PRIVATE->spi_ioc_tr);
|
||||
if (ret < 1) {piCoutObj << "can't send spi message" << ret; return -1;}*/
|
||||
recv_buf.append(rx_buf);
|
||||
if (recv_buf.size_s() > threadedReadBufferSize()) recv_buf.resize(threadedReadBufferSize());
|
||||
return max_size;
|
||||
|
||||
Reference in New Issue
Block a user