本文整理汇总了C++中sleepmgr_unlock_mode函数的典型用法代码示例。如果您正苦于以下问题:C++ sleepmgr_unlock_mode函数的具体用法?C++ sleepmgr_unlock_mode怎么用?C++ sleepmgr_unlock_mode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sleepmgr_unlock_mode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: run_set_functions_test
/**
* \brief Test different parameters of the Sleep Manager module
*
* This function locks & unlocks the different sleep modes, and verifies that
* the correct values are being set.
*
* \param test Current test case.
*/
static void run_set_functions_test(const struct test_case *test)
{
volatile enum sleepmgr_mode sleep_mode;
/* Initialize the lock counts */
sleepmgr_init();
/* Lock Power Down mode */
sleepmgr_lock_mode(SLEEPMGR_PDOWN);
/* get the deepest allowable sleep mode */
sleep_mode = sleepmgr_get_sleep_mode();
test_assert_true(test, sleep_mode == SLEEPMGR_PDOWN,
"Trying to lock Power Down mode failed.");
/* Lock Power Save mode */
sleepmgr_lock_mode(SLEEPMGR_PSAVE);
/* get the deepest allowable sleep mode */
sleep_mode = sleepmgr_get_sleep_mode();
test_assert_true(test, sleep_mode == SLEEPMGR_PSAVE,
"Trying to lock Power Save mode failed.");
/* Lock Idle Sleep mode */
sleepmgr_lock_mode(SLEEPMGR_IDLE);
/* get the deepest allowable sleep mode */
sleep_mode = sleepmgr_get_sleep_mode();
test_assert_true(test, sleep_mode == SLEEPMGR_IDLE,
"Trying to lock Idle Sleep mode failed.");
/* Unlock Idle Sleep mode */
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
/* get the deepest allowable sleep mode */
sleep_mode = sleepmgr_get_sleep_mode();
test_assert_true(test, sleep_mode == SLEEPMGR_PSAVE,
"Trying to unlock Idle Sleep mode failed.");
/* Unlock Power Save mode */
sleepmgr_unlock_mode(SLEEPMGR_PSAVE);
/* get the deepest allowable sleep mode */
sleep_mode = sleepmgr_get_sleep_mode();
test_assert_true(test, sleep_mode == SLEEPMGR_PDOWN,
"Trying to unlock Power Save Sleep mode failed.");
/* Unlock Power Down mode */
sleepmgr_unlock_mode(SLEEPMGR_PDOWN);
/* get the deepest allowable sleep mode */
sleep_mode = sleepmgr_get_sleep_mode();
test_assert_true(test, sleep_mode == (SLEEPMGR_NR_OF_MODES - 1),
"Trying to unlock Power Down mode failed.");
}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:57,代码来源:unit_tests.c
示例2: udd_disable
void udd_disable(void)
{
irqflags_t flags;
#ifdef UHD_ENABLE
# ifdef USB_ID
if (Is_otg_id_host()) {
return; // Host mode running, ignore UDD disable
}
# else
if (Is_otg_host_mode_forced()) {
return; // Host mode running, ignore UDD disable
}
# endif
#endif
flags = cpu_irq_save();
otg_unfreeze_clock();
udd_detach();
#ifndef UDD_NO_SLEEP_MGR
sleepmgr_unlock_mode(USBB_SLEEP_MODE_USB_SUSPEND);
#endif
#ifndef UHD_ENABLE
otg_disable();
otg_disable_pad();
sysclk_disable_usb();
// Else the USB clock disable is done by UHC which manage USB dual role
#endif
cpu_irq_restore(flags);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:31,代码来源:usbb_device.c
示例3: twis_disable
/**
* \brief Disable TWIS Module.
*
* \param dev_inst Device structure pointer
*/
void twis_disable(struct twis_dev_inst *const dev_inst)
{
Assert(dev_inst->hw_dev);
dev_inst->hw_dev->TWIS_CR &= ~TWIS_CR_SEN;
sleepmgr_unlock_mode(SLEEPMGR_SLEEP_1);
}
开发者ID:70year,项目名称:MICO,代码行数:12,代码来源:twis.c
示例4: tc_disable
/**
* \brief Disable TC
*
* Disables the TC.
*
* \param tc Pointer to TC module
*
* \note
* mask TC clock (sysclk).
*/
void tc_disable(volatile void *tc)
{
irqflags_t iflags = cpu_irq_save();
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
#ifdef TCC0
if ((uintptr_t) tc == (uintptr_t) & TCC0) {
sysclk_disable_module(SYSCLK_PORT_C, SYSCLK_TC0);
sysclk_disable_module(SYSCLK_PORT_C, SYSCLK_HIRES);
} else
#endif
#ifdef TCC1
if ((uintptr_t) tc == (uintptr_t) & TCC1) {
sysclk_disable_module(SYSCLK_PORT_C, SYSCLK_TC1);
sysclk_disable_module(SYSCLK_PORT_C, SYSCLK_HIRES);
} else
#endif
#ifdef TCD0
if ((uintptr_t) tc == (uintptr_t) & TCD0) {
sysclk_disable_module(SYSCLK_PORT_D, SYSCLK_TC0);
sysclk_disable_module(SYSCLK_PORT_D, SYSCLK_HIRES);
} else
#endif
#ifdef TCD1
if ((uintptr_t) tc == (uintptr_t) & TCD1) {
sysclk_disable_module(SYSCLK_PORT_D, SYSCLK_TC1);
sysclk_disable_module(SYSCLK_PORT_D, SYSCLK_HIRES);
} else
#endif
#ifdef TCE0
if ((uintptr_t) tc == (uintptr_t) & TCE0) {
sysclk_disable_module(SYSCLK_PORT_E, SYSCLK_TC0);
sysclk_disable_module(SYSCLK_PORT_E, SYSCLK_HIRES);
} else
#endif
#ifdef TCE1
if ((uintptr_t) tc == (uintptr_t) & TCE1) {
sysclk_disable_module(SYSCLK_PORT_E, SYSCLK_TC1);
sysclk_disable_module(SYSCLK_PORT_E, SYSCLK_HIRES);
} else
#endif
#ifdef TCF0
if ((uintptr_t) tc == (uintptr_t) & TCF0) {
sysclk_disable_module(SYSCLK_PORT_F, SYSCLK_TC0);
sysclk_disable_module(SYSCLK_PORT_F, SYSCLK_HIRES);
} else
#endif
#ifdef TCF1
if ((uintptr_t) tc == (uintptr_t) & TCF1) {
sysclk_disable_module(SYSCLK_PORT_F, SYSCLK_TC1);
sysclk_disable_module(SYSCLK_PORT_F, SYSCLK_HIRES);
} else
#endif
{
cpu_irq_restore(iflags);
return;
}
cpu_irq_restore(iflags);
}
开发者ID:KN2C-CanSat,项目名称:KN2CSat,代码行数:70,代码来源:tc.c
示例5: ac_disable
/**
* \brief Disable an analog comparator channel
*
* \param ac Pointer to the analog comparator (AC) base address
* \param channel Number of analog comparator (AC) channel to disable
*/
void ac_disable(AC_t *ac, uint8_t channel)
{
irqflags_t iflags = cpu_irq_save();
if (channel == 0) {
ac->AC0CTRL &= ~AC_ENABLE_bm;
} else {
ac->AC1CTRL &= ~AC_ENABLE_bm;
}
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
#ifdef ACA
if ((uintptr_t)ac == (uintptr_t)&ACA) {
ac_aca_opened--;
if (!ac_aca_opened) {
sysclk_disable_module(SYSCLK_PORT_A, SYSCLK_AC);
}
} else
#endif
#ifdef ACB
if ((uintptr_t)ac == (uintptr_t)&ACB) {
ac_acb_opened--;
if (!ac_acb_opened) {
sysclk_disable_module(SYSCLK_PORT_B, SYSCLK_AC);
}
} else
#endif
{
cpu_irq_restore(iflags);
return;
}
cpu_irq_restore(iflags);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:41,代码来源:ac.c
示例6: tc45_disable
/**
* \brief Disable TC45
*
* Disables the TC45.
*
* \param tc Pointer to TC45 module
*
* \note
* mask TC45 clock (sysclk).
*/
void tc45_disable(volatile void *tc)
{
irqflags_t iflags = cpu_irq_save();
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
#ifdef TCC4
if ((uintptr_t)tc == (uintptr_t)&TCC4) {
sysclk_disable_module(SYSCLK_PORT_C, SYSCLK_TC4);
sysclk_disable_module(SYSCLK_PORT_C, SYSCLK_HIRES);
} else
#endif
#ifdef TCC5
if ((uintptr_t)tc == (uintptr_t)&TCC5) {
sysclk_disable_module(SYSCLK_PORT_C, SYSCLK_TC5);
sysclk_disable_module(SYSCLK_PORT_C, SYSCLK_HIRES);
} else
#endif
#ifdef TCD5
if ((uintptr_t)tc == (uintptr_t)&TCD5) {
sysclk_disable_module(SYSCLK_PORT_D, SYSCLK_TC4);
sysclk_disable_module(SYSCLK_PORT_D, SYSCLK_HIRES);
} else
#endif
{
cpu_irq_restore(iflags);
return;
}
cpu_irq_restore(iflags);
}
开发者ID:csc13,项目名称:spektel-sensor,代码行数:40,代码来源:tc45.c
示例7: run_sleep_trigger_test
/**
* \brief Test interrupt is getting triggered in various Sleep mode.
*
* This function put the device in Idle and Power Save sleep mode and check
* whether the ADC conversion complete interrupt is executed only in Idle sleep
* mode.
* The device will wakeup from power save mode when Timer/Counter2 overflow
* occur.
*
* \param test Current test case.
*/
static void run_sleep_trigger_test(const struct test_case *test)
{
/* Disable Global interrupt */
cpu_irq_disable();
/* Initialize the lock counts */
sleepmgr_init();
/* Initialize the ADC */
adc_initialisation();
/* Initialize the Timer/Counter2 */
timer2_initialisation();
/* Lock Idle Sleep mode */
sleepmgr_lock_mode(SLEEPMGR_IDLE);
/* Clear Timer/Counter2 Register */
TCNT2 = 0;
/* Wait for TCNT2 register to get updated */
while (ASSR & (1 << TCN2UB)) {
}
/* Start ADC Conversion */
adc_start_conversion();
/* Enable Global interrupt */
cpu_irq_enable();
/* Go to sleep in the deepest allowed mode */
sleepmgr_enter_sleep();
/* Unlock Idle Sleep mode */
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
/* Lock Power Save mode */
sleepmgr_lock_mode(SLEEPMGR_PSAVE);
/* Clear Timer/Counter2 Register */
TCNT2 = 0;
/* Wait for TCNT2 register to get updated */
while (ASSR & (1 << TCN2UB)) {
}
/* Start ADC Conversion */
adc_start_conversion();
/* Go to sleep in the deepest allowed mode */
sleepmgr_enter_sleep();
/* Disable ADC */
adc_disable();
/* Unlock Power Save mode */
sleepmgr_unlock_mode(SLEEPMGR_PSAVE);
/* Disable Global interrupt */
cpu_irq_disable();
test_assert_true(test, trigger_count == 2,
"ADC interrupt trigger failed.");
}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:58,代码来源:unit_tests.c
示例8: adc_disable
/**
* \brief Disable ADC
*
* Disables the ADC and unlocks IDLE mode for the sleep manager.
*
* \param adc Pointer to ADC module
*/
void adc_disable(ADC_t *adc)
{
irqflags_t flags = cpu_irq_save();
adc->CTRLA &= ~ADC_ENABLE_bm;
adc_disable_clock(adc);
cpu_irq_restore(flags);
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
}
开发者ID:cedcompeng,项目名称:cedscope,代码行数:16,代码来源:adc.c
示例9: dac_disable
/**
* \brief Disable DAC
*
* Disables the DAC, stopping all conversions.
*
* \param dac Pointer to DAC module.
*/
void dac_disable(DAC_t *dac)
{
irqflags_t flags;
flags = cpu_irq_save();
dac->CTRLA &= ~DAC_ENABLE_bm;
dac_disable_clock(dac);
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
cpu_irq_restore(flags);
}
开发者ID:electro-logic,项目名称:ASF-components,代码行数:17,代码来源:dac.c
示例10: udd_sleep_mode
/*! \brief Authorize or not the CPU powerdown mode
*
* \param b_enable true to authorize powerdown mode
*/
static void udd_sleep_mode(bool b_idle)
{
if (!b_idle && udd_b_idle) {
sleepmgr_unlock_mode(USBB_SLEEP_MODE_USB_IDLE);
}
if (b_idle && !udd_b_idle) {
sleepmgr_lock_mode(USBB_SLEEP_MODE_USB_IDLE);
}
udd_b_idle = b_idle;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:14,代码来源:usbb_device.c
示例11: udd_vbus_monitor_sleep_mode
/**
* Lock sleep mode for VBus PIO pin change detection
*/
static void udd_vbus_monitor_sleep_mode(bool b_lock)
{
if (b_lock && !b_vbus_sleep_lock) {
b_vbus_sleep_lock = true;
sleepmgr_lock_mode(SLEEPMGR_SLEEP_WFI);
}
if (!b_lock && b_vbus_sleep_lock) {
b_vbus_sleep_lock = false;
sleepmgr_unlock_mode(SLEEPMGR_SLEEP_WFI);
}
}
开发者ID:AshitakaLax,项目名称:Ultimate_Developer_Keyboard,代码行数:14,代码来源:udp_device.c
示例12: edma_disable
/**
* \brief Disable EDMA controller
*
* \note This function disables the EDMA controller, clearing all previous
* configurations.
*/
void edma_disable(void)
{
/* Disable */
EDMA.CTRL = 0x00;
/* Wait for effective operation */
while (EDMA.CTRL & EDMA_ENABLE_bm) {
}
/* Reset all fields */
EDMA.CTRL = 0x00;
sysclk_disable_module(SYSCLK_PORT_GEN, SYSCLK_EDMA);
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:19,代码来源:edma.c
示例13: udd_disable
void udd_disable(void)
{
irqflags_t flags;
flags = cpu_irq_save();
// Disable USB pad
otg_disable();
otg_disable_pad();
sysclk_disable_usb();
udd_sleep_mode(false);
#ifndef UDD_NO_SLEEP_MGR
sleepmgr_unlock_mode(USBB_SLEEP_MODE_USB_SUSPEND);
#endif
cpu_irq_restore(flags);
}
开发者ID:12019,项目名称:USB-Rubber-Ducky,代码行数:14,代码来源:usbb_device.c
示例14: udd_disable
void udd_disable(void)
{
irqflags_t flags;
flags = cpu_irq_save();
udd_detach_device();
// Disable interface
USB_CTRLA = 0;
USB_CTRLB = 0;
sysclk_disable_usb();
udd_sleep_mode(false);
#ifndef UDD_NO_SLEEP_MGR
sleepmgr_unlock_mode(USBC_SLEEP_MODE_USB_SUSPEND);
#endif
cpu_irq_restore(flags);
}
开发者ID:aero530,项目名称:Robit_xMega,代码行数:15,代码来源:usb_device.c
示例15: main
/** \brief Main function.
*/
int main(void)
{
/* Set the sleep mode to initially lock. */
volatile enum sleepmgr_mode mode = SLEEPMGR_ACTIVE;
/* Initialize the pins for input and output. */
board_init();
/* Initialize the clock and disable clock unused modules */
sysclk_init();
/* Initialize the IOPORT */
ioport_init();
delay_init(sysclk_get_cpu_hz());
/* Set the pin sense mode */
ioport_set_pin_sense_mode(BUTTON_PIN, IOPORT_SENSE_LEVEL);
/* Enable external interrupt */
external_interrupt_enable(BUTTON_NUMBER);
/* Turn off the LED */
LED_On(LED_PIN);
/* Initialize the sleep manager, lock initial mode. */
sleepmgr_init();
sleepmgr_lock_mode(mode);
Enable_global_interrupt();
do {
/* Delay for 3 seconds to show the device is awake. */
delay_ms(3000);
/* Turn off the LED and go to sleep. */
LED_Off(LED_PIN);
sleepmgr_enter_sleep();
/* Turn on the LED on wake up */
LED_On(LED_PIN);
/* Unlock current mode, then lock the next one. */
sleepmgr_unlock_mode(mode);
if (++mode < SLEEPMGR_NR_OF_MODES) {
sleepmgr_lock_mode(mode);
} else {
mode = SLEEPMGR_ACTIVE;
sleepmgr_lock_mode(mode);
}
} while (1);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:50,代码来源:sleepmgr_example_megarf.c
示例16: lowpower_interrupt
/**
* \brief RTC compare ISR
*
* This function updates the sleep mode locks so that the device cycles through
* the different sleep modes.
*/
static void lowpower_interrupt(void)
{
static uint8_t state = 0;
switch (state) {
/* The device starts out in active mode. Go to Idle. */
default:
case 0:
sleepmgr_unlock_mode(SLEEPMGR_ACTIVE);
sleepmgr_lock_mode(SLEEPMGR_IDLE);
++state;
break;
/* Go to extended Standby */
case 1:
sleepmgr_unlock_mode(SLEEPMGR_IDLE);
sleepmgr_lock_mode(SLEEPMGR_ESTDBY);
++state;
break;
/* Go to power save */
case 2:
sleepmgr_unlock_mode(SLEEPMGR_ESTDBY);
sleepmgr_lock_mode(SLEEPMGR_PSAVE);
++state;
break;
/* Go to standby */
case 3:
sleepmgr_unlock_mode(SLEEPMGR_PSAVE);
sleepmgr_lock_mode(SLEEPMGR_STDBY);
++state;
break;
/* Go to power down */
case 4:
sleepmgr_unlock_mode(SLEEPMGR_STDBY);
sleepmgr_lock_mode(SLEEPMGR_PDOWN);
++state;
break;
/* Go back to idle */
case 5:
sleepmgr_unlock_mode(SLEEPMGR_PDOWN);
sleepmgr_lock_mode(SLEEPMGR_IDLE);
state = 1;
break;
}
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:55,代码来源:low_power_demo.c
示例17: udd_disable
void udd_disable(void)
{
irqflags_t flags;
flags = cpu_irq_save();
udd_detach();
udd_disable_periph_ck();
sysclk_disable_usb();
#ifndef UDD_NO_SLEEP_MGR
sleepmgr_unlock_mode(UDP_SLEEP_MODE_USB_SUSPEND);
#endif
# if UDD_VBUS_IO
udd_vbus_monitor_sleep_mode(false);
# endif
cpu_irq_restore(flags);
}
开发者ID:AshitakaLax,项目名称:Ultimate_Developer_Keyboard,代码行数:20,代码来源:udp_device.c
示例18: udd_sleep_mode
/** \brief Manages the sleep mode following the USB state
*
* \param new_state New USB state
*/
static void udd_sleep_mode(enum udd_usb_state_enum new_state)
{
enum sleepmgr_mode sleep_mode[] = {
SLEEPMGR_ACTIVE, /* UDD_STATE_OFF (not used) */
SLEEPMGR_IDLE_2, /* UDD_STATE_SUSPEND */
SLEEPMGR_IDLE_1, /* UDD_STATE_SUSPEND_LPM */
SLEEPMGR_IDLE_0, /* UDD_STATE_IDLE */
};
static enum udd_usb_state_enum udd_state = UDD_STATE_OFF;
if (udd_state == new_state) {
return; // No change
}
if (new_state != UDD_STATE_OFF) {
/* Lock new limit */
sleepmgr_lock_mode(sleep_mode[new_state]);
}
if (udd_state != UDD_STATE_OFF) {
/* Unlock old limit */
sleepmgr_unlock_mode(sleep_mode[udd_state]);
}
udd_state = new_state;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:28,代码来源:usb_device_udd.c
示例19: pdca_disable
/**
* \brief Disable the PDCA module
*
* \param pdca Base address of the PDCA module
*/
void pdca_disable(Pdca *pdca)
{
sysclk_disable_peripheral_clock(pdca);
sleepmgr_unlock_mode(SLEEPMGR_BACKUP);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:10,代码来源:pdca.c
示例20: picouart_disable
void picouart_disable(struct picouart_dev_inst *const dev_inst)
{
dev_inst->dev_ptr->PICOUART_CR = PICOUART_CR_DIS;
sysclk_disable_peripheral_clock(PICOUART);
sleepmgr_unlock_mode(SLEEPMGR_BACKUP);
}
开发者ID:119,项目名称:bcm-wiced-sdk,代码行数:6,代码来源:picouart.c
注:本文中的sleepmgr_unlock_mode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论