Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="I2CBus"/> class.
        /// </summary>
        /// <param name="busPath">The bus path.</param>
        /// <exception cref="IOException">Thrown if the bus could not be opened.</exception>
        protected I2CBus(string busPath)
        {
            int ret = I2CNativeLib.Open(busPath, I2CNativeLib.OpenReadWrite);

            if (ret < 0)
            {
                throw new IOException(string.Format("Error opening bus '{0}'", busPath /*, UnixMarshal.GetErrorDescription(Stdlib.GetLastError())*/));
            }

            this.busHandle = ret;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// .ctor
        /// </summary>
        /// <param name="busPath"></param>
        protected I2CBus(string busPath)
        {
            int ret = I2CNativeLib.Open(busPath, I2CNativeLib.OPEN_READ_WRITE);

            if (ret < 0)
            {
                throw new IOException(String.Format("Error opening bus '{0}': {1}", busPath /*, UnixMarshal.GetErrorDescription(Stdlib.GetLastError())*/));
            }

            busHandle = ret;
        }