HVAC_M7_SMC/standby.c

35 lines
868 B
C

//
// Created by cfif on 17.12.2025.
//
#include "standby.h"
static void Bsp_GpioFInt_CallbackFunction(void) {
__asm volatile ("nop");
}
void StandBy_Init() {
PORT_InitType tInitStruct = {0};
PORT_InterruptType tIntStruct = {0};
// wakeup source: Key1/PortE16; MUX = GPIO input
tInitStruct.u32PortPins = PORT_PIN_16;
tInitStruct.uPortPinMux.u32PortPinMode = PORT_GPIO_MODE;
tInitStruct.bPullEn = true;
tInitStruct.ePullSel = PORT_PULL_UP;
PORT_InitPins(PORT_E, &tInitStruct);
// enable PortE16 interrupt
tIntStruct.u32PortPins = PORT_PIN_16;
tIntStruct.ePortIsrMode = PORT_IRQ_BOTH_EDGE;
tIntStruct.pIsrNotify = Bsp_GpioFInt_CallbackFunction;
PORT_InitInterrupt(PORT_E, &tIntStruct);
WKU_EnableWakeupSource(WKU_INPUT_GPIOE);
NVIC_SetPriority(PORTE_IRQn, 0xFF);
NVIC_EnableIRQ(PORTE_IRQn);
}