示例#1
0
        /**********************************************************************************************/
        public static void Disable_Event_Detection(uint pin, Event_Detect_Type EvType)
        {
            if (gpioAddress.ToInt32() == -1)
            {
                return;
            }

            lock (lockObj)
            {
                // DataSheet BCM 2835 ARM peripherals, page 97-100
                IntPtr RegisterAddress = gpioAddress + (int)EvType + 4 * ((int)pin / 32);
                int    val             = Marshal.ReadInt32(RegisterAddress);
                Marshal.WriteInt32(RegisterAddress, val & ~(1 << ((int)pin % 32)));
            }
        }
示例#2
0
        /**********************************************************************************************/
        public static void Enable_Event_Detection(uint pin, Event_Detect_Type EvType)
        {
            if (gpioAddress.ToInt32() == -1)
            {
                return;
            }

            lock (lockObj)
            {
                if (!_In.Contains(pin))    // configuration already done in input mode ?
                {
                    SetupPin(pin, 0);
                    _In.Add(pin); _Out.Remove(pin);
                }

                // DataSheet BCM 2835 ARM peripherals, page 97-100
                IntPtr RegisterAddress = gpioAddress + (int)EvType + 4 * ((int)pin / 32);
                int    val             = Marshal.ReadInt32(RegisterAddress);
                Marshal.WriteInt32(RegisterAddress, val | (1 << ((int)pin % 32)));
            }
        }