Update LP API

Signed-off-by: Sadik.Ozer <Sadik.Ozer@maximintegrated.com>
pull/15263/head
Sadik.Ozer 2022-03-18 13:15:13 +03:00
parent 92983653ed
commit 7826582e44
2 changed files with 16 additions and 14 deletions

View File

@ -207,18 +207,18 @@ void MXC_LP_ClearWakeStatus (void);
* @brief Enables the selected GPIO port and its selected pins to wake up the device from any low power mode. * @brief Enables the selected GPIO port and its selected pins to wake up the device from any low power mode.
* Call this function multiple times to enable pins on multiple ports. This function does not configure * Call this function multiple times to enable pins on multiple ports. This function does not configure
* the GPIO pins nor does it setup their interrupt functionality. * the GPIO pins nor does it setup their interrupt functionality.
* @param wu_pins The port and pins to configure as wakeup sources. Only the gpio and mask fields of the * @param port The port to configure as wakeup sources.
* structure are used. The func and pad fields are ignored. \ref mxc_gpio_cfg_t * @param mask The pins to configure as wakeup sources.
*/ */
void MXC_LP_EnableGPIOWakeup (mxc_gpio_cfg_t *wu_pins); void MXC_LP_EnableGPIOWakeup(unsigned int port, unsigned int mask);
/** /**
* @brief Disables the selected GPIO port and its selected pins as a wake up source. * @brief Disables the selected GPIO port and its selected pins as a wake up source.
* Call this function multiple times to disable pins on multiple ports. * Call this function multiple times to disable pins on multiple ports.
* @param wu_pins The port and pins to disable as wakeup sources. Only the gpio and mask fields of the * @param port The port to configure as wakeup sources.
* structure are used. The func and pad fields are ignored. \ref mxc_gpio_cfg_t * @param mask The pins to configure as wakeup sources.
*/ */
void MXC_LP_DisableGPIOWakeup (mxc_gpio_cfg_t *wu_pins); void MXC_LP_DisableGPIOWakeup (unsigned int port, unsigned int mask);
/** /**
* @brief Enables the RTC alarm to wake up the device from any low power mode. * @brief Enables the RTC alarm to wake up the device from any low power mode.

View File

@ -187,29 +187,31 @@ void MXC_LP_ClearWakeStatus(void)
MXC_PWRSEQ->lppwkst = 0xFFFFFFFF; MXC_PWRSEQ->lppwkst = 0xFFFFFFFF;
} }
void MXC_LP_EnableGPIOWakeup(mxc_gpio_cfg_t* wu_pins) void MXC_LP_EnableGPIOWakeup(unsigned int port, unsigned int mask)
{ {
MXC_GCR->pm |= MXC_F_GCR_PM_GPIO_WE; MXC_GCR->pm |= MXC_F_GCR_PM_GPIO_WE;
switch (1 << MXC_GPIO_GET_IDX(wu_pins->port)) { switch (1 << port) {
case MXC_GPIO_PORT_0: case MXC_GPIO_PORT_0:
MXC_PWRSEQ->lpwken0 |= wu_pins->mask; MXC_PWRSEQ->lpwken0 |= mask;
break; break;
case MXC_GPIO_PORT_1: case MXC_GPIO_PORT_1:
MXC_PWRSEQ->lpwken1 |= wu_pins->mask; MXC_PWRSEQ->lpwken1 |= mask;
break;
} }
} }
void MXC_LP_DisableGPIOWakeup(mxc_gpio_cfg_t* wu_pins) void MXC_LP_DisableGPIOWakeup(unsigned int port, unsigned int mask)
{ {
switch (1 << MXC_GPIO_GET_IDX(wu_pins->port)) { switch (1 << port) {
case MXC_GPIO_PORT_0: case MXC_GPIO_PORT_0:
MXC_PWRSEQ->lpwken0 &= ~wu_pins->mask; MXC_PWRSEQ->lpwken0 &= ~mask;
break; break;
case MXC_GPIO_PORT_1: case MXC_GPIO_PORT_1:
MXC_PWRSEQ->lpwken1 &= ~wu_pins->mask; MXC_PWRSEQ->lpwken1 &= ~mask;
break;
} }
if (MXC_PWRSEQ->lpwken1 == 0 && MXC_PWRSEQ->lpwken0 == 0) { if (MXC_PWRSEQ->lpwken1 == 0 && MXC_PWRSEQ->lpwken0 == 0) {