예제 #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;
			}
		}