00001 /* ---------------------------------------------------------------------------- */ 00002 /* Atmel Microcontroller Software Support */ 00003 /* SAM Software Package License */ 00004 /* ---------------------------------------------------------------------------- */ 00005 /* Copyright (c) 2015, Atmel Corporation */ 00006 /* */ 00007 /* All rights reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or without */ 00010 /* modification, are permitted provided that the following condition is met: */ 00011 /* */ 00012 /* - Redistributions of source code must retain the above copyright notice, */ 00013 /* this list of conditions and the disclaimer below. */ 00014 /* */ 00015 /* Atmel's name may not be used to endorse or promote products derived from */ 00016 /* this software without specific prior written permission. */ 00017 /* */ 00018 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ 00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ 00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ 00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ 00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ 00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ 00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00028 /* ---------------------------------------------------------------------------- */ 00029 00030 /** 00031 * \page usb_host_hid USB Host HID Example 00032 * 00033 * \section Purpose 00034 * 00035 * This example shows how to implement a USB host CDC on SAMV7/E7 Microcontrollers. 00036 * 00037 * \section Requirements 00038 * This package can be used with SAMV71 Xplained Ultra board or SAME70 Xplained board 00039 * 00040 * \section Description 00041 * 00042 * After loading the application, connect the board to a USB 00043 * HID mouse. 00044 * 00045 * \section Usage 00046 * 00047 * -# Build the program and download it inside the board. 00048 * Please refer to the Getting Started with SAM V71/E70 Microcontrollers.pdf 00049 * -# On the computer, open and configure a terminal application 00050 * (e.g. HyperTerminal on Microsoft Windows) with these settings: 00051 * - 115200 baud rate 00052 * - 8 bits of data 00053 * - No parity 00054 * - 1 stop bit 00055 * - No flow control 00056 * -# Connect the HID mouse device to SAM V71 Xplained Ultra board or SAME70 Xplained board 00057 with the OTG wire. 00058 * -# Start the application. In the terminal window, the 00059 * following text should appear (values depend on the board and chip used): 00060 * \code 00061 * -- USB HOST HID Mouse Example xxx -- 00062 * -- xxxxxx-xx 00063 * -- Compiled: xxx xx xxxx xx:xx:xx -- 00064 * \endcode 00065 * -# Human interface on SAM V71 Xplained Ultra board or SAME70 Xplained board.: 00066 * - Led 0 is continuously on when a device is connected 00067 * - Led 0 blinks when USB host has checked and enabled HID interface 00068 * - The blink is slow (1s) with low speed device 00069 * - The blink is normal (0.5s) with full speed device 00070 * - The blink is fast (0.25s) with high speed device 00071 * - Led 1 is on when the mouse move 00072 * 00073 * \section References 00074 * - usb_host_hid/main.c 00075 * - usb_host_hid/ui.c 00076 * - led.c 00077 * - USBH.c 00078 * - USBH_HAL.c 00079 * - uhi_hid_mouse.c 00080 */ 00081 00082 #include "board.h" 00083 #include "conf_usb_host.h" 00084 #include "ui.h" 00085 00086 /*! \brief Main function. Execution starts here. 00087 */ 00088 int main(void) 00089 { 00090 00091 WDT_Disable(WDT); 00092 00093 SCB_EnableICache(); 00094 SCB_EnableDCache(); 00095 00096 /* Output example information */ 00097 printf("-- USB HOST HID Mouse Example %s --\n\r", SOFTPACK_VERSION); 00098 printf("-- %s\n\r", BOARD_NAME); 00099 printf("-- Compiled: %s %s With %s--\n\r", __DATE__, __TIME__ , 00100 COMPILER_NAME); 00101 00102 TimeTick_Configure(); 00103 00104 irq_initialize_vectors(); 00105 cpu_irq_enable(); 00106 00107 ui_init(); 00108 00109 // Start USB host stack 00110 USBH_start(); 00111 00112 // The USB management is entirely managed by interrupts. 00113 // As a consequence, the user application does only have to play with the power modes. 00114 while (true); 00115 }