user_spim.h 877 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef USER_SPIM_H__
  2. #define USER_SPIM_H__
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. #include "define.h"
  6. #include "nrf_drv_spi.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. //typedef void (*spim_xfer_func)(bool stat);
  11. typedef void (*spim_ss_func)(bool stat);
  12. typedef void (*spim_timeout_func)(void);
  13. typedef struct{
  14. // spim_xfer_func spim_xfer; //SPI传输完成标志
  15. spim_ss_func spim_ss; //spi片选
  16. spim_timeout_func spim_timeout;
  17. bool spim_xfer_done; //传输完成
  18. }user_spim_s;
  19. void spim1_init(void);
  20. void spim1_uinit(void);
  21. ret_code_t nrf_drv_spim1_transfer(uint8_t const * spi_tx_buf,uint8_t tx_len,uint8_t * spi_rx_buf,uint8_t rx_len);
  22. void set_ss_func(spim_ss_func ss_func);
  23. //void set_xfer_done_func(spim_xfer_func done);
  24. extern user_spim_s user_spim1_s;
  25. extern bool lock;
  26. #ifdef __cplusplus
  27. }
  28. #endif
  29. #endif // USER_SPIM_H__
  30. /** @} */