Exemplo n.º 1
0
        public I2C_Comm(int deviceProductId, int deviceVendorId, int busSpeed)
        {
            device = new I2C_Device(deviceProductId, deviceVendorId);
            port   = new I2C_Port(busSpeed);

            checkPresenceAndConnect();
        }
Exemplo n.º 2
0
        }                                 /**< Representation of the i2c port */

        public I2C_Comm()
        {
            device = new I2C_Device();
            port   = new I2C_Port();

            checkPresenceAndConnect();
        }
Exemplo n.º 3
0
        /** @brief Initialize the communication with the port
         *
         *  @param device is the object representing the device to connect with.
         *  @return the response from the command to init the port.
         */
        public I2CData init(I2C_Device device)
        {
            var command   = CreateCommandToInitoI2CPort();
            var returnVal = device.performTransaction(command);

            initialised = true;
            return(returnVal);
        }
Exemplo n.º 4
0
        /** @brief Reinitialize the communication with the port
         *
         *  @param device is the object representing the device to connect with.
         *  @param busSpeedInKHz is the bus speed on the bus for the communication
         *  @return the response from the command to init the port.
         */
        public I2CData reinit(int busSpeedInKHz, I2C_Device device)
        {
            I2CData result = null;

            setBusSpeedInHz(busSpeedInKHz * 1000);
            if (device.isConnected())
            {
                result = init(device);
            }
            return(result);
        }