Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
codev123 opened this issue May 24, 2024 · 0 comments
Open

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

codev123 opened this issue May 24, 2024 · 0 comments
Assignees

Comments

@codev123
Copy link

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

@fpistm fpistm self-assigned this Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants