public SampleApp() { Debug.EnableGCMessages(true); switch (SystemInfo.OEMString) { case "GHI Electronics, LLC": switch ((Fez)SystemInfo.SystemID.Model) { case Fez.Mini: _chipSelectPin = (Cpu.Pin) 11; // FEZ_Pin.Digital.UEXT5 _interruptPin = (Cpu.Pin) 43; // FEZ_Pin.Interrupt.UEXT10 _chipEnablePin = (Cpu.Pin) 1; // FEZ_Pin.Digital.UEXT6 _spi = SPI.SPI_module.SPI1; _led = new OutputPort((Cpu.Pin) 28, false); // FEZ_Pin.Digital.An0 break; case Fez.Domino: _chipSelectPin = (Cpu.Pin) 11; // FEZ_Pin.Digital.UEXT5 _interruptPin = (Cpu.Pin) 12; // FEZ_Pin.Interrupt.UEXT10 _chipEnablePin = (Cpu.Pin) 1; // FEZ_Pin.Digital.UEXT6 _spi = SPI.SPI_module.SPI2; _led = new OutputPort((Cpu.Pin) 20, false); // FEZ_Pin.Digital.Di0 break; case Fez.Cobra: _chipSelectPin = (Cpu.Pin) 75; // FEZ_Pin.Digital.UEXT5 _interruptPin = (Cpu.Pin) 26; // FEZ_Pin.Interrupt.UEXT10 _chipEnablePin = (Cpu.Pin) 48; // FEZ_Pin.Digital.UEXT6 _spi = SPI.SPI_module.SPI2; _led = new OutputPort((Cpu.Pin) 46, false); // FEZ_Pin.Digital.IO46 break; default: throw new NotSupportedException("Unknown board!"); } break; case "Netduino Mini by Secret Labs LLC": // this example will be extended to Netduino family throw new NotSupportedException("Netduino mini is not yet supported!"); default: throw new NotSupportedException("Unknown board!"); } _module = new NRF24L01Plus(); _rand = new Random(); }
static void Main(string[] args) { SPI SPIport = new Microsoft.SPOT.Hardware.SPI(new Microsoft.SPOT.Hardware.SPI.Configuration(Cpu.Pin.GPIO_NONE, false, 0, 0, false, true, 2000, SPI.SPI_module.SPI1)); OutputPort nCE = new OutputPort(Cpu.Pin.GPIO_Pin2, true); InterruptPort nINT = new InterruptPort(Cpu.Pin.GPIO_Pin4, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow); NRF24L01Plus n = new NRF24L01Plus(); n.Initialize(SPIport, nCE, nINT); byte[] address = n.GetAddress(AddressSlot.Zero, 5); Console.WriteLine("First Address: " + ByteArrayToHexString(address)); byte[] b = new byte[] { 0x04, 0x09, 0x02, 0x03, 0x04 }; n.SetAddress(AddressSlot.Zero, b, false); address = n.GetAddress(AddressSlot.Zero, 5); Console.WriteLine("Second Address: " + ByteArrayToHexString(address)); nCE.Dispose(); nINT.Dispose(); }
public NrfPeerToPeerController() { _nrf24L01Plus = new NRF24L01Plus(); }