» Advertenties

Zo 20 Mei 2012, 07:53

C code -
  1. //*****************************************************************************
  2. //
  3. // File Name : spi.h
  4. // Title : Basic functions for hardware SPI
  5. // Author : Smoerijf.be (Orinal by Pascal Stang - edit by smoerijf)
  6. // Target MCU : Atmel AVR Series
  7. //
  8. //*****************************************************************************
  9.  
  10.  
  11. #ifndef SPI_H
  12. #define SPI_H
  13.  
  14. // function prototypes
  15.  
  16. // SPI interface initializer
  17. void spiInit(void);
  18. void spiDisable(void);
  19. void spiEnable(void); ///< automaticly done by spiInit();
  20. void spiSlow(void);
  21.  
  22. // spiSend(u08 data) waits until the SPI interface is ready
  23. // and then sends a single byte over the SPI port. This command
  24. // does not receive anything.
  25. void spiSend(u08 data);
  26.  
  27. // spiTransferByte(u08 data) waits until the SPI interface is ready
  28. // and then sends a single byte over the SPI port. The function also
  29. // returns the byte that was received during transmission.
  30. u08 spiTransfer(u08 data);
  31.  
  32. //void spiSetBitrate(u08 spr);
  33. /*
  34. void setMaster(void);
  35. void setSlave(void);
  36. */
  37.  
  38. #endif
Laatste wijziging: Di 22 September 2009, 17:04