deca_spi.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*! ----------------------------------------------------------------------------
  2. * @file deca_spi.h
  3. * @brief SPI access functions
  4. *
  5. * @attention
  6. *
  7. * Copyright 2015 (c) DecaWave Ltd, Dublin, Ireland.
  8. *
  9. * All rights reserved.
  10. *
  11. * @author DecaWave
  12. */
  13. #ifndef _DECA_SPI_H_
  14. #define _DECA_SPI_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "deca_types.h"
  19. #define DECA_MAX_SPI_HEADER_LENGTH (3) // max number of bytes in header (for formating & sizing)
  20. #define EVB1000_LCD_SUPPORT (1)
  21. /*! ------------------------------------------------------------------------------------------------------------------
  22. * Function: openspi()
  23. *
  24. * Low level abstract function to open and initialise access to the SPI device.
  25. * returns 0 for success, or -1 for error
  26. */
  27. int openspi(void) ;
  28. /*! ------------------------------------------------------------------------------------------------------------------
  29. * Function: closespi()
  30. *
  31. * Low level abstract function to close the the SPI device.
  32. * returns 0 for success, or -1 for error
  33. */
  34. int closespi(void) ;
  35. #if (EVB1000_LCD_SUPPORT == 1)
  36. /*! ------------------------------------------------------------------------------------------------------------------
  37. * Function: writetoLCD()
  38. *
  39. * Low level abstract function to write data to the LCD display via SPI2 peripheral
  40. * Takes byte buffer and rs_enable signals
  41. * or returns -1 if there was an error
  42. */
  43. void writetoLCD
  44. (
  45. uint32_t bodylength,
  46. uint8_t rs_enable,
  47. const uint8_t *bodyBuffer
  48. );
  49. #else
  50. #define writetoLCD(x)
  51. #endif
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif /* _DECA_SPI_H_ */