Raspberry Pi GPIO using the direct memory access method. This requires the bcm2835 GPIO library provided by Mike McCauley ([email protected]) at http://www.open.com.au/mikem/bcm2835/index.html. To create the shared object, download the source code from the link above. The standard Makefile compiles a statically linked library. To build a shared object, do: tar -zxf bcm2835-1.3.tar.gz cd bcm2835-1.3/src make libbcm2835.a cc -shared bcm2835.o -o libbcm2835.so Place the shared object in the same directory as the executable and other assemblies.
Inheritance: GpioBase
 /// <summary>
 /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.Motors.StepperMotorComponent"/>
 /// class with the output pins for each controller in the stepper motor.
 /// </summary>
 /// <param name="pins">
 /// The output pins for each controller in the stepper motor.
 /// </param>
 public StepperMotorComponent(GpioMem[] pins)
     : base()
 {
     this._pins = pins;
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.LCD.GpioMemLcdTransferProvider"/>
		/// class with the mode flag, register select pin, read/write pin,
		/// enable pin, and data pins.
		/// </summary>
		/// <param name="fourBitMode">
		/// If set to true, switch to four bit mode instead of 8 bit mode.
		/// </param>
		/// <param name="rs">
		/// The number of the CPU pin that is connected to the RS (Register Select)
		/// pin on the LCD.
		/// </param>
		/// <param name="rw">
		/// The number of the CPU pin that is connected to the RW (Read/Write)
		/// pin on the LCD.
		/// </param>
		/// <param name="enable">
		/// The number of the CPU pin that is connected to the enable pin
		/// on the LCD.
		/// </param>
		/// <param name="d0">
		/// Data line 0.
		/// </param>
		/// <param name="d1">
		/// Data line 1.
		/// </param>
		/// <param name="d2">
		/// Data line 2.
		/// </param>
		/// <param name="d3">
		/// Data line 3.
		/// </param>
		/// <param name="d4">
		/// Data line 4.
		/// </param>
		/// <param name="d5">
		/// Data line 5.
		/// </param>
		/// <param name="d6">
		/// Data line 6.
		/// </param>
		/// <param name="d7">
		/// Data line 7.
		/// </param>
		/// <remarks>
		/// The display can be controlled using 4 or 8 data lines. If the former,
		/// omit the pin numbers for d0 to d3 and leave those lines disconnected.
		/// The RW pin can be tied to ground instead of connected to a pin on the
		/// Arduino; If so, omit it from this constructor's parameters.
		/// </remarks>
		/// <exception cref="ArgumentException">
		/// <paramref name="rs"/> and <paramref name="enable"/> cannot be set to
		/// <see cref="GpioPins.GPIO_NONE"/>.
		/// </exception>
		public GpioMemLcdTransferProvider(Boolean fourBitMode, GpioPins rs, GpioPins rw, GpioPins enable,
		                                  GpioPins d0, GpioPins d1, GpioPins d2, GpioPins d3, GpioPins d4,
		                                  GpioPins d5, GpioPins d6, GpioPins d7) {
			this._fourBitMode = fourBitMode;
			if (rs == GpioPins.GPIO_NONE) {
				throw new ArgumentException("rs");
			}

			this._registerSelectPort = new GpioMem(rs, PinMode.OUT);
			this._registerSelectPort.Provision();

			// We can save a pin by not using RW. Indicate by passing GpioPins.GPIO_NONE
			// instead of pin # (RW is optional).
			if (rw != GpioPins.GPIO_NONE) {
				this._readWritePort = new GpioMem(rw, PinMode.OUT);
				this._readWritePort.Provision();
			}

			if (enable == GpioPins.GPIO_NONE) {
				throw new ArgumentException("enable");
			}

			this._enablePort = new GpioMem(enable, PinMode.OUT);
			this._enablePort.Provision();

			GpioPins[] dataPins = { d0, d1, d2, d3, d4, d5, d6, d7 };
			this._dataPorts = new GpioMem[8];
			for (Int32 i = 0; i < 8; i++) {
				if (dataPins[i] == GpioPins.GPIO_NONE) {
					this._dataPorts[i] = new GpioMem(dataPins[i], PinMode.OUT);
					this._dataPorts[i].Provision();
				}
			}
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.Sensors.MotionSensorComponent"/>
 /// class with the <see cref="CyrusBuilt.MonoPi.IO.GpioMem"/> I/O pin to use.
 /// </summary>
 /// <param name="pin">
 /// The <see cref="CyrusBuilt.MonoPi.IO.GpioMem"/> I/O pin to use.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="pin"/> cannot null.
 /// </exception>
 public MotionSensorComponent(GpioMem pin)
     : base(pin)
 {
 }
		/// <summary>
		/// Dispose this instance and release managed resources.
		/// </summary>
		/// <param name="disposing">
		/// If set to <c>true</c> disposing and not finalizing.
		/// </param>
		private void Dispose(Boolean disposing) {
			if (this._isDisposed) {
				return;
			}
			
			if (this._registerSelectPort != null) {
				this._registerSelectPort.Dispose();
				this._registerSelectPort = null;
			}
			
			if (this._readWritePort != null) {
				this._readWritePort.Dispose();
				this._readWritePort = null;
			}
			
			if (this._enablePort != null) {
				this._enablePort.Dispose();
				this._enablePort = null;
			}
			
			if ((this._dataPorts != null) && (this._dataPorts.Length > 0)) {
				for (Int32 i = 0; i < 8; i++) {
					if (this._dataPorts[i] != null) {
						this._dataPorts[i].Dispose();
					}
				}
				Array.Clear(this._dataPorts, 0, this._dataPorts.Length);
			}
			
			if (disposing) {
				GC.SuppressFinalize(this);
			}
			this._isDisposed = true;
		}
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Temperature.TemperatureSensorComponent"/>
 /// class with the clock, data, and reset pins needed for the sensor.
 /// </summary>
 /// <param name="clock">
 /// The GPIO pin used for the clock.
 /// </param>
 /// <param name="data">
 /// The GPIO pin used for data.
 /// </param>
 /// <param name="reset">
 /// The GPIO pin used to trigger reset.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// Pins cannot be null.
 /// </exception>
 public TemperatureSensorComponent(GpioMem clock, GpioMem data, GpioMem reset)
     : base(clock, data, reset)
 {
 }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="CyrusBuilt.MonoPi.Components.Temperature.TemperatureSensorComponent"/>
 /// class with the clock, data, and reset pins needed for the sensor,
 /// as well as the scale to get the temperature readings in.
 /// </summary>
 /// <param name="scale">
 /// The scale to get the temperature readings in.
 /// </param>
 /// <param name="clock">
 /// The GPIO pin used for the clock.
 /// </param>
 /// <param name="data">
 /// The GPIO pin used for data.
 /// </param>
 /// <param name="reset">
 /// The GPIO pin used to trigger reset.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// Pins cannot be null.
 /// </exception>
 public TemperatureSensorComponent(TemperatureScale scale, GpioMem clock, GpioMem data, GpioMem reset)
     : base(clock, data, reset)
 {
     this._scale = scale;
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.Relays.RelayComponent"/>
 /// class with the <see cref="CyrusBuilt.MonoPi.IO.GpioMem"/> I/O pin to use.
 /// </summary>
 /// <param name="pin">
 /// The <see cref="CyrusBuilt.MonoPi.IO.GpioMem"/> I/O pin to use.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="pin"/> cannot null.
 /// </exception>
 public RelayComponent(GpioMem pin)
     : base(pin)
 {
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.Sensors.SensorComponent"/>
 /// class with the <see cref="CyrusBuilt.MonoPi.IO.GpioMem"/> I/O pin to use.
 /// </summary>
 /// <param name="pin">
 /// The <see cref="CyrusBuilt.MonoPi.IO.GpioMem"/> I/O pin to use.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="pin"/> cannot null.
 /// </exception>
 public SensorComponent(GpioMem pin)
     : base(pin)
 {
 }