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 #ifndef _UI_H_ 00031 #define _UI_H_ 00032 00033 #include "CDCRequests.h" 00034 #include "USBH.h" 00035 00036 /*! \brief Initializes the user interface */ 00037 void ui_init(void); 00038 00039 /*! \brief Notify that the USB mode has automatically switched. 00040 * This is only possible when the ID pin is available. 00041 * 00042 * \param b_host_mode true, if the host mode has been selected 00043 */ 00044 void ui_usb_mode_change(bool b_host_mode); 00045 00046 /*! \brief Notify that a new Vbus transition has been detected. 00047 * Available only in USB hardware with Vbus monitoring. 00048 * 00049 * \param b_vbus_present true, if Vbus is high. 00050 */ 00051 void ui_usb_vbus_change(bool b_vbus_present); 00052 00053 /*! \brief Notify that a Vbus error has occurred 00054 * Available only in USB hardware with Vbus monitoring. 00055 */ 00056 void ui_usb_vbus_error(void); 00057 00058 /*! \brief Notify that a USB device has been connected or disconnected. 00059 * 00060 * \param dev Pointer on USB device information 00061 * \param b_present true, if the device has been connected 00062 */ 00063 void ui_usb_connection_event(USBH_device_t *dev, bool b_present); 00064 00065 /*! \brief Notify that a USB device or the host has woken up the USB line. */ 00066 void ui_usb_wakeup_event(void); 00067 00068 /*! \brief Notify that a SOF has been sent (each 1 ms) */ 00069 void ui_usb_sof_event(void); 00070 00071 /*! \brief Notify the end of a USB device enumeration 00072 * 00073 * \param dev Pointer on USB device information 00074 * \param status Status of the USB enumeration 00075 */ 00076 void ui_usb_enum_event(USBH_device_t *dev, USBH_enum_status_t status); 00077 00078 /*! \brief Called when a data is received on CDC 00079 */ 00080 void ui_com_rx_start(void); 00081 00082 /*! \brief Called when a data is received on com port 00083 */ 00084 void ui_com_tx_start(void); 00085 00086 /*! \brief Called when all pending data are sent on com port 00087 */ 00088 void ui_com_rx_stop(void); 00089 00090 /*! \brief Called when all pending data are sent on CDC 00091 */ 00092 void ui_com_tx_stop(void); 00093 00094 /*! \brief Called when a communication error occur 00095 */ 00096 void ui_com_error(void); 00097 00098 /*! \brief Called when an overflow occur 00099 */ 00100 void ui_com_overflow(void); 00101 00102 #endif /* _UI_H_ */