code: func DetectEdge(pin Pin, edge Edge) {
  	if edge != NoEdge {
  		// disable GPIO event interruption to prevent freezing in some cases
  		DisableIRQs(1<<49 | 1<<52) // gpio_int[0] and gpio_int[3]
  	}
  
  	p := uint8(pin)
  
  	// Rising edge detect enable register (19/20 depending on bank)
  	// Falling edge detect enable register (22/23 depending on bank)
  	// Event detect status register (16/17)
  	renReg := p/32 + 19
  	fenReg := p/32 + 22
  	edsReg := p/32 + 16
  
  	bit := uint32(1 << (p & 31))
  
  	if edge&RiseEdge > 0 { // set bit
  		gpioMem[renReg] |= bit
  	} else { // clear bit
  		gpioMem[renReg] &^= bit
  	}
  	if edge&FallEdge > 0 { // set bit
  		gpioMem[fenReg] |= bit
  	} else { // clear bit
  		gpioMem[fenReg] &^= bit
  	}
  
  	gpioMem[edsReg] = bit // to clear outdated detection
  }
docs: // DetectEdge: Enable edge event detection on pin.
  //
  // Combine with pin.EdgeDetected() to check whether event occured.
  //
  // Note that using this function might conflict with the same functionality of other gpio library.
  //
  // It also clears previously detected event of this pin if there was any.
  //
  // Note that call with RiseEdge will disable previously set FallEdge detection and vice versa.
  // You have to call with AnyEdge, to enable detection for both edges.
  // To disable previously enabled detection call it with NoEdge.
  //
  // WARNING: this might make your Pi unresponsive, if this happens, you should either run the code as root,
  // or add `dtoverlay=gpio-no-irq` to `/boot/config.txt` and restart your pi,