示例#1
0
        /// <summary>
        /// Class handling I2C (Inter-Integrated Circuit) communication over the Raspberry Pi GPIO Pin Header, using custom GPIO pins can be chosen.
        /// </summary>
        /// <param name="SclPin">GPIO Pin connected to the SCL line.</param>
        /// <param name="SdaPin">GPIO Pin connected to the SDA line.</param>
        /// <param name="MaxSclFrequencyHz">Maximum frequency (in Hz) of SCL on the bus.</param>
        public I2C(int SclPin, int SdaPin, long MaxSclFrequencyHz)
        {
            this.scl    = new DigitalOutput(SclPin, true);
            this.sdaIn  = new DigitalInput(SdaPin);
            this.sdaOut = new DigitalOutput(SdaPin, true);

            this.maxSclFrequencyHz = MaxSclFrequencyHz;
            this.InitClock();
        }
示例#2
0
		/// <summary>
		/// Class handling I2C (Inter-Integrated Circuit) communication over the Raspberry Pi GPIO Pin Header, using custom GPIO pins can be chosen.
		/// </summary>
		/// <param name="SclPin">GPIO Pin connected to the SCL line.</param>
		/// <param name="SdaPin">GPIO Pin connected to the SDA line.</param>
		/// <param name="MaxSclFrequencyHz">Maximum frequency (in Hz) of SCL on the bus.</param>
		public I2C (int SclPin, int SdaPin, long MaxSclFrequencyHz)
		{
			this.scl = new DigitalOutput (SclPin, true);
			this.sdaIn = new DigitalInput (SdaPin);
			this.sdaOut = new DigitalOutput (SdaPin, true);

			this.maxSclFrequencyHz = MaxSclFrequencyHz;
			this.InitClock ();
		}
示例#3
0
        public void Dispose()
        {
            if (this.scl != null)
            {
                this.scl.Dispose();
                this.scl = null;

                this.sdaIn.Dispose();
                this.sdaIn = null;

                this.sdaOut.Dispose();
                this.sdaOut = null;
            }
        }
示例#4
0
		public void Dispose ()
		{
			if (this.scl != null)
			{
				this.scl.Dispose ();
				this.scl = null;

				this.sdaIn.Dispose ();
				this.sdaIn = null;

				this.sdaOut.Dispose ();
				this.sdaOut = null;
			}
		}