Ejemplo n.º 1
0
        protected async override Task Initialize(ISocket parentSocket)
        {
            this.analog = new ADS7830(await GNI.I2cDevice.CreateInterfaceAsync("I2C1", new I2cConnectionSettings(ADS7830.GetAddress(false, false))));
            this.gpio   = new CY8C9560A(await GNI.I2cDevice.CreateInterfaceAsync("I2C1", new I2cConnectionSettings(CY8C9560A.GetAddress(false, false, false, false, false, true, false))), null);

            this.map = this.CreatePinMap();

            Socket socket;

            for (var i = 0; i < 8; i++)
            {
                socket = this.CreateSocket(i + 1);
                socket.AddSupportedTypes(SocketType.Y);

                if (i < 2)
                {
                    socket.AddSupportedTypes(SocketType.A);
                }
                else if (i > 2)
                {
                    socket.AddSupportedTypes(SocketType.P);
                }

                socket.DigitalIOCreator = (indirectedSocket, indirectedPin) => Task.FromResult <GSI.DigitalIO>(new IndirectedDigitalIO(this.GetPin(indirectedSocket, indirectedPin), this.gpio));
                socket.AnalogIOCreator  = (indirectedSocket, indirectedPin) => Task.FromResult <GSI.AnalogIO>(new IndirectedAnalogIO(this.GetChannel(indirectedSocket, indirectedPin), this.GetPin(indirectedSocket, indirectedPin), this.analog, this.gpio));
                socket.PwmOutputCreator = (indirectedSocket, indirectedPin) => Task.FromResult <GSI.PwmOutput>(new IndirectedPwmOutput(this.GetPin(indirectedSocket, indirectedPin), this.gpio));
            }
        }
Ejemplo n.º 2
0
            public IndirectedAnalogIO(byte channel, CY8C9560A.Pin pin, ADS7830 ads, CY8C9560A cy8)
            {
                this.ads     = ads;
                this.channel = channel;

                this.cy8 = cy8;
                this.cy8.SetInput(pin);
            }
Ejemplo n.º 3
0
            public IndirectedDigitalIO(CY8C9560A.Pin pin, CY8C9560A cy8)
            {
                this.pin         = pin;
                this.isInterrupt = false;

                this.cy8 = cy8;
                this.cy8.SetOutput(this.pin);
            }
Ejemplo n.º 4
0
		protected async override Task Initialize(ISocket parentSocket) {
            this.analog = new ADS7830(await NativeInterfaces.I2cDevice.CreateInterfaceAsync("I2C1", new I2cConnectionSettings(ADS7830.GetAddress(false, false))));
            this.gpio = new CY8C9560A(await NativeInterfaces.I2cDevice.CreateInterfaceAsync("I2C1", new I2cConnectionSettings(CY8C9560A.GetAddress(false, false, false, false, false, true, false))), null);

			this.map = this.CreatePinMap();

			Socket socket;
			for (var i = 0; i < 8; i++) {
				socket = this.CreateSocket(i + 1);
				socket.AddSupportedTypes(SocketType.Y);

				if (i < 2) {
					socket.AddSupportedTypes(SocketType.A);
				}
				else if (i > 2) {
					socket.AddSupportedTypes(SocketType.P);
				}

				socket.DigitalIOCreator = (indirectedSocket, indirectedPin) => Task.FromResult<DigitalIO>(new IndirectedDigitalIO(this.GetPin(indirectedSocket, indirectedPin), this.gpio));
				socket.AnalogIOCreator = (indirectedSocket, indirectedPin) => Task.FromResult<AnalogIO>(new IndirectedAnalogIO(this.GetChannel(indirectedSocket, indirectedPin), this.GetPin(indirectedSocket, indirectedPin), this.analog, this.gpio));
				socket.PwmOutputCreator = (indirectedSocket, indirectedPin) => Task.FromResult<PwmOutput>(new IndirectedPwmOutput(this.GetPin(indirectedSocket, indirectedPin), this.gpio));
			}
		}
Ejemplo n.º 5
0
 public IndirectedPwmOutput(CY8C9560A.Pin pin, CY8C9560A cy8)
 {
     this.cy8 = cy8;
     this.pin = pin;
 }
Ejemplo n.º 6
0
			public IndirectedPwmOutput(CY8C9560A.Pin pin, CY8C9560A cy8) {
				this.cy8 = cy8;
				this.pin = pin;
			}
Ejemplo n.º 7
0
			public IndirectedAnalogIO(byte channel, CY8C9560A.Pin pin, ADS7830 ads, CY8C9560A cy8) {
				this.ads = ads;
				this.channel = channel;

				this.cy8 = cy8;
				this.cy8.SetInput(pin);
			}
Ejemplo n.º 8
0
			public IndirectedDigitalIO(CY8C9560A.Pin pin, CY8C9560A cy8) {
				this.pin = pin;
				this.isInterrupt = false;

				this.cy8 = cy8;
				this.cy8.SetOutput(this.pin);
			}