/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <param name="pullUpDownMode">The pull up or pull down mode</param> /// <history> /// 01 Dec 16 Cynic - Originally written /// </history> public InputPortMM(GpioEnum gpioIDIn, GPIOPullUpDownModeEnum pullUpDownMode) : base(gpioIDIn) { // open the port OpenPort(); // set the mode SetPullUpDownModeForPort(pullUpDownMode); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor, disables PullUps and PullDowns /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <history> /// 01 Dec 16 Cynic - Originally written /// </history> public InputPortMM(GpioEnum gpioIDIn) : base(gpioIDIn) { // open the port OpenPort(); // set the mode to disable pullUpDown SetPullUpDownModeForPort(GPIOPullUpDownModeEnum.PULLUPDOWN_OFF); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <history> /// 28 Aug 14 Cynic - Originally written /// </history> public OutputPortFS(GpioEnum gpioIDIn) : base(gpioIDIn) { // open the port OpenPort(); // set the direction to output SetSysFsDirection(); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Enables the SPI slave device which uses a GPIO pin as a slave select. /// /// NOTE on how this works. When using a GPIO pin as a slave select line /// we still need to open a SPIDev device because we need a device to /// send the data to. The way SPIDev works each spidev device is /// fundamentally associated with a particular slave select line and /// this cannot be changed. The GPIO line will be used as a separate /// slave select but the spidev device specific slave select will also /// be asserted whenever the device is writtent to. /// /// In order to use a GPIO as a slave select you must ignore and not /// electrically attach anything to the slave select pin the SPIDEV /// device uses as it will be asserted on each write. /// /// In other words, the SPIDev device is needed to shift the data in /// and out, however you must ignore its internal slave select line /// entirely if you wish to use GPIO based slave selects. Otherwise /// any device attached to it will be receive every write to the /// SPIPort no matter which GPIO slave select is also asserted. /// /// </summary> /// <returns>ssHandle - the handle for the Slave Device or null for fail</returns> /// <param name="spiSlaveDeviceIn">The GPIO of the pin we use as the slave select</param> /// <history> /// 21 Dec 14 Cynic - Originally written /// </history> public SPISlaveDeviceHandle EnableSPIGPIOSlaveDevice(GpioEnum gpioEnum) { // get first slave device. We need to check we have one SPISlaveDeviceHandle ssHandle = GetFirstSlaveDeviceWithFD(); // sanity check if (ssHandle == null) { throw new Exception("At least one non GPIO Slave Device must be enabled first."); } // create a new output port OutputPortMM gpioSlaveSelect = new OutputPortMM(gpioEnum); // set this high by default, most modes have slave selects high and go low to activate gpioSlaveSelect.Write(true); // create a new slave device handle SPISlaveDeviceHandle outHandle = new SPISlaveDeviceHandle(SPISlaveDeviceEnum.SPI_SLAVEDEVICE_GPIO, gpioSlaveSelect); if (outHandle == null) { throw new Exception("Could not create GPIO based slave select device"); } //Console.WriteLine("SPIPort GPIO Slave Device Enabled: "+ gpioEnum.ToString()); // record that we opened this slave device (so we can close it later) openSlaveDevices.Add(outHandle); // return the slave device handle return(outHandle); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <param name="initialState">The initial state, true or false, of the port /// after we open it. /// <history> /// 01 Dec 16 Cynic - Originally written /// </history> public OutputPortMM(GpioEnum gpioIDIn, bool initialState) : base(gpioIDIn) { // open the port OpenPort(); // set the initial value Write(initialState); }
public void SetPulseParameters(GpioEnum pin, double dutyCycle, bool invertPolarity) { if ((dutyCycle < 0) || (dutyCycle > 1)) { throw new ArgumentOutOfRangeException("dutyCycle"); } lock (m_Pins) { if (!m_Pins.ContainsKey(pin)) { throw new UnauthorizedAccessException(); } var softPin = m_Pins[pin]; softPin.DutyCycle = dutyCycle; softPin.InvertPolarity = invertPolarity; } // If duty cycle isn't zero we need to make sure updates are running if ((Math.Abs(dutyCycle) > double.Epsilon) && (!m_Updater.IsStarted)) { m_Updater.Start(); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets a GpioConfig object for a given gpio object. NOTE when the /// GpioConfig object is instantiated it acesses system information /// for things like mux pin number and usage in the pinmux pins table /// </summary> /// <returns>>the GpioConfig object or a dummy (GpioEnum.GPIO_NONE) for fail</returns> /// <history> /// 01 Dec 16 Cynic Originally written /// </history> public static GpioConfig GetGpioConfigForGpio(GpioEnum gpioIn) { switch (gpioIn) { case GpioEnum.GPIO_4: return(new GpioConfig(7, true, 4, GpioEnum.GPIO_4)); case GpioEnum.GPIO_5: return(new GpioConfig(29, true, 5, GpioEnum.GPIO_5)); case GpioEnum.GPIO_6: return(new GpioConfig(31, true, 6, GpioEnum.GPIO_6)); case GpioEnum.GPIO_12: return(new GpioConfig(32, true, 12, GpioEnum.GPIO_12)); case GpioEnum.GPIO_13: return(new GpioConfig(33, true, 13, GpioEnum.GPIO_13)); case GpioEnum.GPIO_16: return(new GpioConfig(36, true, 16, GpioEnum.GPIO_16)); case GpioEnum.GPIO_17: return(new GpioConfig(11, true, 17, GpioEnum.GPIO_17)); case GpioEnum.GPIO_18: return(new GpioConfig(12, true, 18, GpioEnum.GPIO_18)); case GpioEnum.GPIO_19: return(new GpioConfig(35, true, 19, GpioEnum.GPIO_19)); case GpioEnum.GPIO_20: return(new GpioConfig(38, true, 20, GpioEnum.GPIO_20)); case GpioEnum.GPIO_21: return(new GpioConfig(40, true, 21, GpioEnum.GPIO_21)); case GpioEnum.GPIO_22: return(new GpioConfig(15, true, 22, GpioEnum.GPIO_22)); case GpioEnum.GPIO_23: return(new GpioConfig(16, true, 23, GpioEnum.GPIO_23)); case GpioEnum.GPIO_24: return(new GpioConfig(18, true, 24, GpioEnum.GPIO_24)); case GpioEnum.GPIO_25: return(new GpioConfig(22, true, 25, GpioEnum.GPIO_25)); case GpioEnum.GPIO_26: return(new GpioConfig(37, true, 26, GpioEnum.GPIO_26)); case GpioEnum.GPIO_27: return(new GpioConfig(13, true, 27, GpioEnum.GPIO_27)); default: return(new GpioConfig()); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="eventInterruptModeIn">The interrupt mode</param> /// <param name="gpioIn">The GPIO this interrupt is on. /// <history> /// 28 Aug 14 Cynic - Originally written /// </history> public InterruptPortMM(GpioEnum gpioIn, InterruptMode eventInterruptModeIn) : base(gpioIn) { EventInterruptMode = eventInterruptModeIn; // setup for event detection SetEventMasks(); // open the port and turn on event detection OpenPort(); }
public byte Devices; // x x x x _ x x <HDMI> <eMMC> public PinData(int Offset, byte NumLinux, byte NumGPIO, GpioEnum GPIO, byte Devices) { this.Offset = Offset; this.NumLinux = NumLinux; this.NumGPIO = NumGPIO; this.GPIO = GPIO; this.Devices = Devices; }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <param name="initialState">The initial state, true or false, of the port /// after we open it. /// <history> /// 28 Aug 14 Cynic - Originally written /// </history> public OutputPortFS(GpioEnum gpioIDIn, bool initialState) : base(gpioIDIn) { // open the port OpenPort(); // set the direction to output SetSysFsDirection(); // set the initial value Write(initialState); }
internal void InterruptFalling(GpioEnum EventPin, bool EventState, DateTime Time, EventData Data) { if (EventPin == IO.BeagleBone.Pin.PinToGPIO(this.Pin)) { InputInterrupt Event = new InputInterrupt(Data.EvState); this.FallingHandlers?.Invoke(this, Event); this.IntPortFall.ClearInterrupt(); } }
public IGpioPin OpenPin(GpioEnum pin) { AcquirePin(pin); EnablePin(pin); lock (m_Pins) { return(m_Pins[pin].Pin); } }
public Button(IGpioController controller, GpioEnum gpio, ILoggerService loggerService = null) { ButtonPin = controller.OpenPin(gpio); ButtonPin.SetDriveMode(GpioPinDriveModeEnum.InputPullUp); if (loggerService != null) { TurnedOn += (s, a) => loggerService.Log(LogLevelEnum.Information, $"{Name} is turned on"); TurnedOff += (s, a) => loggerService.Log(LogLevelEnum.Information, $"{Name} is turned off"); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Converts a GpioID to an integer value. Will not accept a gpioID of /// Gpio.GPIO_NONE or GpioEnum.GPIO_SYSEVENT /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <history> /// 28 Aug 14 Cynic - Originally written /// </history> public static int GpioIDToInt(GpioEnum gpioIDIn) { if (gpioIDIn == GpioEnum.GPIO_NONE) { throw new Exception("Invalid Gpio : " + gpioIDIn.ToString()); } // return it as an integer return(Convert.ToInt32(GpioIDToString(gpioIDIn))); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <history> /// 01 Dec 16 Cynic - Originally written /// </history> public Port(GpioEnum gpioIDIn) { // Test the PRI Type has been set if (RPICSIOGlobalConfig.RPIType == RPITypeEnum.RPITYPE_UNKNOWN) { throw new Exception("The RPIType is UNKNOWN. Have you made a call like: RPICSIOConfig.Instance.RPIType = RPITypeEnum.RPITYPE_RPI2;"); } // set our GpioConfig object now gpioCfgObject = GpioUtils.GetGpioConfigForGpio(gpioIDIn); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Converts a GpioID to a numeric string value. Will not accept a gpioID of /// Gpio.GPIO_NONE /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <returns>>the GPIO as a string</returns> /// <history> /// 01 Dec 16 Cynic - Originally written /// </history> public static string GpioIDToString(GpioEnum gpioIDIn) { if (gpioIDIn == GpioEnum.GPIO_NONE) { throw new Exception("Invalid Gpio : " + gpioIDIn.ToString()); } // strip out non digits - want to do this fast so no regex // or cycling through the string testing every char. return(gpioIDIn.ToString().Replace(GPIOENUM_PREFIX, "")); }
public void DisablePin(GpioEnum pin) { lock (m_Pins) { if (!m_Pins.ContainsKey(pin)) { throw new UnauthorizedAccessException(); } m_Pins[pin].Enabled = false; } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="headerPinIn">the number of the header pin /// <param name="isDefaultGPIOOnHeaderIn">if true it is available as a GPIO by default on the header. False it is not</param> /// <param name="gpioNumIn">The gpio as a number</param> /// <param name="gpioIn">The gpio as an enum</param> /// <history> /// 01 Dec 16 Cynic - Started /// </history> public GpioConfig(int headerPinIn, bool isDefaultGPIOOnHeaderIn, int gpioNumIn, GpioEnum gpioIn) { // set some values, ignore others - they are for future use headerPin = headerPinIn; isDefaultGPIOOnHeader = isDefaultGPIOOnHeaderIn; gpioNum = gpioNumIn; gpio = gpioIn; // these values are pre-calculated. We use them a lot gpioBank = GpioNum / 32; // the bank number in the pinmux is the GPIO/32 gpioBit = GpioNum % 32; // the bit number in the pinmux is the remainder of GPIO/32 }
public void ReleasePin(GpioEnum pin) { lock (m_Pins) { if (!m_Pins.ContainsKey(pin)) { throw new UnauthorizedAccessException(); } m_Pins[pin].Pin.Dispose(); m_Pins.Remove(pin); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="eventInterruptModeIn">The interrupt mode</param> /// <param name="gpioIn">The GPIO this interrupt is on. /// <param name="pullUpDownMode">The pull up or pull down mode</param> /// <history> /// 01 Dec 16 Cynic - Originally written /// </history> public InterruptPortMM(GpioEnum gpioIn, GPIOPullUpDownModeEnum pullUpDownMode, InterruptMode eventInterruptModeIn) : base(gpioIn) { EventInterruptMode = eventInterruptModeIn; // setup for event detection SetEventMasks(); // open the port and turn on event detection OpenPort(); // set the mode to disable pullUpDown MMDevMem.SetGPIOPullUpDownMode(GpioCfgObject, pullUpDownMode); // set up the interrupts MMDevMem.DisableAllInterruptsAtGPIOLevel(GpioCfgObject); MMDevMem.EnableInterruptsAtGPIOLevelAccordingToEnum(GpioCfgObject, EventInterruptMode); }
public void AcquirePin(GpioEnum pin) { lock (m_Pins) { if (m_Pins.ContainsKey(pin)) { throw new UnauthorizedAccessException(); } var gpioPin = m_GpioController.OpenPin(pin); gpioPin.SetDriveMode(GpioPinDriveModeEnum.Output); m_Pins[pin] = new SoftPwmPin(gpioPin); } }
public void EnablePin(GpioEnum pin) { lock (m_Pins) { if (!m_Pins.ContainsKey(pin)) { throw new UnauthorizedAccessException(); } m_Pins[pin].Enabled = true; } // Make sure updates are running if (!m_Updater.IsStarted) { m_Updater.Start(); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="headerNumIn">the number of the header (8 or 9)</param> /// <param name="headerPinIn">the number of the header pin /// <param name="pinmuxRegisterOffsetIn">the pinmux register offset</param> /// <param name="gpioNumIn">The gpio as a number</param> /// <param name="gpioIn">The gpio as an enum</param> /// <history> /// 28 Aug 14 Cynic - Started /// </history> public GpioConfig(int headerNumIn, int headerPinIn, int pinmuxRegisterOffsetIn, int gpioNumIn, GpioEnum gpioIn) { // set some values, ignore others - they are for future use headerNum = headerNumIn; headerPin = headerPinIn; pinmuxRegisterOffset = pinmuxRegisterOffsetIn; gpioNum = gpioNumIn; gpio = gpioIn; // these values are pre-calculated. We use them a lot gpioBank = GpioNum / 32; // the bank number in the pinmux is the GPIO/32 gpioBit = GpioNum % 32; // the bit number in the pinmux is the remainder of GPIO/32 gpioMask = 0x01 << gpioBit; // the mask is a 0x01 shifted left by gpioBits // get the information from the system so that we are fully built UpdateConfigurationWithPinsFileInfo(); UpdateConfigurationWithPinmuxPinsFileInfo(); }
private async Task FadeInFadeOutAsync(IPwmController controller, GpioEnum gpio) { var led = new DimmableLed(controller, gpio, 10); while (true) { for (int i = 10; i <= 90; i += 4) { led.Dim(i, this); await Task.Delay(10); } for (int i = 90; i >= 10; i -= 4) { led.Dim(i, this); await Task.Delay(50); } } }
public IGpioPin OpenPin(GpioEnum gpio) { return(new WindowsGpioPin(m_Controller.OpenPin(gpio.ToGpioNumber()))); }
public ToggleButton(IGpioController controller, GpioEnum gpio, ILoggerService loggerService = null) : base(controller, gpio, loggerService) { }
public DimmableLed(IPwmController controller, GpioEnum gpio, int initialValue) { Pin = controller.OpenPin(gpio); Pin.Start(); Dim(initialValue, this); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Gets a GpioConfig object for a given gpio object. NOTE when the /// GpioConfig object is instantiated it acesses system information /// for things like mux pin number and usage in the pinmux pins table /// </summary> /// <returns>>the GpioConfig object or a dummy (GpioEnum.GPIO_NONE) for fail</returns> /// <history> /// 28 Aug 14 Cynic Originally written /// </history> public static GpioConfig GetGpioConfigForGpio(GpioEnum gpioIn) { switch (gpioIn) { case GpioEnum.GPIO_38: return(new GpioConfig(8, 3, 0x818, 38, GpioEnum.GPIO_38)); case GpioEnum.GPIO_39: return(new GpioConfig(8, 4, 0x81C, 39, GpioEnum.GPIO_39)); case GpioEnum.GPIO_34: return(new GpioConfig(8, 5, 0x808, 34, GpioEnum.GPIO_34)); case GpioEnum.GPIO_35: return(new GpioConfig(8, 6, 0x80C, 35, GpioEnum.GPIO_35)); case GpioEnum.GPIO_66: return(new GpioConfig(8, 7, 0x890, 66, GpioEnum.GPIO_66)); case GpioEnum.GPIO_67: return(new GpioConfig(8, 8, 0x894, 67, GpioEnum.GPIO_67)); case GpioEnum.GPIO_69: return(new GpioConfig(8, 9, 0x89C, 69, GpioEnum.GPIO_69)); case GpioEnum.GPIO_68: return(new GpioConfig(8, 10, 0x898, 68, GpioEnum.GPIO_68)); case GpioEnum.GPIO_45: return(new GpioConfig(8, 11, 0x834, 45, GpioEnum.GPIO_45)); case GpioEnum.GPIO_44: return(new GpioConfig(8, 12, 0x830, 44, GpioEnum.GPIO_44)); case GpioEnum.GPIO_23: return(new GpioConfig(8, 13, 0x824, 23, GpioEnum.GPIO_23)); case GpioEnum.GPIO_26: return(new GpioConfig(8, 14, 0x828, 26, GpioEnum.GPIO_26)); case GpioEnum.GPIO_47: return(new GpioConfig(8, 15, 0x83C, 47, GpioEnum.GPIO_47)); case GpioEnum.GPIO_46: return(new GpioConfig(8, 16, 0x838, 46, GpioEnum.GPIO_46)); case GpioEnum.GPIO_27: return(new GpioConfig(8, 17, 0x82C, 27, GpioEnum.GPIO_27)); case GpioEnum.GPIO_65: return(new GpioConfig(8, 18, 0x88C, 65, GpioEnum.GPIO_65)); case GpioEnum.GPIO_22: return(new GpioConfig(8, 19, 0x820, 22, GpioEnum.GPIO_22)); case GpioEnum.GPIO_63: return(new GpioConfig(8, 20, 0x884, 63, GpioEnum.GPIO_63)); case GpioEnum.GPIO_62: return(new GpioConfig(8, 21, 0x880, 62, GpioEnum.GPIO_62)); case GpioEnum.GPIO_37: return(new GpioConfig(8, 22, 0x814, 37, GpioEnum.GPIO_37)); case GpioEnum.GPIO_36: return(new GpioConfig(8, 23, 0x810, 36, GpioEnum.GPIO_36)); case GpioEnum.GPIO_33: return(new GpioConfig(8, 24, 0x804, 33, GpioEnum.GPIO_33)); case GpioEnum.GPIO_32: return(new GpioConfig(8, 25, 0x800, 32, GpioEnum.GPIO_32)); case GpioEnum.GPIO_61: return(new GpioConfig(8, 26, 0x87C, 61, GpioEnum.GPIO_61)); case GpioEnum.GPIO_86: return(new GpioConfig(8, 27, 0x8E0, 86, GpioEnum.GPIO_86)); case GpioEnum.GPIO_88: return(new GpioConfig(8, 28, 0x8E8, 88, GpioEnum.GPIO_88)); case GpioEnum.GPIO_87: return(new GpioConfig(8, 29, 0x8E4, 87, GpioEnum.GPIO_87)); case GpioEnum.GPIO_89: return(new GpioConfig(8, 30, 0x8EC, 89, GpioEnum.GPIO_89)); case GpioEnum.GPIO_10: return(new GpioConfig(8, 31, 0x8D8, 10, GpioEnum.GPIO_10)); case GpioEnum.GPIO_11: return(new GpioConfig(8, 32, 0x8DC, 11, GpioEnum.GPIO_11)); case GpioEnum.GPIO_9: return(new GpioConfig(8, 33, 0x8D4, 9, GpioEnum.GPIO_9)); case GpioEnum.GPIO_81: return(new GpioConfig(8, 34, 0x8CC, 81, GpioEnum.GPIO_81)); case GpioEnum.GPIO_8: return(new GpioConfig(8, 35, 0x8D0, 8, GpioEnum.GPIO_8)); case GpioEnum.GPIO_80: return(new GpioConfig(8, 36, 0x8C8, 80, GpioEnum.GPIO_80)); case GpioEnum.GPIO_78: return(new GpioConfig(8, 37, 0x8C0, 78, GpioEnum.GPIO_78)); case GpioEnum.GPIO_79: return(new GpioConfig(8, 38, 0x8C4, 79, GpioEnum.GPIO_79)); case GpioEnum.GPIO_76: return(new GpioConfig(8, 39, 0x8B8, 76, GpioEnum.GPIO_76)); case GpioEnum.GPIO_77: return(new GpioConfig(8, 40, 0x8BC, 77, GpioEnum.GPIO_77)); case GpioEnum.GPIO_74: return(new GpioConfig(8, 41, 0x8B0, 74, GpioEnum.GPIO_74)); case GpioEnum.GPIO_75: return(new GpioConfig(8, 42, 0x8B4, 75, GpioEnum.GPIO_75)); case GpioEnum.GPIO_72: return(new GpioConfig(8, 43, 0x8A8, 72, GpioEnum.GPIO_72)); case GpioEnum.GPIO_73: return(new GpioConfig(8, 44, 0x8AC, 73, GpioEnum.GPIO_73)); case GpioEnum.GPIO_70: return(new GpioConfig(8, 45, 0x8A0, 70, GpioEnum.GPIO_70)); case GpioEnum.GPIO_71: return(new GpioConfig(8, 46, 0x8A4, 71, GpioEnum.GPIO_71)); case GpioEnum.GPIO_30: return(new GpioConfig(9, 11, 0x870, 30, GpioEnum.GPIO_30)); case GpioEnum.GPIO_60: return(new GpioConfig(9, 12, 0x878, 60, GpioEnum.GPIO_60)); case GpioEnum.GPIO_31: return(new GpioConfig(9, 13, 0x874, 31, GpioEnum.GPIO_31)); case GpioEnum.GPIO_50: return(new GpioConfig(9, 14, 0x848, 50, GpioEnum.GPIO_50)); case GpioEnum.GPIO_48: return(new GpioConfig(9, 15, 0x840, 48, GpioEnum.GPIO_48)); case GpioEnum.GPIO_51: return(new GpioConfig(9, 16, 0x84C, 51, GpioEnum.GPIO_51)); case GpioEnum.GPIO_5: return(new GpioConfig(9, 17, 0x95C, 5, GpioEnum.GPIO_5)); case GpioEnum.GPIO_4: return(new GpioConfig(9, 18, 0x958, 4, GpioEnum.GPIO_4)); case GpioEnum.GPIO_13: return(new GpioConfig(9, 19, 0x97C, 13, GpioEnum.GPIO_13)); case GpioEnum.GPIO_12: return(new GpioConfig(9, 20, 0x978, 12, GpioEnum.GPIO_12)); case GpioEnum.GPIO_3: return(new GpioConfig(9, 21, 0x954, 3, GpioEnum.GPIO_3)); case GpioEnum.GPIO_2: return(new GpioConfig(9, 22, 0x950, 2, GpioEnum.GPIO_2)); case GpioEnum.GPIO_49: return(new GpioConfig(9, 23, 0x844, 49, GpioEnum.GPIO_49)); case GpioEnum.GPIO_15: return(new GpioConfig(9, 24, 0x984, 15, GpioEnum.GPIO_15)); case GpioEnum.GPIO_117: return(new GpioConfig(9, 25, 0x9AC, 117, GpioEnum.GPIO_117)); case GpioEnum.GPIO_14: return(new GpioConfig(9, 26, 0x980, 14, GpioEnum.GPIO_14)); case GpioEnum.GPIO_115: return(new GpioConfig(9, 27, 0x9A4, 115, GpioEnum.GPIO_115)); case GpioEnum.GPIO_113: return(new GpioConfig(9, 28, 0x99C, 113, GpioEnum.GPIO_113)); case GpioEnum.GPIO_111: return(new GpioConfig(9, 29, 0x994, 111, GpioEnum.GPIO_111)); case GpioEnum.GPIO_112: return(new GpioConfig(9, 30, 0x998, 112, GpioEnum.GPIO_112)); case GpioEnum.GPIO_110: return(new GpioConfig(9, 31, 0x990, 110, GpioEnum.GPIO_110)); case GpioEnum.GPIO_20: return(new GpioConfig(9, 41, 0x9B4, 20, GpioEnum.GPIO_20)); case GpioEnum.GPIO_7: return(new GpioConfig(9, 42, 0x964, 7, GpioEnum.GPIO_7)); default: return(new GpioConfig()); } }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <history> /// 28 Aug 14 Cynic - Originally written /// </history> public Port(GpioEnum gpioIDIn) { // set our GpioConfig object now gpioCfgObject = GpioUtils.GetGpioConfigForGpio(gpioIDIn); }
/// +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= /// <summary> /// Constructor /// </summary> /// <param name="gpioIDIn">The gpio we open the port on</param> /// <history> /// 01 Dec 16 Cynic - Originally written /// </history> public PortMM(GpioEnum gpioIDIn) : base(gpioIDIn) { // open the memory maps. MMDevMem.OpenMemoryMaps(); }