public MetricValue(Graph graph) : base("Value", graph, InputPort.CreateMany(), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Value))) { TimeValue = new TimeLocatedValue(0, TimeStamp.Zero()); }
public MetricAdder() : base("Adder", InputPort.CreateMany(InputPort.Create("inA", PortDataType.Array), InputPort.Create("inB", PortDataType.Array)), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { }
public MetricFilter() : base("Filter", InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { Fc = 100000; }
public MetricHalfrate(Graph graph) : base("Half Rate", graph, InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { _portInp = (DataInputPort)InputPorts[0]; _portOut = (DataOutputPort)OutputPorts[0]; }
public MetricFFTBandEnergy(Graph graph) : base("Band Energy", graph, InputPort.CreateMany( InputPort.Create("in", PortDataType.FFT)), OutputPort.CreateMany( OutputPort.Create("out", PortDataType.Value))) { _portInp = (FFTInputPort)InputPorts[0]; _portOut = (ValueOutputPort)OutputPorts[0]; }
public MetricMultiplyValue(Graph graph) : base("Multiply", graph, InputPort.CreateMany(InputPort.Create("in", PortDataType.Array), InputPort.Create("f", PortDataType.Value)), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { _portInp = (DataInputPort)InputPorts[0]; _inputValue = (ValueInputPort)InputPorts[1]; _portOut = (DataOutputPort)OutputPorts[0]; }
public MetricFilter(Graph graph) : base("Filter", graph, InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { _portInp = (DataInputPort)InputPorts[0]; _portOut = (DataOutputPort)OutputPorts[0]; Fc = 100000; }
private static void Main(string[] args) { using (var inputPort = InputPort.Create(18, GpioEdge.Both).Result) using (var outputPort = OutputPort.Create(23, OutputPort.InitialValue.Low).Result) { Console.WriteLine("Started"); inputPort.Subscribe(outputPort); Console.ReadLine(); } }
public DeviceNode(IDevicePort port) : base("Dev Port", InputPort.CreateMany(), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { Port = port; Port.OnBufferReady += Port_OnBufferReady; Port.SamplerateChanged += Port_SamplerateChanged; OutputPorts[0].Samplerate = Port.Samplerate; }
public MetricFFT(Graph graph) : base("FFT", graph, InputPort.CreateMany( InputPort.Create("in", PortDataType.Array)), OutputPort.CreateMany( OutputPort.Create("out", PortDataType.FFT))) { _portInp = (DataInputPort)InputPorts[0]; _portOut = (FFTOutputPort)OutputPorts[0]; FFTSize = 2048; }
static void Main(string[] args) { MMALCamera cam = MMALCamera.Instance; // Create observable that will generate an incrementing number every second var observable = Observable.Generate(1, x => true, x => x + 1, x => x, x => TimeSpan.FromSeconds(1)); var relay = OutputPort.Create(17, OutputPort.InitialValue.Low).Result; var light1 = OutputPort.Create(27, OutputPort.InitialValue.Low).Result; var light2 = OutputPort.Create(22, OutputPort.InitialValue.Low).Result; var button = InputPort.Create(24, GpioEdge.Both).Result; // Write true whenever the number is even and odd when the number is odd using (var imgCaptureHandler = new ImageStreamCaptureHandler("/home/pi/images/", "jpg")) using (observable.Select(x => x % 2 == 0).Subscribe(relay)) using (observable.Select(x => x % 2 == 0).Subscribe(light1)) //using (observable.Select(x => x % 2 != 0).Subscribe(light2)) //using (button.Do(pressed => Console.WriteLine(pressed)).Subscribe()) using (button.Subscribe(light2)) using (var i2cBus = new I2CBusPI("/dev/i2c-1")) { var takePictureTask = cam.TakePicture(imgCaptureHandler, MMALEncoding.JPEG, MMALEncoding.I420); var i2cDevice = new I2CDevicePI(i2cBus, Display.DefaultI2CAddress); var sensor = new BME280Sensor(i2cBus, 1014); var display = new SSD1306.Display(i2cDevice, 128, 64); display.Init(); var dfont = new AdafruitSinglePageFont(); for (int i = 0; i < 100; i++) { display.WriteLineBuff(dfont, $"Temperature: {sensor.ReadTemperature().Result} °C", $"Pressure: {sensor.ReadPressure().Result} Pa", $"Humidity: {sensor.ReadHumidity().Result} %", $"Altitude: {sensor.ReadAltitude().Result} m", "Line 5", "Line 6", "Line 7", "Line 8"); display.DisplayUpdate(); } //for (int i = 0; i < 100; i++) // display.DrawPixel(i, i); takePictureTask.Wait(); display.ClearDisplay(); } // releasing relay relay.Write(true); // turning of light light1.Write(false); light2.Write(false); // Cleanup disposes all unmanaged resources and unloads Broadcom library. To be called when no more processing is to be done // on the camera. cam.Cleanup(); }
private static void Main(string[] args) { var observable = Observable.Generate(1, x => true, x => x + 1, x => x, x => TimeSpan.FromSeconds(1)); using (var port = OutputPort.Create(23, OutputPort.InitialValue.Low).Result) { Console.WriteLine("Started"); observable.Subscribe(Console.WriteLine); observable.Select(x => x % 2 == 0).Subscribe(port); Console.ReadLine(); } }
public BasicTestNode(Graph g) : base("Test", g) { _inp = InputPort.Create <DataInputPort>("input", this); _out = OutputPort.Create <DataOutputPort>("output", this); }
public MetricThresholdEvent(Graph g) : base("Treshold Event", g) { _dataIn = InputPort.Create <DataInputPort>("Inp", this); _threshIn = InputPort.Create <ValueInputPort>("Thresh", this); _eventOut = OutputPort.Create <EventOutputPort>("Ev", this); }
public MetricHalfrate() : base("Half Rate", InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { }
public MetricPower() : base("Power", InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { }
public MetricSlowProcess() : base("Slow Process", InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)), OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array))) { }
public PassThroughNode(Graph g) : base("Passthrough", g) { _input = InputPort.Create <DataInputPort>("Inp", this); _output = OutputPort.Create <DataOutputPort>("Out", this); }
public SourceNode(Graph g) : base("Source", g) { _output = OutputPort.Create <DataOutputPort>("Out", this); Samplerate = 100; }
public FileNode(Graph g) : base("File", g, InputPort.CreateMany(), OutputPort.CreateMany(OutputPort.Create("Out", PortDataType.Array))) { _portOut = (DataOutputPort)OutputPorts[0]; }
public MetricValueRange(Graph graph) : base("Range", graph, InputPort.CreateMany(), OutputPort.CreateMany(OutputPort.Create("Out", PortDataType.Value))) { _portOut = (ValueOutputPort)OutputPorts[0]; }
public static async Task <GpioSwitch> Create(IGpioDriver driver, int gpioPin, bool lowIsOff, IObservable <bool> onOffTrigger) { var port = await OutputPort.Create(gpioPin, lowIsOff?OutputPort.InitialValue.Low : OutputPort.InitialValue.High, driver); return(new GpioSwitch(port, onOffTrigger)); }
public MetricLogicNot(Graph graph) : base("Logical Not", graph) { InputPort.Create <ValueInputPort>("in", this); OutputPort.Create <ValueOutputPort>("out", this); }
public MetricAdder(Graph graph) : base("Adder", graph) { _portInA = InputPort.Create <DataInputPort>("inA", this); _portInB = InputPort.Create <DataInputPort>("inB", this); _portOut = OutputPort.Create <DataOutputPort>("out", this); }