📄 main.c
字号:
//!
//! @file main.c,v
//!
//! Copyright (c) 2006 Atmel.
//!
//! Please read file license.txt for copyright notice.
//!
//! @brief Main for USB application.
//!
//! @version 1.2 at90usb128-demo-hidgen-std-2_0_0 $Id: main.c,v 1.2 2007/01/26 16:20:13 rletendu Exp $
//!
//! @mainpage AT90USBxxx USB device HID generic demonstration
//!
//! @section intro License
//! Use of this program is subject to Atmel's End User License Agreement.
//!
//! Please read file license.txt for copyright notice.
//!
//! @section install Description
//! This embedded application code illustrates how to implement a USB application
//! with the AT90USBxxx controller using the generic HID class implementation.
//!
//! A pc side application ('UsbHidDemoCode.exe') allows to communicate with the embedded firmware (set LEDS value or get joystick events).
//!
//! \image html pc_appli.gif
//!
//! This application uses the AtUsbHid.dll that easily allows to communicate with a USB device using
//! the native HID driver from the PC operating system. For more information about the AtUsbHid.dll, please
//! refer to the application note "USB PC Driver based on HID class" (Atmel document number: 7645).
//!
//! This sample application can be configured for both STK525 or AT90USBKey hardware, see #TARGET_BOARD
//! define value in config.h file.
//!
//! @section arch Architecture
//! As illustrated in the figure bellow, the application entry point is located is the main.c file.
//! The main function first performs the initialization of a scheduler module and then runs it in an infinite loop.
//! The scheduler is a simple infinite loop calling all its tasks defined in the conf_scheduler.h file.
//! No real time schedule is performed, when a task ends, the scheduler calls the next task defined in
//! the configuration file (conf_scheduler.h).
//!
//! The sample dual role application is based on two different tasks:
//! - The usb_task (usb_task.c associated source file), is the task performing the USB low level
//! enumeration process in device mode.
//! Once this task has detected that the usb connection is fully operationnal, it updates different status flags
//! that can be check within the high level application tasks.
//! - The hid task performs the high level device application operation.
//! Once the device is fully enumerated (DEVICE SET_CONFIGURATION request received), the task
//! checks for received data on its OUT endpoint and transmit data on its IN endpoint.
//!
//! \image html arch_full.gif
//!
//_____ I N C L U D E S ___________________________________________________
#include "config.h"
#include "modules/scheduler/scheduler.h"
#include "lib_mcu/wdt/wdt_drv.h"
#include "lib_mcu/power/power_drv.h"
//_____ M A C R O S ________________________________________________________
//_____ D E F I N I T I O N S ______________________________________________
void main(void)
{
#ifndef AVRGCC
Wdt_off();
#else
wdt_reset();
Wdt_clear_flag();
Wdt_change_enable();
Wdt_stop();
#endif
Clear_prescaler();
scheduler();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -