furi_hal_region.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <stddef.h>
  5. typedef struct {
  6. uint32_t start;
  7. uint32_t end;
  8. int8_t power_limit;
  9. uint8_t duty_cycle;
  10. } FuriHalRegionBand;
  11. typedef struct {
  12. char country_code[4];
  13. uint16_t bands_count;
  14. FuriHalRegionBand bands[];
  15. } FuriHalRegion;
  16. /** Initialize region */
  17. void furi_hal_region_init();
  18. /** Get Region Data.
  19. *
  20. * Region data may be allocated in Flash or in RAM.
  21. * Keep in mind that we don't do memory management on our side.
  22. *
  23. * @return pointer to FuriHalRegion instance (in RAM or Flash, check before freeing on region update)
  24. */
  25. const FuriHalRegion* furi_hal_region_get();
  26. /** Set device region data
  27. *
  28. * @param region pointer to the FuriHalRegion
  29. */
  30. void furi_hal_region_set(FuriHalRegion* region);
  31. /** Check if region data provisioned
  32. *
  33. * @return true if provisioned, false otherwise
  34. */
  35. bool furi_hal_region_is_provisioned();
  36. /** Get region name
  37. *
  38. * 2 letter Region code according to iso 3166 standard
  39. * There are 2 extra values that we use in special cases:
  40. * - "00" - developer edition, unlocked
  41. * - "WW" - world wide, region provisioned by default
  42. * - "--" - no provisioned region
  43. *
  44. * @return Pointer to string
  45. */
  46. const char* furi_hal_region_get_name();
  47. /** Сheck if transmission is allowed on this frequency for your flipper region
  48. *
  49. * @param[in] frequency The frequency
  50. * @param value frequency in Hz
  51. *
  52. * @return true if allowed
  53. */
  54. bool furi_hal_region_is_frequency_allowed(uint32_t frequency);
  55. /** Get band data for frequency
  56. *
  57. *
  58. *
  59. * @param[in] frequency The frequency
  60. *
  61. * @return { description_of_the_return_value }
  62. */
  63. const FuriHalRegionBand* furi_hal_region_get_band(uint32_t frequency);