public static void ValidateSettings(TransceiverSettings settings)
 {
     // In LoRa mode, only bandwidth 125, 250 & 500 is allowed
     if ((settings.BandWidth != BandWidth.BandWidth_125_00_kHz) &&
         (settings.BandWidth != BandWidth.BandWidth_250_00_kHz) &&
         (settings.BandWidth != BandWidth.BandWidth_500_00_kHz))
     {
         throw new ArgumentException("In LoRa mode, only bandwidth 125 kHz, 250 kHz or 500 kHz is allowed");
     }
 }
Exemple #2
0
        protected Transceiver(SpiDevice spiDevice, TransceiverSettings settings, TransceiverPinSettings pinSettings)
        {
            Settings           = settings;
            _spiCommController = new SpiCommController(spiDevice);

            SpiComm = _spiCommController.Create(pinSettings.ChipSelectPinNumber);

            Pins = CreatePins(pinSettings);
            Pins.Dio0.ValueChanged += Dio0Pin_ValueChanged;

            RegisterManager = new RegisterManager(SpiComm);
        }
Exemple #3
0
        public static async Task <ITransceiver> Create(SpiDevice spiDevice, TransceiverSettings settings, TransceiverPinSettings pinSettings)
        {
            Transceiver transceiver;

            switch (settings.RadioModem)
            {
            case RadioModemKind.Fsk:
                throw new NotImplementedException();

            case RadioModemKind.Lora:
                LoraTransceiver.ValidateSettings(settings);
                transceiver = new LoraTransceiver(spiDevice, settings, pinSettings);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            await transceiver.Init().ConfigureAwait(false);

            return(transceiver);
        }
 public LoraTransceiver(SpiDevice spiDevice, TransceiverSettings settings, TransceiverPinSettings pinSettings)
     : base(spiDevice, settings, pinSettings)
 {
 }
Exemple #5
0
        public static async Task <ITransceiver> Create(TransceiverSettings transceiverSettings, TransceiverPinSettings pinSettings)
        {
            SpiDevice spiDevice = await CreateSpiDevice().ConfigureAwait(false);

            return(await Transceiver.Create(spiDevice, transceiverSettings, pinSettings).ConfigureAwait(false));
        }