sx1276_api.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef __SX1276_API_H__
  2. #define __SX1276_API_H__
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. #include "queue.h"
  6. #define SX1276_API_DEBUG_EN 1
  7. #ifdef SX1276_API_DEBUG_EN
  8. #include <stdio.h>
  9. #define SX1276_API_DEBUG(fmt, x...) \
  10. do \
  11. { \
  12. printf(fmt,##x); \
  13. }while(0)
  14. #define SX1276_API_DEBUG_H(fmt, x...) \
  15. do \
  16. { \
  17. USART_printfHex(fmt,##x); \
  18. }while(0)
  19. #define SX1276_API_DEBUG_F(fmt, x...) \
  20. do \
  21. { \
  22. printf("%s %s(Line %d): "fmt,__FILE__,__FUNCTION__,__LINE__, ##x); \
  23. }while(0)
  24. #else
  25. #define SX1276_API_DEBUG(fmt, x...)
  26. #define SX1276_API_DEBUG1(fmt, x...)
  27. #define SX1276_API_DEBUG_F(fmt, x...)
  28. #endif
  29. #define LoRa_SendTimeOut 60*1000
  30. extern uint32_t LoRa_SendTimeCouter;
  31. uint8_t SX1276_Send_Data(uint8_t * buffer,uint16_t bufferLen );
  32. int16_t SX1276_Read_Data( void *Buffer ,uint32_t Timeout, int8_t *snr,double *rssi );
  33. uint8_t SX1276_Send_Data_Listen_Ch(uint8_t * buffer,uint16_t bufferLen,uint32_t ldelay_ms,uint8_t num);
  34. bool SX1276IsLoraChannelFree( int16_t rssiThresh );
  35. double SX1276_Ambience_Rssi(void);
  36. void SX1276_Sleep(void);
  37. uint8_t SX1276_Cad_Listen(void);
  38. uint16_t SX1276_CAD_Task( void *Buffer ,uint32_t Timeout,int8_t *snr,int16_t *rssi );
  39. void SX1276_Read_Data_Sp(uint32_t Timeout );
  40. void SX1276_CAD_Start( void );
  41. void SX1276_Send_Data_Sp(uint8_t * buffer,uint16_t bufferLen );
  42. extern sequeue_t *lora_tx_sq;
  43. extern sequeue_t *lora_rx_sq;
  44. #endif // __RADIO_H__