コード例 #1
0
ファイル: MetricValue.cs プロジェクト: muba24/flumin-master
 public MetricValue(Graph graph)
     : base("Value", graph,
            InputPort.CreateMany(),
            OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Value)))
 {
     TimeValue = new TimeLocatedValue(0, TimeStamp.Zero());
 }
コード例 #2
0
 public MetricAdder()
     : base("Adder",
            InputPort.CreateMany(InputPort.Create("inA", PortDataType.Array),
                                 InputPort.Create("inB", PortDataType.Array)),
            OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array)))
 {
 }
コード例 #3
0
 public MetricFilter()
     : base("Filter",
            InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)),
            OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array)))
 {
     Fc = 100000;
 }
コード例 #4
0
 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];
 }
コード例 #5
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];
 }
コード例 #6
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];
 }
コード例 #7
0
ファイル: MetricFilter.cs プロジェクト: muba24/flumin-master
        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;
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: nestalk/ReactiveGpio
        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();
                }
        }
コード例 #9
0
        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;
        }
コード例 #10
0
ファイル: MetricFFT.cs プロジェクト: muba24/flumin-master
 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;
 }
コード例 #11
0
ファイル: Program.cs プロジェクト: FabianNitsche/Fermenter
        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();
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: nestalk/ReactiveGpio
        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();
            }
        }
コード例 #13
0
ファイル: NodeState.cs プロジェクト: muba24/flumin-master
 public BasicTestNode(Graph g) : base("Test", g)
 {
     _inp = InputPort.Create <DataInputPort>("input", this);
     _out = OutputPort.Create <DataOutputPort>("output", this);
 }
コード例 #14
0
 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);
 }
コード例 #15
0
 public MetricHalfrate()
     : base("Half Rate",
            InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)),
            OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array)))
 {
 }
コード例 #16
0
 public MetricPower()
     : base("Power",
            InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)),
            OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array)))
 {
 }
コード例 #17
0
 public MetricSlowProcess()
     : base("Slow Process",
            InputPort.CreateMany(InputPort.Create("in", PortDataType.Array)),
            OutputPort.CreateMany(OutputPort.Create("out", PortDataType.Array)))
 {
 }
コード例 #18
0
 public PassThroughNode(Graph g) : base("Passthrough", g)
 {
     _input  = InputPort.Create <DataInputPort>("Inp", this);
     _output = OutputPort.Create <DataOutputPort>("Out", this);
 }
コード例 #19
0
 public SourceNode(Graph g) : base("Source", g)
 {
     _output    = OutputPort.Create <DataOutputPort>("Out", this);
     Samplerate = 100;
 }
コード例 #20
0
ファイル: FileNode.cs プロジェクト: muba24/flumin-master
 public FileNode(Graph g)
     : base("File", g, InputPort.CreateMany(), OutputPort.CreateMany(OutputPort.Create("Out", PortDataType.Array)))
 {
     _portOut = (DataOutputPort)OutputPorts[0];
 }
コード例 #21
0
 public MetricValueRange(Graph graph) : base("Range", graph, InputPort.CreateMany(), OutputPort.CreateMany(OutputPort.Create("Out", PortDataType.Value)))
 {
     _portOut = (ValueOutputPort)OutputPorts[0];
 }
コード例 #22
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));
        }
コード例 #23
0
 public MetricLogicNot(Graph graph) : base("Logical Not", graph)
 {
     InputPort.Create <ValueInputPort>("in", this);
     OutputPort.Create <ValueOutputPort>("out", this);
 }
コード例 #24
0
 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);
 }