Fork with intent to refactor and add support for American 902-928(915) Frequency Bands
Revision 119:f6ba5b34efee, committed 2021-09-11
- Comitter:
- Kevin Barnett
- Date:
- Sat Sep 11 19:17:21 2021 -0700
- Parent:
- 118:f2826a8fbff2
- Commit message:
- created constants and inline functions for american 902-928 MHz freq
Changed in this revision
sx1276/sx1276.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/sx1276/sx1276.h Fri Jan 18 15:33:46 2019 +0100 +++ b/sx1276/sx1276.h Sat Sep 11 19:17:21 2021 -0700 @@ -66,25 +66,24 @@ /*! * Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS] */ -typedef enum BoardType -{ +typedef enum BoardType { SX1276MB1MAS = 0, SX1276MB1LAS, RFM95_SX1276, MURATA_SX1276, HELTEC_L4_1276, UNKNOWN -}BoardType_t; +} BoardType_t; typedef enum { - LORA_SF6 = 6, // 64 chips/symbol, SF6 requires an TCXO! - LORA_SF7 = 7, // 128 chips/symbol - LORA_SF8 = 8, // 256 chips/symbol - LORA_SF9 = 9, // 512 chips/symbol - LORA_SF10 = 10, // 1024 chips/symbol - LORA_SF11 = 11, // 2048 chips/symbol - LORA_SF12 = 12, // 4096 chips/symbol + LORA_SF6 = 6, // 64 chirps/symbol, SF6 requires an TCXO! + LORA_SF7 = 7, // 128 chirps/symbol + LORA_SF8 = 8, // 256 chirps/symbol + LORA_SF9 = 9, // 512 chirps/symbol + LORA_SF10 = 10, // 1024 chirps/symbol + LORA_SF11 = 11, // 2048 chirps/symbol + LORA_SF12 = 12, // 4096 chirps/symbol } lora_spreading_factor_t; @@ -103,7 +102,28 @@ RF_FREQUENCY_868_5 = 868500000, // Hz } rf_frequency_t; +const uint32_t US915_U64_Channel0 = 902300000; // Hz +const uint32_t US915_U8_Channel0 = 903000000; // Hz +const uint32_t US915_D8_Channel0 = 923300000; // Hz +const uint32_t U64_INC = 200000; // Hz +const uint32_t U8_INC = 1600000; // Hz +const uint32_t D8_INC = 600000; // Hz + +inline uint32_t getUpstreamFrequency(const uint8_t chan) { + if(chan < 64) { + return US915_U64_Channel0 + (chan * U64_INC); + } + else if(chan <= 71) { + return US915_U8_Channel0 + ((chan - 64) * U8_INC); + } + else + return -1; +} + +inline uint32_t getDownstreamFreq(const uint8_t chan) { + return (chan < 8) ? US915_D8_Channel0 + (chan * D8_INC) : -1; +} /*! * Actual implementation of a SX1276 radio, inherits Radio @@ -626,17 +646,17 @@ static uint8_t GetLoRaBandwidthRegValue( uint32_t bandwidth ); enum { - LORA_BANKWIDTH_7kHz = 0, // 7.8 kHz requires TCXO - LORA_BANKWIDTH_10kHz = 1, // 10.4 kHz requires TCXO - LORA_BANKWIDTH_15kHz = 2, // 15.6 kHz requires TCXO - LORA_BANKWIDTH_20kHz = 3, // 20.8 kHz requires TCXO - LORA_BANKWIDTH_31kHz = 4, // 31.2 kHz requires TCXO - LORA_BANKWIDTH_41kHz = 5, // 41.4 kHz requires TCXO - LORA_BANKWIDTH_62kHz = 6, // 62.5 kHz requires TCXO - LORA_BANKWIDTH_125kHz = 7, - LORA_BANKWIDTH_250kHz = 8, - LORA_BANKWIDTH_500kHz = 9, - LORA_BANKWIDTH_RESERVED = 10, + LORA_BANDWIDTH_7kHz = 0, // 7.8 kHz requires TCXO + LORA_BANDWIDTH_10kHz = 1, // 10.4 kHz requires TCXO + LORA_BANDWIDTH_15kHz = 2, // 15.6 kHz requires TCXO + LORA_BANDWIDTH_20kHz = 3, // 20.8 kHz requires TCXO + LORA_BANDWIDTH_31kHz = 4, // 31.2 kHz requires TCXO + LORA_BANDWIDTH_41kHz = 5, // 41.4 kHz requires TCXO + LORA_BANDWIDTH_62kHz = 6, // 62.5 kHz requires TCXO + LORA_BANDWIDTH_125kHz = 7, + LORA_BANDWIDTH_250kHz = 8, + LORA_BANDWIDTH_500kHz = 9, + LORA_BANDWIDTH_RESERVED = 10, }; };