/// <summary>Initializes a new instance of the <see cref="GPS2Click" /> class.</summary> /// <param name="socket">The socket on which the module is plugged</param> public GPS2Click(Hardware.Socket socket) { _sl = new SerialListener('$', '\n'); _sl.MessageAvailable += Sl_MessageAvailable; _wakeUp = GpioController.GetDefault().OpenPin(socket.AnPin); _wakeUp.SetDriveMode(GpioPinDriveMode.Input); _onOff = GpioController.GetDefault().OpenPin(socket.PwmPin); _onOff.SetDriveMode(GpioPinDriveMode.Output); // Force full mode _onOff.Write(GpioPinValue.Low); Thread.Sleep(100); _onOff.Write(GpioPinValue.High); Thread.Sleep(100); _onOff.Write(GpioPinValue.Low); Thread.Sleep(1); _onOff.Write(GpioPinValue.High); Thread.Sleep(100); _gps2 = UartController.FromName(socket.ComPort); // Socket #1 _gps2.SetActiveSettings(new UartSetting() { BaudRate = 4800, DataBits = 8, Parity = UartParity.None, StopBits = UartStopBitCount.One, Handshaking = UartHandshake.None }); _gps2.DataReceived += Gps2_DataReceived; _gps2.Enable(); }
/// <summary>Initializes a new instance of the <see cref="Gnss4Click" /> class.</summary> /// <param name="socket">The socket on which the module is plugged</param> public Gnss4Click(Hardware.Socket socket) { _sl = new SerialListener('$', '\n'); _sl.MessageAvailable += Sl_MessageAvailable; _gnss = UartController.FromName(socket.ComPort); _gnss.SetActiveSettings(new UartSetting() { BaudRate = 9600, DataBits = 8, Parity = UartParity.None, StopBits = UartStopBitCount.One, Handshaking = UartHandshake.None }); _gnss.DataReceived += Gnss_DataReceived; _gnss.Enable(); }
/// <summary>Initializes a new instance of the <see cref="GNSSClick" /> class.</summary> /// <param name="socket">The socket on which the module is plugged</param> public GNSSClick(Hardware.Socket socket) { _sl = new SerialListener('$', '\n'); _sl.MessageAvailable += Sl_MessageAvailable; _gnss = UartController.FromName(socket.ComPort); _gnss.SetActiveSettings(9600, 8, UartParity.None, UartStopBitCount.One, UartHandshake.None); _gnss.DataReceived += Gnss_DataReceived; _gnss.Enable(); // It seems that we need to send a command so that the module starts sending its data. // So we send a command to request firmware version SendCommand("PMTK605"); }
/// <summary>Initializes a new instance of the <see cref="GnssZoeClick" /> class.</summary> /// <param name="socket">The socket on which the module is plugged</param> public GnssZoeClick(Hardware.Socket socket, Boolean startPolling = true, Int32 pollingFrequency = 1000) { _sl = new SerialListener('$', '\n'); _sl.MessageAvailable += Sl_MessageAvailable; // Initialize SPI _zoe = SpiController.FromName(socket.SpiBus).GetDevice(new SpiConnectionSettings() { ChipSelectType = SpiChipSelectType.Gpio, ChipSelectLine = GpioController.GetDefault().OpenPin(socket.Cs), Mode = SpiMode.Mode0, ClockFrequency = 4000000 }); _rBuff = new Byte[1024]; if (startPolling) { StartPolling(pollingFrequency); } PollingActive = startPolling; PollingFrequency = pollingFrequency; }