static void Main() { #if ST_STM32F429I_DISCOVERY int chipSelectPinNumber = PinNumber('C', 2); int resetPinNumber = PinNumber('C', 3); int interruptPinNumber = PinNumber('A', 4); #endif #if ESP32_WROOM_32_LORA_1_CHANNEL int chipSelectPinNumber = Gpio.IO16; int interruptPinNumber = Gpio.IO26; #endif #if NETDUINO3_WIFI int chipSelectPinNumber = PinNumber('B', 10); int resetPinNumber = PinNumber('E', 5); int interruptPinNumber = PinNumber('A', 3); #endif try { #if ESP32_WROOM_32_LORA_1_CHANNEL Configuration.SetPinFunction(Gpio.IO12, DeviceFunction.SPI1_MISO); Configuration.SetPinFunction(Gpio.IO13, DeviceFunction.SPI1_MOSI); Configuration.SetPinFunction(Gpio.IO14, DeviceFunction.SPI1_CLOCK); Rfm9XDevice rfm9XDevice = new Rfm9XDevice(SpiBusId, chipSelectPinNumber, interruptPinNumber); #endif #if ST_STM32F429I_DISCOVERY || NETDUINO3_WIFI Rfm9XDevice rfm9XDevice = new Rfm9XDevice(SpiBusId, chipSelectPinNumber, resetPinNumber, interruptPinNumber); #endif Thread.Sleep(500); // Put device into LoRa + Sleep mode rfm9XDevice.RegisterWriteByte(0x01, 0b10000000); // RegOpMode // Set the frequency to 915MHz byte[] frequencyWriteBytes = { 0xE4, 0xC0, 0x00 }; // RegFrMsb, RegFrMid, RegFrLsb rfm9XDevice.RegisterWrite(0x06, frequencyWriteBytes); rfm9XDevice.RegisterWriteByte(0x0F, 0x0); // RegFifoRxBaseAddress rfm9XDevice.RegisterWriteByte(0x40, 0b00000000); // RegDioMapping1 0b00000000 DI0 RxReady & TxReady rfm9XDevice.RegisterWriteByte(0x01, 0b10000101); // RegOpMode set LoRa & RxContinuous rfm9XDevice.RegisterDump(); Debug.WriteLine("Receive-Wait"); Thread.Sleep(Timeout.Infinite); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
static void Main() { Rfm9XDevice rfm9XDevice = new Rfm9XDevice(FEZ.GpioPin.D10, FEZ.GpioPin.D9, FEZ.GpioPin.D2); // Put device into LoRa + Sleep mode rfm9XDevice.RegisterWriteByte(0x01, 0b10000000); // RegOpMode // Set the frequency to 915MHz byte[] frequencyWriteBytes = { 0xE4, 0xC0, 0x00 }; // RegFrMsb, RegFrMid, RegFrLsb rfm9XDevice.RegisterWrite(0x06, frequencyWriteBytes); rfm9XDevice.RegisterWriteByte(0x0F, 0x0); // RegFifoRxBaseAddress rfm9XDevice.RegisterWriteByte(0x40, 0b00000000); // RegDioMapping1 0b00000000 DI0 RxReady & TxReady rfm9XDevice.RegisterWriteByte(0x01, 0b10000101); // RegOpMode set LoRa & RxContinuous rfm9XDevice.RegisterDump(); Debug.WriteLine("Receive-Wait"); Thread.Sleep(Timeout.Infinite); }
static void Main() { #if TINYCLR_V2_SC20100DEV_MIKROBUS_1 Rfm9XDevice rfm9XDevice = new Rfm9XDevice(SC20100.SpiBus.Spi3, SC20100.GpioPin.PD3, SC20100.GpioPin.PD4, SC20100.GpioPin.PC5); #endif #if TINYCLR_V2_SC20100DEV_MIKROBUS_2 Rfm9XDevice rfm9XDevice = new Rfm9XDevice(SC20100.SpiBus.Spi3, SC20100.GpioPin.PD14, SC20100.GpioPin.PD15, SC20100.GpioPin.PA8); #endif #if TINYCLR_V2_SC20100DEV Rfm9XDevice rfm9XDevice = new Rfm9XDevice(SC20100.SpiBus.Spi3, SC20100.GpioPin.PA13, SC20100.GpioPin.PA14, SC20100.GpioPin.PE4); #endif #if TINYCLR_V2_FEZDUINO Rfm9XDevice rfm9XDevice = new Rfm9XDevice(SC20100.SpiBus.Spi6, SC20100.GpioPin.PB1, SC20100.GpioPin.PA15, SC20100.GpioPin.PA1); #endif #if TINYCLR_V2_FEZPORTAL Rfm9XDevice rfm9XDevice = new Rfm9XDevice(SC20100.SpiBus.Spi3, SC20100.GpioPin.PC13, SC20100.GpioPin.PD4, SC20100.GpioPin.PC2); #endif // Put device into LoRa + Sleep mode rfm9XDevice.RegisterWriteByte(0x01, 0b10000000); // RegOpMode // Set the frequency to 915MHz byte[] frequencyWriteBytes = { 0xE4, 0xC0, 0x00 }; // RegFrMsb, RegFrMid, RegFrLsb rfm9XDevice.RegisterWrite(0x06, frequencyWriteBytes); rfm9XDevice.RegisterWriteByte(0x0F, 0x0); // RegFifoRxBaseAddress rfm9XDevice.RegisterWriteByte(0x40, 0b00000000); // RegDioMapping1 0b00000000 DI0 RxReady & TxReady rfm9XDevice.RegisterWriteByte(0x01, 0b10000101); // RegOpMode set LoRa & RxContinuous rfm9XDevice.RegisterDump(); Debug.WriteLine("Receive-Wait"); Thread.Sleep(Timeout.Infinite); }