acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

RFM96.h (4013B)

      1 #if !defined(_RADIOLIB_RFM96_H)
      2 #define _RADIOLIB_RFM96_H
      3 
      4 #include "../../TypeDef.h"
      5 
      6 #if !defined(RADIOLIB_EXCLUDE_RFM9X)
      7 
      8 #include "../../Module.h"
      9 #include "../SX127x/SX127x.h"
     10 #include "../SX127x/SX1278.h"
     11 
     12 // SX127X_REG_VERSION
     13 #define RADIOLIB_RFM9X_CHIP_VERSION_OFFICIAL                   0x11
     14 #define RADIOLIB_RFM9X_CHIP_VERSION_UNOFFICIAL                 0x12  // according to datasheet, only 0x11 should be possible, but some modules seem to have 0x12
     15 
     16 /*!
     17   \class RFM96
     18 
     19   \brief Derived class for %RFM96 modules. Overrides some methods from SX1278 due to different parameter ranges.
     20 */
     21 class RFM96: public SX1278 {
     22   public:
     23 
     24     // constructor
     25 
     26     /*!
     27       \brief Default constructor. Called from Arduino sketch when creating new LoRa instance.
     28 
     29       \param mod Instance of Module that will be used to communicate with the %LoRa chip.
     30     */
     31     RFM96(Module* mod);
     32 
     33     // basic methods
     34 
     35     /*!
     36       \brief %LoRa modem initialization method. Must be called at least once from Arduino sketch to initialize the module.
     37 
     38       \param freq Carrier frequency in MHz. Allowed values range from 433.0 MHz to 470.0 MHz.
     39 
     40       \param bw %LoRa link bandwidth in kHz. Allowed values are 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125, 250 and 500 kHz.
     41 
     42       \param sf %LoRa link spreading factor. Allowed values range from 6 to 12.
     43 
     44       \param cr %LoRa link coding rate denominator. Allowed values range from 5 to 8.
     45 
     46       \param syncWord %LoRa sync word. Can be used to distinguish different networks. Note that value 0x34 is reserved for LoRaWAN networks.
     47 
     48       \param power Transmission output power in dBm. Allowed values range from 2 to 17 dBm.
     49 
     50       \param preambleLength Length of %LoRa transmission preamble in symbols. The actual preamble length is 4.25 symbols longer than the set number.
     51       Allowed values range from 6 to 65535.
     52 
     53       \param gain Gain of receiver LNA (low-noise amplifier). Can be set to any integer in range 1 to 6 where 1 is the highest gain.
     54       Set to 0 to enable automatic gain control (recommended).
     55 
     56       \returns \ref status_codes
     57     */
     58     int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX127X_SYNC_WORD, int8_t power = 10, uint16_t preambleLength = 8, uint8_t gain = 0);
     59 
     60     /*!
     61       \brief FSK modem initialization method. Must be called at least once from Arduino sketch to initialize the module.
     62 
     63       \param freq Carrier frequency in MHz. Allowed values range from 137.0 MHz to 525.0 MHz.
     64 
     65       \param br Bit rate of the FSK transmission in kbps (kilobits per second). Allowed values range from 1.2 to 300.0 kbps.
     66 
     67       \param freqDev Frequency deviation of the FSK transmission in kHz. Allowed values range from 0.6 to 200.0 kHz.
     68       Note that the allowed range changes based on bit rate setting, so that the condition FreqDev + BitRate/2 <= 250 kHz is always met.
     69 
     70       \param rxBw Receiver bandwidth in kHz. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12.5, 15.6, 20.8, 25, 31.3, 41.7, 50, 62.5, 83.3, 100, 125, 166.7, 200 and 250 kHz.
     71 
     72       \param power Transmission output power in dBm. Allowed values range from 2 to 17 dBm.
     73 
     74       \param preambleLength Length of FSK preamble in bits.
     75 
     76       \param enableOOK Use OOK modulation instead of FSK.
     77 
     78       \returns \ref status_codes
     79     */
     80     int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 125.0, int8_t power = 10, uint16_t preambleLength = 16, bool enableOOK = false);
     81 
     82     // configuration methods
     83 
     84     /*!
     85       \brief Sets carrier frequency. Allowed values range from 433.0 MHz to 470.0 MHz.
     86 
     87       \param freq Carrier frequency to be set in MHz.
     88 
     89       \returns \ref status_codes
     90     */
     91     int16_t setFrequency(float freq);
     92 
     93 #if !defined(RADIOLIB_GODMODE)
     94   private:
     95 #endif
     96 
     97 };
     98 
     99 /*!
    100   \class RFM98
    101 
    102   \brief Only exists as alias for RFM96, since there seems to be no difference between %RFM96 and %RFM98 modules.
    103 */
    104 RADIOLIB_TYPE_ALIAS(RFM96, RFM98);
    105 
    106 #endif
    107 
    108 #endif