public ErrorCode SetGeneralOutput(GeneralPin outputPin, bool outputValue, bool outputEnable)
        {
            /* calc bitpos from caller's selected ch */
            uint mask = (uint)1 << (int)outputPin;

            /* update regs based on caller's params */
            if (outputValue)
            {
                _regLat |= mask;
            }
            else
            {
                _regLat &= ~mask;
            }

            if (outputEnable)
            {
                _regIsOutput |= mask;
            }
            else
            {
                _regIsOutput &= ~mask;
            }

            return(SetLastError(SetGeneralOutputs(_regLat, _regIsOutput)));
        }
        public bool GetGeneralInput(GeneralPin inputPin)
        {
            int retval = CTRE.Native.CAN.Receive(STATUS_2 | _deviceNumber, ref _cache, ref _len);
            HandleError(retval);

            int mask = 1 << (int)inputPin;
            _regInput = (uint)DecodeRegInput(_cache);

            if (((_regInput & mask) != 0))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public int SetGeneralOutput(GeneralPin outputPin, bool outputValue, bool outputEnable)
        {
            /* calc bitpos from caller's selected ch */
            uint mask = (uint)1 << (int)outputPin;

            /* update regs based on caller's params */
            if (outputValue)
                _regLat |= mask;
            else
                _regLat &= ~mask;

            if (outputEnable)
                _regIsOutput |= mask;
            else
                _regIsOutput &= ~mask;

            return HandleError(SetGeneralOutputs(_regLat, _regIsOutput));
        }
        public bool GetGeneralInput(GeneralPin inputPin)
        {
            int retval = CTRE.Native.CAN.Receive(STATUS_2 | _baseArbId, ref _cache, ref _len);

            SetLastError(retval);

            int mask = 1 << (int)inputPin;

            _regInput = (uint)DecodeRegInput(_cache);

            if (((_regInput & mask) != 0))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Gets the state of the specified pin
 /// </summary>
 /// <param name="inputPin">The index of the pin.</param>
 /// <returns>The state of the pin.</returns>
 public bool GetGeneralInput(GeneralPin inputPin)
 {
     return(CANifierNative.JNI_GetGeneralInput(m_handle, (int)inputPin));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets the output of a General Pin
 /// </summary>
 /// <param name="outputPin">The pin to use as output.</param>
 /// <param name="outputValue">The desired output state.</param>
 /// <param name="outputEnable">Whether this pin is enabled. "True" enables output.</param>
 public void SetGeneralOutput(GeneralPin outputPin, bool outputValue, bool outputEnable)
 {
     CANifierNative.JNI_SetGeneralOutput(m_handle, (int)outputPin, outputValue, outputEnable);
 }
Ejemplo n.º 7
0
 public int SetGeneralOutput(GeneralPin outputPin, bool outputValue, bool outputEnable)
 {
     return(_ll.SetGeneralOutput((LowLevel_CANifier.GeneralPin)outputPin, outputValue, outputEnable));
 }
Ejemplo n.º 8
0
 /**
  * Call GetLastError() to determine success.
  * @return true if specified input is high, false o/w.
  */
 public bool GetGeneralInput(GeneralPin inputPin)
 {
     return(_ll.GetGeneralInput((LowLevel_CANifier.GeneralPin)inputPin));
 }
Ejemplo n.º 9
0
 public ErrorCode SetGeneralOutput(GeneralPin outputPin, bool outputValue, bool outputEnable)
 {
     return(_ll.SetGeneralOutput((CANifier_LowLevel.GeneralPin)outputPin, outputValue, outputEnable));
 }