Advertisement
Guest User

Untitled

a guest
May 24th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. int transferData(int fd, SPI_conf* sc, uint8_t *tx, uint8_t *rx, size_t size)
  2. {
  3. int ret;
  4. int loop;
  5.  
  6. struct spi_ioc_transfer tr = {
  7. .tx_buf = (unsigned long)tx,
  8. .rx_buf = (unsigned long)rx,
  9. .len = size,
  10. .delay_usecs = sc->delay,
  11. .speed_hz = sc->speed,
  12. .bits_per_word = sc->bits,
  13. };
  14.  
  15. ret = write(fd, SPI_IOC_MESSAGE(1), sizeof(uint8_t));
  16. if (ret < 1)
  17. pabort("\nCan't send SPI message");
  18.  
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement