本文整理汇总了C++中sleepmgr_enter_sleep函数的典型用法代码示例。如果您正苦于以下问题:C++ sleepmgr_enter_sleep函数的具体用法?C++ sleepmgr_enter_sleep怎么用?C++ sleepmgr_enter_sleep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sleepmgr_enter_sleep函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: run_usb_msc_test
static void run_usb_msc_test(const struct test_case *test)
{
memories_initialization();
// Start USB stack to authorize VBus monitoring
udc_start();
if (!udc_include_vbus_monitoring()) {
// VBUS monitoring is not available on this product
// thereby VBUS has to be considered as present
main_vbus_action(true);
}
// The main loop manages only the power mode
// because the USB management is done by interrupt
while (!main_b_msc_read) {
if (main_b_msc_enumerated) {
if (!udi_msc_process_trans()) {
sleepmgr_enter_sleep();
}
}else{
sleepmgr_enter_sleep();
}
}
test_assert_true(test, main_b_msc_enumerated, "MSC enumeration fails");
udc_stop();
}
开发者ID:Timvrakas,项目名称:samd21_gcc,代码行数:29,代码来源:unit_tests.c
示例2: main
/*! \brief Main function. Execution starts here.
*/
int main(void)
{
//Initialize interrupt controller
irq_initialize_vectors();
cpu_irq_enable();
// Initialize sleep manager
sleepmgr_init();
// Initialize clock tree
sysclk_init();
// Initialize hardware board resources
board_init();
// Initialize user interface
ui_init();
ui_powerdown();
// Sanity check about Silicon revision Vs Firmware build
// for Silicon revision A, firmware should be specific
if ((!firmware_rev_a) && (nvm_read_device_rev()==0)) {
ui_si_revision_error();
while(ui_button()!=1);
while(ui_button()!=2);
while(ui_button()!=4);
while(ui_button()!=8);
}
// Initialize DATA Flash
at45dbx_init();
// Initialize ADC for on-board sensors
adc_sensors_init();
// Initialize USB HID report protocol
usb_hid_com_init();
// Start USB stack
main_build_usb_serial_number();
udc_start();
// The main loop manages only the power mode
// because everything else is managed by interrupt.
// The USB Start of Frame event manages internal tick events for
// on-board sensor updates as well as LCD display update.
while (true) {
if (main_b_msc_enable) {
if (!udi_msc_process_trans()) {
sleepmgr_enter_sleep();
}
} else {
sleepmgr_enter_sleep();
}
if (usb_hid_com_is_start_dfu()) {
main_start_dfu_session();
}
}
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:59,代码来源:main.c
示例3: main
/*! \brief Main function. Execution starts here.
*/
int main(void)
{
irq_initialize_vectors();
cpu_irq_enable();
// Initialize the sleep manager
sleepmgr_init();
#if !SAM0
sysclk_init();
board_init();
#else
system_init();
#endif
ui_init();
ui_powerdown();
// Start USB stack to authorize VBus monitoring
udc_start();
// The main loop manages only the power mode
// because the USB management is done by interrupt
while (true) {
sleepmgr_enter_sleep();
}
}
开发者ID:Mazetti,项目名称:asf,代码行数:29,代码来源:main.c
示例4: main
/*! \brief Main function. Execution starts here.
*/
int main(void)
{
irq_initialize_vectors();
cpu_irq_enable();
// Initialize the sleep manager
sleepmgr_init();
sysclk_init();
board_init();
ui_init();
ui_powerdown();
// Start USB stack to authorize VBus monitoring
udc_start();
if (!udc_include_vbus_monitoring()) {
// VBUS monitoring is not available on this product
// thereby VBUS has to be considered as present
main_vbus_action(true);
}
// The main loop manages only the power mode
// because the USB management is done by interrupt
while (true) {
sleepmgr_enter_sleep();
}
}
开发者ID:xin3liang,项目名称:device_google_accessory_adk2012_demo,代码行数:29,代码来源:main.c
示例5: main
/**
* \brief Run low power demo
*
* This function initializes the XMEGA to the least power consuming state,
* before initializing the sleep manager interrupts on switchports.
* The device is then put to sleep, and the sleep mode is configured by the
* interrupt routines.
*/
int main(void)
{
board_init();
sysclk_init();
lowpower_init();
/* Initialize the sleep manager. */
sleepmgr_init();
/* Enable interrupts from switchports on
* low level to sense all interrupts */
pmic_init();
SWITCHPORT0.INTCTRL = SWITCHPORT_INT_LEVEL;
SWITCHPORT1.INTCTRL = SWITCHPORT_INT_LEVEL;
SWITCHPORT0.INT0MASK = SWITCHMASK0;
SWITCHPORT1.INT0MASK = SWITCHMASK1;
ioport_configure_port_pin(&SWITCHPORT0,
SWITCHMASK0, IOPORT_LEVEL | IOPORT_PULL_UP);
ioport_configure_port_pin(&SWITCHPORT1,
SWITCHMASK1, IOPORT_LEVEL | IOPORT_PULL_UP);
cpu_irq_enable();
/* Start in active mode */
sleepmgr_lock_mode(SLEEPMGR_ACTIVE);
/* Go to sleep, sleep modes are configured by interrupt routines. */
while (1) {
sleepmgr_enter_sleep();
}
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:38,代码来源:low_power_demo.c
示例6: main
/*! \brief Main function. Execution starts here.
*/
int main(void)
{
#if SAMD21 || SAML21 || SAMDA1
system_init();
#else
sysclk_init();
board_init();
#endif
irq_initialize_vectors();
cpu_irq_enable();
// Initialize the sleep manager
sleepmgr_init();
ui_init();
// Start USB host stack
uhc_start();
// The USB management is entirely managed by interrupts.
// As a consequence, the user application does only have to play with the power modes.
while (true) {
sleepmgr_enter_sleep();
}
}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:27,代码来源:main.c
示例7: main
/*! \brief Main function. Execution starts here.
*/
int main(void)
{
irq_initialize_vectors();
cpu_irq_enable();
/* Initialize the sleep manager */
sleepmgr_init();
#if !SAMD21 && !SAMR21
sysclk_init();
board_init();
#else
system_init();
#endif
ui_init();
ui_powerdown();
/* Start USB stack to authorize VBus monitoring */
udc_start();
/* The main loop manages only the power mode
* because the USB management is done by interrupt
*/
while (true) {
sleepmgr_enter_sleep();
if (main_b_phdc_enable) {
if (ieee11073_skeleton_process()) {
ui_association(true); /* Association Ok */
} else {
ui_association(false); /* No association */
}
}
}
}
开发者ID:marekr,项目名称:asf,代码行数:35,代码来源:main.c
示例8: main
/*! \brief Main function. Execution starts here.
*/
int main(void)
{
#if SAMD21 || SAML21
system_init();
#else
sysclk_init();
board_init();
#endif
irq_initialize_vectors();
cpu_irq_enable();
// Initialize the sleep manager
sleepmgr_init();
ui_init();
// Start USB dual mode which will start the correct mode (device or host)
// corresponding at USB ID signal.
uhc_start();
// The main loop manages only the power mode
// because the USB stack is full interrupt driven.
while (true) {
sleepmgr_enter_sleep();
}
}
开发者ID:InSoonPark,项目名称:asf,代码行数:29,代码来源:main.c
示例9: 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
示例10: main
int main(void)
{
pmic_init();
board_init();
sysclk_init();
sleepmgr_init();
cpu_irq_enable();
#if (BOARD == XMEGA_A3BU_XPLAINED)
/* The status LED must be used as LED2, so we turn off
* the green led which is in the same packaging. */
ioport_set_pin_high(LED3_GPIO);
#endif
/*
* Unmask clock for TIMER_EXAMPLE
*/
tc_enable(&TIMER_EXAMPLE);
/*
* Configure interrupts callback functions for TIMER_EXAMPLE
* overflow interrupt, CCA interrupt and CCB interrupt
*/
tc_set_overflow_interrupt_callback(&TIMER_EXAMPLE,
example_ovf_interrupt_callback);
tc_set_cca_interrupt_callback(&TIMER_EXAMPLE,
example_cca_interrupt_callback);
tc_set_ccb_interrupt_callback(&TIMER_EXAMPLE,
example_ccb_interrupt_callback);
/*
* Configure TC in normal mode, configure period, CCA and CCB
* Enable both CCA and CCB channels
*/
tc_set_wgm(&TIMER_EXAMPLE, TC_WG_NORMAL);
tc_write_period(&TIMER_EXAMPLE, TIMER_EXAMPLE_PERIOD);
tc_write_cc(&TIMER_EXAMPLE, TC_CCA, TIMER_EXAMPLE_PERIOD / 2);
tc_write_cc(&TIMER_EXAMPLE, TC_CCB, TIMER_EXAMPLE_PERIOD / 4);
tc_enable_cc_channels(&TIMER_EXAMPLE,(enum tc_cc_channel_mask_enable_t)(TC_CCAEN | TC_CCBEN));
/*
* Enable TC interrupts (overflow, CCA and CCB)
*/
tc_set_overflow_interrupt_level(&TIMER_EXAMPLE, TC_INT_LVL_LO);
tc_set_cca_interrupt_level(&TIMER_EXAMPLE, TC_INT_LVL_LO);
tc_set_ccb_interrupt_level(&TIMER_EXAMPLE, TC_INT_LVL_LO);
/*
* Run TIMER_EXAMPLE at TIMER_EXAMPLE_PERIOD(31250Hz) resolution
*/
tc_set_resolution(&TIMER_EXAMPLE, TIMER_EXAMPLE_PERIOD);
do {
/* Go to sleep, everything is handled by interrupts. */
sleepmgr_enter_sleep();
} while (1);
}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:59,代码来源:tc_example1.c
示例11: main
/*! \brief Main File Section:
* - Initialization (CPU, Controller Task,... )
* - Main loop with task management (ADC, DAC, CAN and GUI)
*/
int main(void)
{
irq_initialize_vectors();
/* Initialize the board.
* The board-specific conf_board.h file contains the configuration of
* the board initialization.
*/
board_init();
/* Initialize the clocks.
* The clock-specific conf_clocks.h file contains the configuration of
* the clocks initialization.
*/
sysclk_init();
// Initialize the sleep manager
sleepmgr_init();
sleepmgr_lock_mode(SLEEPMGR_IDLE);
/* Initialize the required Task.
* - Initialize the DAC task to start the signal generator,
* - Initialize the ADC task to start the scope acquisition,
* - Initialize the Noise Task to add digital noise to the signal,
* - Initialize the Filter Task to remove the digital noise of the signal,
* - Initialize the GUI Task to display signals as a scope on the LCD,
* - Initialize the Remote Task to display signals as a scope on the LCD,
*/
dac_task_init();
adc_task_init();
noise_task_init();
filter_task_init();
gui_task_init();
controller_task_init();
remote_task_init();
cpu_irq_enable();
// Free running scheduler loop
while (true) {
// Enter Sleep Mode
sleepmgr_enter_sleep();
// Call ADC task
adc_task();
// Call DAC task
dac_task();
// Call Noise task
noise_task();
// Filter Task
filter_task();
// Call Gui task for update
gui_task();
// Call Controller Task for control Update
controller_task();
// Send data to the PC Application
remote_task();
}
}
开发者ID:Mazetti,项目名称:asf,代码行数:62,代码来源:main.c
示例12: main
int main(void)
{
struct adc_config adc_conf;
struct adc_channel_config adcch_conf;
board_init();
sysclk_init();
sleepmgr_init();
irq_initialize_vectors();
cpu_irq_enable();
gfx_mono_init();
// Enable back light of display
ioport_set_pin_high(LCD_BACKLIGHT_ENABLE_PIN);
// Initialize configuration structures.
adc_read_configuration(&ADCA, &adc_conf);
adcch_read_configuration(&ADCA, ADC_CH0, &adcch_conf);
/* Configure the ADC module:
* - unsigned, 12-bit results
* - VCC voltage reference
* - 200 kHz maximum clock rate
* - manual conversion triggering
* - temperature sensor enabled
* - callback function
*/
adc_set_conversion_parameters(&adc_conf, ADC_SIGN_ON, ADC_RES_12,
ADC_REF_VCC);
adc_set_clock_rate(&adc_conf, 200000UL);
adc_set_conversion_trigger(&adc_conf, ADC_TRIG_MANUAL, 1, 0);
adc_enable_internal_input(&adc_conf, ADC_INT_TEMPSENSE);
adc_write_configuration(&ADCA, &adc_conf);
adc_set_callback(&ADCA, &adc_handler);
/* Configure ADC channel 0:
* - single-ended measurement from temperature sensor
* - interrupt flag set on completed conversion
* - interrupts disabled
*/
adcch_set_input(&adcch_conf, ADCCH_POS_PIN1, ADCCH_NEG_NONE,
1);
adcch_set_interrupt_mode(&adcch_conf, ADCCH_MODE_COMPLETE);
adcch_enable_interrupt(&adcch_conf);
adcch_write_configuration(&ADCA, ADC_CH0, &adcch_conf);
// Enable the ADC and start the first conversion.
adc_enable(&ADCA);
adc_start_conversion(&ADCA, ADC_CH0);
do {
// Sleep until ADC interrupt triggers.
sleepmgr_enter_sleep();
} while (1);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:57,代码来源:adc_example1_gfx.c
示例13: main
int main(void)
{
struct adc_config adc_conf;
struct adc_channel_config adcch_conf;
board_init();
sysclk_init();
sleepmgr_init();
irq_initialize_vectors();
cpu_irq_enable();
// Initialize configuration structures.
adc_read_configuration(&ADCA, &adc_conf);
adcch_read_configuration(&ADCA, ADC_CH0, &adcch_conf);
/* Configure the ADC module:
* - unsigned, 12-bit results
* - bandgap (1 V) voltage reference
* - 200 kHz maximum clock rate
* - manual conversion triggering
* - temperature sensor enabled
* - callback function
*/
adc_set_conversion_parameters(&adc_conf, ADC_SIGN_OFF, ADC_RES_12,
ADC_REF_BANDGAP);
adc_set_clock_rate(&adc_conf, 200000UL);
adc_set_conversion_trigger(&adc_conf, ADC_TRIG_MANUAL, 1, 0);
adc_enable_internal_input(&adc_conf, ADC_INT_TEMPSENSE);
adc_write_configuration(&ADCA, &adc_conf);
adc_set_callback(&ADCA, &adc_handler);
/* Configure ADC channel 0:
* - single-ended measurement from temperature sensor
* - interrupt flag set on completed conversion
* - interrupts disabled
*/
adcch_set_input(&adcch_conf, ADCCH_POS_TEMPSENSE, ADCCH_NEG_NONE,
1);
adcch_set_interrupt_mode(&adcch_conf, ADCCH_MODE_COMPLETE);
adcch_enable_interrupt(&adcch_conf);
adcch_write_configuration(&ADCA, ADC_CH0, &adcch_conf);
// Get measurement for 85 degrees C (358 kelvin) from calibration data.
tempsense = adc_get_calibration_data(ADC_CAL_TEMPSENSE);
// Enable the ADC and start the first conversion.
adc_enable(&ADCA);
adc_start_conversion(&ADCA, ADC_CH0);
do {
// Sleep until ADC interrupt triggers.
sleepmgr_enter_sleep();
} while (1);
}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:56,代码来源:adc_example1.c
示例14: __wait_for_completion
void __wait_for_completion( completion_t* flag )
{
#if USB_LOCK_DEBUG
printf("DEBUG: Must wait for command completion...\n");
#endif
do {
sleepmgr_enter_sleep();
completion_t not_ready = *flag;
if (not_ready == false) {
break;
}
} while(true);
}
开发者ID:EmuxEvans,项目名称:calipso,代码行数:13,代码来源:usb_lock.c
示例15: main
/*! \brief Main function. Execution starts here.
*/
int main(void)
{
irq_initialize_vectors();
cpu_irq_enable();
// Initialize the sleep manager
sleepmgr_init();
sysclk_init();
board_init();
ui_init();
ui_powerdown();
#if UC3A3
// Init Hmatrix bus
sysclk_enable_pbb_module(SYSCLK_HMATRIX);
init_hmatrix();
#endif
#if (defined AT45DBX_MEM) && (AT45DBX_MEM == ENABLE)
at45dbx_init();
#endif
#if ((defined SD_MMC_MCI_0_MEM) && (SD_MMC_MCI_0_MEM == ENABLE)) \
|| ((defined SD_MMC_MCI_1_MEM) && (SD_MMC_MCI_1_MEM == ENABLE))
// Initialize SD/MMC with MCI PB clock.
sysclk_enable_pbb_module(SYSCLK_MCI);
sysclk_enable_hsb_module(SYSCLK_DMACA);
sd_mmc_mci_resources_init();
#endif
// Start USB stack to authorize VBus monitoring
udc_start();
if (!udc_include_vbus_monitoring()) {
// VBUS monitoring is not available on this product
// thereby VBUS has to be considered as present
main_vbus_action(true);
}
// The main loop manages only the power mode
// because the USB management is done by interrupt
while (true) {
sleepmgr_enter_sleep();
if (main_b_msc_enable) {
udi_msc_process_trans();
}
}
}
开发者ID:xin3liang,项目名称:device_google_accessory_adk2012_demo,代码行数:50,代码来源:main.c
示例16: main
/*! \brief Main function.
*/
int main(void)
{
uint8_t tx_buf[] = "\n\rHello AVR world ! : ";
uint8_t i;
/* Initialize the board.
* The board-specific conf_board.h file contains the configuration of
* the board initialization.
*/
board_init();
sysclk_init();
pmic_init();
cpu_irq_enable();
sleepmgr_init();
sleepmgr_lock_mode(SLEEPMGR_STDBY);
/* USART options. */
static usart_xmegae_rs232_options_t USART_SERIAL_OPTIONS = {
.baudrate = USART_SERIAL_EXAMPLE_BAUDRATE,
.charlength = USART_SERIAL_CHAR_LENGTH,
.paritytype = USART_SERIAL_PARITY,
.stopbits = USART_SERIAL_STOP_BIT,
.start_frame_detection = false,
.one_wire = false,
.pec_length = USART_SERIAL_VARIABLE_CHAR_LENGTH,
.pec_action = USART_PECACT_PERC01_gc,
.encoding_type = USART_DECTYPE_DATA_gc,
.encoding_stream = USART_LUTACT_OFF_gc,
};
/* Initialize usart driver in RS232 mode */
usart_xmegae_init_rs232(USART_SERIAL_EXAMPLE, &USART_SERIAL_OPTIONS);
usart_set_rx_interrupt_level(USART_SERIAL_EXAMPLE, USART_INT_LVL_LO);
/* Send "message header" */
for (i = 0; i < sizeof(tx_buf); i++) {
usart_putchar(USART_SERIAL_EXAMPLE, tx_buf[i]);
while (!usart_tx_is_complete(USART_SERIAL_EXAMPLE)) {
}
usart_clear_tx_complete(USART_SERIAL_EXAMPLE);
}
/* Incoming character is process under interrupt
* main loop simply enters sleep mode */
while (true) {
sleepmgr_enter_sleep();
}
}
开发者ID:InSoonPark,项目名称:asf,代码行数:50,代码来源:usart_example4.c
示例17: 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
示例18: main
/*! \brief Main function.
*/
int main(void)
{
/* Initialize the board.
* The board-specific conf_board.h file contains the configuration of
* the board initialization.
*/
board_init();
sysclk_init();
sleepmgr_init();
irq_initialize_vectors();
cpu_irq_enable();
/* Configure the XCL module:
* - Asynchronous mode usage (locks Power Down sleep mode)
* - Configure XCL to use XMEGA port D
* - Configure LUT in 1 LUTs with 3 differents inputs
* - LUT IN0 input on pin 2 or port D
* - LUT IN1 input on XCL LUT OUT1
* - LUT OUT0 output on pin 4 or port D
* - LUT IN2 input on pin 1 or port D
* - LUT IN3 input on pin 3 or port D
* - LUT OUT1 output on LUT IN1
* - No time Delay for both LUT0 and LUT1
* - LUT0 performs XOR operation
* - LUT1 performs XOR operation
*/
xcl_enable(XCL_ASYNCHRONOUS);
xcl_port(PD);
xcl_lut_type(LUT_1LUT3IN);
xcl_lut_in0(LUT_IN_PINL);
xcl_lut_in1(LUT_IN_XCL);
xcl_lut_in2(LUT_IN_PINL);
xcl_lut_in3(LUT_IN_PINL);
xcl_lut0_output(LUT0_OUT_PIN4);
xcl_lut_config_delay(DLY11, LUT_DLY_DISABLE, LUT_DLY_DISABLE);
xcl_lut0_truth(XOR);
xcl_lut1_truth(XOR);
/*
* main loop simply enters sleep mode
*/
while (true) {
sleepmgr_enter_sleep();
}
}
开发者ID:InSoonPark,项目名称:asf,代码行数:47,代码来源:xcl_example4.c
示例19: main
/*! \brief Main function. Execution starts here.
*/
int main(void)
{
static bool qtb0_last_state = false;
static bool qtb1_last_state = false;
bool qtb_state;
irq_initialize_vectors();
cpu_irq_enable();
// Initialize ASF services
sleepmgr_init();
sysclk_init();
board_init();
// Initialize sub task
app_touch_init();
// The main loop
while (true) {
// Enter in sleep mode
sleepmgr_enter_sleep();
// Check state of QTouch buttons
qtb_state = app_touch_check_key_pressed(0);
if (qtb_state != qtb0_last_state) {
// QTouch button have changed
qtb0_last_state = qtb_state;
if (!qtb_state) {
LED_On(LED0_GPIO);
} else {
LED_Off(LED0_GPIO);
}
}
qtb_state = app_touch_check_key_pressed(1);
if (qtb_state != qtb1_last_state) {
// QTouch button have changed
qtb1_last_state = qtb_state;
if (!qtb_state) {
LED_On(LED1_GPIO);
} else {
LED_Off(LED1_GPIO);
}
}
}
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:47,代码来源:main.c
示例20: record_events
static void record_events(void)
{
uint16_t i=0;
while(1) {
while (!main_events) {
sleepmgr_enter_sleep(); \
}
if (i < NB_EVENTS) {
// Register events
irqflags_t flags = cpu_irq_save();
list_event[i].event = main_events;
list_event[i++].timestamp =
cpu_cy_2_us(Get_system_register(AVR32_COUNT),sysclk_get_cpu_hz());
main_events=0;
cpu_irq_restore(flags);
}
}
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:18,代码来源:unit_tests.c
注:本文中的sleepmgr_enter_sleep函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论