SAMV71 Xplained Ultra Software Package 1.4

main.c

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