34 lines
885 B
C
34 lines
885 B
C
//
|
|
// Created by cfif on 17.12.2025.
|
|
//
|
|
|
|
#include "standby.h"
|
|
|
|
|
|
static void Bsp_GpioFInt_CallbackFunction(void) {
|
|
SMC_SetSystemMode(SMC_MODE_RUN);
|
|
}
|
|
|
|
void StandBy_Init(tStandBy *env) {
|
|
PORT_InitType tInitStruct = {0};
|
|
PORT_InterruptType tIntStruct = {0};
|
|
|
|
// wakeup source: Key1/PortA9; MUX = GPIO input
|
|
tInitStruct.u32PortPins = PORT_PIN_9;
|
|
tInitStruct.uPortPinMux.u32PortPinMode = PORT_GPIO_MODE;
|
|
tInitStruct.bPullEn = true;
|
|
tInitStruct.ePullSel = PORT_PULL_UP;
|
|
PORT_InitPins(PORT_A, &tInitStruct);
|
|
|
|
// enable PortA9 interrupt
|
|
tIntStruct.u32PortPins = PORT_PIN_9;
|
|
tIntStruct.ePortIsrMode = PORT_IRQ_BOTH_EDGE;
|
|
tIntStruct.pIsrNotify = Bsp_GpioFInt_CallbackFunction;
|
|
PORT_InitInterrupt(PORT_A, &tIntStruct);
|
|
|
|
WKU_EnableWakeupSource(WKU_INPUT_GPIOA);
|
|
|
|
NVIC_SetPriority(PORTA_IRQn, 0xFF);
|
|
NVIC_EnableIRQ(PORTA_IRQn);
|
|
|
|
} |