pub fn set_kind(_core: Cpu, which: CpuInterrupt, kind: InterruptKind) {
        let interrupt_type = match kind {
            InterruptKind::Level => 0,
            InterruptKind::Edge => 1,
        };

        unsafe {
            PLIC_MX::regs().mxint_type().modify(|r, w| {
                let old = r.cpu_mxint_type().bits();
                let new = old & !(1 << (which as isize)) | (interrupt_type << (which as isize));
                w.cpu_mxint_type().bits(new)
            });
        }
    }
Set the interrupt kind (i.e. level or edge) of an CPU interrupt

The vectored interrupt handler will take care of clearing edge interrupt
bits.
esp-hal/src/interrupt/riscv.rs