spi
git-svn-id: svn://db.shs.com.ru/pip@566 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
31
src_main/io/pispi.h
Normal file
31
src_main/io/pispi.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef PISPI_H
|
||||
#define PISPI_H
|
||||
|
||||
#include "piiodevice.h"
|
||||
|
||||
|
||||
class PIP_EXPORT PISPI: public PIIODevice
|
||||
{
|
||||
PIIODEVICE(PISPI)
|
||||
public:
|
||||
explicit PISPI(const PIString & path = PIString(), uint speed_hz = 100000, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
|
||||
~PISPI() {}
|
||||
|
||||
void setSpeed(uint speed_hz);
|
||||
|
||||
protected:
|
||||
bool openDevice();
|
||||
bool closeDevice();
|
||||
int readDevice(void * read_to, int max_size);
|
||||
int writeDevice(const void * data, int max_size);
|
||||
|
||||
private:
|
||||
uint spi_speed;
|
||||
uchar spi_mode;
|
||||
uchar spi_bits;
|
||||
PIByteArray tx_buf, rx_buf;
|
||||
PIByteArray recv_buf;
|
||||
PRIVATE_DECLARATION
|
||||
};
|
||||
|
||||
#endif // PISPI_H
|
||||
Reference in New Issue
Block a user