bk1080-regs.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright 2023 Dual Tachyon
  2. * https://github.com/DualTachyon
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef BK1080_REGS_H
  17. #define BK1080_REGS_H
  18. enum BK1080_Register_t {
  19. BK1080_REG_00 = 0x00U,
  20. BK1080_REG_02_POWER_CONFIGURATION = 0x02U,
  21. BK1080_REG_03_CHANNEL = 0x03U,
  22. BK1080_REG_04_SYSTEM_CONFIGURATION1 = 0x04U,
  23. BK1080_REG_05_SYSTEM_CONFIGURATION2 = 0x05U,
  24. BK1080_REG_07 = 0x07U,
  25. BK1080_REG_10 = 0x0AU,
  26. BK1080_REG_25_INTERNAL = 0x19U,
  27. };
  28. typedef enum BK1080_Register_t BK1080_Register_t;
  29. // REG 07
  30. #define BK1080_REG_07_SHIFT_FREQD 4
  31. #define BK1080_REG_07_SHIFT_SNR 0
  32. #define BK1080_REG_07_MASK_FREQD (0xFFFU << BK1080_REG_07_SHIFT_FREQD)
  33. #define BK1080_REG_07_MASK_SNR (0x00FU << BK1080_REG_07_SHIFT_SNR)
  34. #define BK1080_REG_07_GET_FREQD(x) (((x) & BK1080_REG_07_MASK_FREQD) >> BK1080_REG_07_SHIFT_FREQD)
  35. #define BK1080_REG_07_GET_SNR(x) (((x) & BK1080_REG_07_MASK_SNR) >> BK1080_REG_07_SHIFT_SNR)
  36. // REG 10
  37. #define BK1080_REG_10_SHIFT_AFCRL 12
  38. #define BK1080_REG_10_SHIFT_RSSI 0
  39. #define BK1080_REG_10_MASK_AFCRL (0x01U << BK1080_REG_10_SHIFT_AFCRL)
  40. #define BK1080_REG_10_MASK_RSSI (0xFFU << BK1080_REG_10_SHIFT_RSSI)
  41. #define BK1080_REG_10_AFCRL_NOT_RAILED (0U << BK1080_REG_10_SHIFT_AFCRL)
  42. #define BK1080_REG_10_AFCRL_RAILED (1U << BK1080_REG_10_SHIFT_AFCRL)
  43. #define BK1080_REG_10_GET_RSSI(x) (((x) & BK1080_REG_10_MASK_RSSI) >> BK1080_REG_10_SHIFT_RSSI)
  44. #endif