示例#1
0
 /// <summary>
 /// Create an AD5593R DAC output.
 /// </summary>
 /// <param name="dev">AD5593R device object.</param>
 /// <param name="channel">AD5593R I/O channel number (0 to 7).</param>
 /// <param name="sample">Initial DAC output sample.</param>
 public Sample(IO.Devices.AD5593R.Device dev, int channel, int sample = 0)
 {
     dev.ConfigureChannel(channel, IO.Devices.AD5593R.PinMode.DAC_Output);
     this.dev    = dev;
     this.chan   = channel;
     this.sample = sample;
 }
示例#2
0
        /// <summary>
        /// Create an AD5593R GPIO pin.
        /// </summary>
        /// <param name="dev">AD5593R device object.</param>
        /// <param name="channel">AD5593R I/O channel number (0 to 7).</param>
        /// <param name="dir">GPIO pin data direction.</param>
        /// <param name="state">Initial GPIO output state.</param>
        public Pin(IO.Devices.AD5593R.Device dev, int channel,
                   IO.Interfaces.GPIO.Direction dir, bool state = false)
        {
            this.dev = dev;
            mask     = (byte)(1 << channel);
            notmask  = (byte)~mask;

            // Configure the AD5593 I/O channel

            if (dir == IO.Interfaces.GPIO.Direction.Input)
            {
                dev.ConfigureChannel(channel, PinMode.GPIO_Input);
                isinput = true;
            }
            else
            {
                dev.ConfigureChannel(channel, PinMode.GPIO_Output);
                isinput    = false;
                this.state = state;
            }
        }
示例#3
0
 /// <summary>
 /// Create an AD5593R ADC input.
 /// </summary>
 /// <param name="dev">AD5593R device object.</param>
 /// <param name="channel">AD5593R I/O channel number (0 to 7).</param>
 public Sample(IO.Devices.AD5593R.Device dev, int channel)
 {
     dev.ConfigureChannel(channel, IO.Devices.AD5593R.PinMode.ADC_Input);
     this.dev  = dev;
     this.chan = channel;
 }