Esempio n. 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();
        }
Esempio n. 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 ();
		}
Esempio n. 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;
            }
        }
Esempio n. 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;
			}
		}