cmt2300.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * THE FOLLOWING FIRMWARE IS PROVIDED: (1) "AS IS" WITH NO WARRANTY; AND
  3. * (2)TO ENABLE ACCESS TO CODING INFORMATION TO GUIDE AND FACILITATE CUSTOMER.
  4. * CONSEQUENTLY, CMOSTEK SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR
  5. * CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
  6. * OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
  7. * CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  8. *
  9. * Copyright (C) CMOSTEK SZ.
  10. */
  11. /*!
  12. * @file cmt2300.h
  13. * @brief CMT2300 transceiver RF chip driver
  14. *
  15. * @version 1.2
  16. * @date Feb 08 2017
  17. * @author CMOSTEK R@D
  18. */
  19. #ifndef __CMT2300_H
  20. #define __CMT2300_H
  21. #include <stdint.h>
  22. #include <stdbool.h>
  23. #include "cmt2300_defs.h"
  24. #include "cmt2300_hal.h"
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. #define ENABLE_WAIT_CHIP_STATUS /* Enable the wait when switch chip status */
  29. /* ************************************************************************
  30. The following are for chip status controls.
  31. * ************************************************************************ */
  32. void Cmt2300_SoftReset(void);
  33. uint8_t Cmt2300_GetChipStatus(void);
  34. bool Cmt2300_WaitChipStatus(uint8_t nStatus);
  35. bool Cmt2300_GoSleep(void);
  36. bool Cmt2300_GoStby(void);
  37. bool Cmt2300_GoTFS(void);
  38. bool Cmt2300_GoRFS(void);
  39. bool Cmt2300_GoTx(void);
  40. bool Cmt2300_GoRx(void);
  41. /* ************************************************************************
  42. * The following are for chip interrupts, GPIO, FIFO operations.
  43. * ************************************************************************ */
  44. void Cmt2300_ConfigGpio(uint8_t nGpioSel);
  45. void Cmt2300_ConfigInterrupt(uint8_t nInt1Sel, uint8_t nInt2Sel);
  46. void Cmt2300_SetInterruptPolar(bool bActiveHigh);
  47. void Cmt2300_SetFifoThreshold(uint8_t nFifoThreshold);
  48. void Cmt2300_EnableAntennaSwitch(uint8_t nMode);
  49. void Cmt2300_EnableInterrupt(uint8_t nEnable);
  50. void Cmt2300_EnableRxFifoAutoClear(bool bEnable);
  51. void Cmt2300_EnableFifoMerge(bool bEnable);
  52. void Cmt2300_EnableReadFifo(void);
  53. void Cmt2300_EnableWriteFifo(void);
  54. void Cmt2300_RestoreFifo(void);
  55. uint8_t Cmt2300_ClearFifo(void);
  56. uint8_t Cmt2300_ClearInterruptFlags(void);
  57. /* ************************************************************************
  58. * The following are for Tx DIN operations in direct mode.
  59. * ************************************************************************ */
  60. void Cmt2300_ConfigTxDin(uint8_t nDinSel);
  61. void Cmt2300_EnableTxDin(bool bEnable);
  62. void Cmt2300_EnableTxDinInvert(bool bEnable);
  63. /* ************************************************************************
  64. * The following are general operations.
  65. * ************************************************************************ */
  66. bool Cmt2300_IsExist(void);
  67. uint8_t Cmt2300_GetRssiCode(void);
  68. int Cmt2300_GetRssiDBm(void);
  69. void Cmt2300_SetFrequencyChannel(uint8_t nChann);
  70. void Cmt2300_SetFrequencyStep(uint8_t nOffset);
  71. void Cmt2300_SetPayloadLength(uint16_t nLength);
  72. void Cmt2300_EnableLfosc(bool bEnable);
  73. void Cmt2300_EnableLfoscOutput(bool bEnable);
  74. /* ************************************************************************
  75. * The following are for chip initializes.
  76. * ************************************************************************ */
  77. void Cmt2300_Init(void);
  78. bool Cmt2300_ConfigRegBank(uint8_t base_addr, const uint8_t bank[], uint8_t len);
  79. void Cmt2300_SetCrcSeed(uint16_t seed);
  80. void Cmt2300_SetCrc(void);
  81. void Cmt2300_SetPacketType(bool type);
  82. uint16_t Cmt2300_GetPacketLen(void);
  83. void Cmt2300_SetRssiDetMode(uint8_t mode);
  84. void Cmt2300_SetGfskGsnBt(uint8_t bt);
  85. void Cmt2300_SetRfBandWidth(uint8_t bw);
  86. void Cmt2300_SetRxPreamLengSize(uint8_t unit, uint8_t size);
  87. void Cmt2300_SetSyncWord(uint8_t *value, uint8_t len);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif