You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
724 B

8 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __SPI_PORT_HEADER__
  2. #define __SPI_PORT_HEADER__
  3. #include "../../data/transport/transportBus.h"
  4. #include <getopt.h>
  5. #include <fcntl.h>
  6. #include <sys/ioctl.h>
  7. #include <linux/types.h>
  8. #include <linux/spi/spidev.h>
  9. typedef enum E_SPI_MODES{
  10. SPI_ADDR_8 = 0,
  11. SPI_ADDR_16 = 1
  12. } SPI_MODE;
  13. class spiPort: public transportBus {
  14. private:
  15. bool m_bConnected;
  16. bool m_bInitComplete;
  17. CSTR m_pDevicePath;
  18. int m_ioFID;
  19. uint32_t m_nLineSpeed;
  20. struct spi_ioc_transfer xfer[2];
  21. bool HW_init( CSTR Path, uint32_t Speed );
  22. public:
  23. spiPort();
  24. spiPort( CSTR DevicePath, int Speed );
  25. virtual ~spiPort();
  26. bool setMode( SPI_MODE val );
  27. };
  28. #endif