How to add minimum time width Rising Edge interrupt Mega2560

  1. I am using atmega2560 & configured rising edge interrupt by below code. Normally pulse is low, & it gives a pulse of minimum 10ms whenever event occurs. Have to reject any rising edge if pulse width is less than 10ms.

const byte interruptPin = 2;

void setup()
{
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), isr_func, RISING);
}

  1. Is there any arduino function for it? Or how to do it arduino?

Have you looked at the pulseIn function? No interrupt required (and don't use it inside a interrupt service routine as it's blocking).

If you need none-blocking, use CHANGE instead of RISING. Read the pin in the isr, if high it indicates a rising edge, if low it indicates a falling edge. You can measure the time difference using e.g. millis() and store in a volatile variable that you can inspect in loop().

Vindhyachal_Takniki:
Have to reject any rising edge if pulse width is less than 10ms.

I am assuming you mean that you wish to ignore a LOW that is less than 10msecs and that the HIGH can be any width. If not, please correct me.

To do what I described requires you to take the time when the signal goes from HIGH to LOW and again when it goes from LOW to HIGH so as to measure the time when the pulse was LOW.

If you provide a full description of the project you are working on there may be other options. At the moment this is an XY problem

...R