stm32duino / STM32LowPower

Arduino Low Power library for STM32
183 stars 52 forks source link

enable and disable wakeup from wakeup pin interrupt mode. #109

Open codev123 opened 3 months ago

codev123 commented 3 months ago

thank you sir for the amazing work, this is rather a request. I am currenty working on a project, where my STM32L0 should wake up from timed alarm and wakeup pin interrupt also. the issue i am facing, i want to disable pin interrupt for some time once the pin interrupt occured, i tried detaching and attaching interrupt, detaching interrupt just disable the ISR code run but controller still wakeup from sleep. i have also disabled wake up but still controller wakeup from pin interrupt. setup code

// Configure low power
  LowPower.begin();
  LowPower.attachInterruptWakeup(ovfPin, serviceOVFInterrupt, FALLING, DEEP_SLEEP_MODE);

ISR Code

void serviceOVFInterrupt() {
  transmitFlag = false;
  sensorActive = true;
  firstInterruptOccurred = true;
  HAL_PWR_DisableWakeUpPin(ovfPin);
  detachInterrupt(ovfPin);
  //__HAL_GPIO_EXTI_CLEAR_IT(ovfPin);
  disableInterruptStartTime = millis();
  DEBUG_PRINTLN("Service ISR task and detach time :" + String(disableInterruptStartTime));
}

loop code:

if (firstInterruptOccurred && (millis() - disableInterruptStartTime >= 3000)) {
    LowPower.attachInterruptWakeup(ovfPin, serviceOVFInterrupt, FALLING, DEEP_SLEEP_MODE);
    DEBUG_PRINTLN("Service ISR task and attach time :" + String(millis()));
    firstInterruptOccurred = false;
    disableInterruptStartTime = 0;
  }

I think library should give user a function to disable interrupt to disable and enable sleep wake capability. Please help me understand how can i do it sir. thank you sir