static void Init() { button = new PushButton(Pins.ONBOARD_BTN, Netduino.Foundation.CircuitTerminationType.CommonGround); button.Clicked += OnButtonClicked; radio = new TEA5767(); Thread.Sleep(200); radio.SetFrequency(94.5f); var lcd = new ST7565(chipSelectPin: Pins.GPIO_PIN_D10, dcPin: Pins.GPIO_PIN_D8, resetPin: Pins.GPIO_PIN_D9, spiModule: SPI.SPI_module.SPI1, speedKHz: 10000, width: 129, height: 65 ); lcd.SetContrast(0); display = new GraphicsLibrary(lcd); display.CurrentFont = new Font8x12(); UpdateDisplay(); }
void InitializeHardware() { Console.WriteLine("Configuring hardware"); stereoLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedRed); Console.WriteLine("Create radio button"); muteButton = Device.CreateDigitalInputPort(Device.Pins.D12); Console.WriteLine("Create Spi bus"); var spiBus = Device.CreateSpiBus(); Console.WriteLine("Create display"); var st7565 = new ST7565(device: Device, spiBus: spiBus, chipSelectPin: Device.Pins.D02, dcPin: Device.Pins.D00, resetPin: Device.Pins.D01, width: 128, height: 64); st7565.SetContrast(5); Console.WriteLine("Create graphics lib"); display = new GraphicsLibrary(st7565); display.CurrentFont = new Font8x8(); Console.WriteLine("Create I2C bus"); var i2cBus = Device.CreateI2cBus(); Console.WriteLine("Create TEA5767 instance"); radio = new TEA5767(i2cBus); Thread.Sleep(500); //quick test radio.SetFrequency(94.9f); }