IOTON boards API using mbed SDK - http://ioton.cc/plataforma-ton

Dependents:   ton-bot_teste ton-bot_seguidor_linha ton-bot_seguidor_parede

Fork of IOTON-API by Kleber Silva

Committer:
krebyy
Date:
Thu Jun 29 20:20:49 2017 +0000
Revision:
3:9c7195d31602
Parent:
1:3a73d77c2cef
Update to TON Board V1.2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
krebyy 1:3a73d77c2cef 1 /**
krebyy 1:3a73d77c2cef 2 ******************************************************************************
krebyy 1:3a73d77c2cef 3 * @file usbd_cdc.h
krebyy 1:3a73d77c2cef 4 * @author MCD Application Team
krebyy 1:3a73d77c2cef 5 * @version V2.3.0
krebyy 1:3a73d77c2cef 6 * @date 04-November-2014
krebyy 1:3a73d77c2cef 7 * @brief header file for the usbd_cdc.c file.
krebyy 1:3a73d77c2cef 8 ******************************************************************************
krebyy 1:3a73d77c2cef 9 * @attention
krebyy 1:3a73d77c2cef 10 *
krebyy 1:3a73d77c2cef 11 * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
krebyy 1:3a73d77c2cef 12 *
krebyy 1:3a73d77c2cef 13 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
krebyy 1:3a73d77c2cef 14 * You may not use this file except in compliance with the License.
krebyy 1:3a73d77c2cef 15 * You may obtain a copy of the License at:
krebyy 1:3a73d77c2cef 16 *
krebyy 1:3a73d77c2cef 17 * http://www.st.com/software_license_agreement_liberty_v2
krebyy 1:3a73d77c2cef 18 *
krebyy 1:3a73d77c2cef 19 * Unless required by applicable law or agreed to in writing, software
krebyy 1:3a73d77c2cef 20 * distributed under the License is distributed on an "AS IS" BASIS,
krebyy 1:3a73d77c2cef 21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
krebyy 1:3a73d77c2cef 22 * See the License for the specific language governing permissions and
krebyy 1:3a73d77c2cef 23 * limitations under the License.
krebyy 1:3a73d77c2cef 24 *
krebyy 1:3a73d77c2cef 25 ******************************************************************************
krebyy 1:3a73d77c2cef 26 */
krebyy 1:3a73d77c2cef 27
krebyy 1:3a73d77c2cef 28 /* Define to prevent recursive inclusion -------------------------------------*/
krebyy 1:3a73d77c2cef 29 #ifndef __USB_CDC_H
krebyy 1:3a73d77c2cef 30 #define __USB_CDC_H
krebyy 1:3a73d77c2cef 31
krebyy 1:3a73d77c2cef 32 #ifdef __cplusplus
krebyy 1:3a73d77c2cef 33 extern "C" {
krebyy 1:3a73d77c2cef 34 #endif
krebyy 1:3a73d77c2cef 35
krebyy 1:3a73d77c2cef 36 /* Includes ------------------------------------------------------------------*/
krebyy 1:3a73d77c2cef 37 #include "usbd_ioreq.h"
krebyy 1:3a73d77c2cef 38
krebyy 1:3a73d77c2cef 39 /** @addtogroup STM32_USB_DEVICE_LIBRARY
krebyy 1:3a73d77c2cef 40 * @{
krebyy 1:3a73d77c2cef 41 */
krebyy 1:3a73d77c2cef 42
krebyy 1:3a73d77c2cef 43 /** @defgroup usbd_cdc
krebyy 1:3a73d77c2cef 44 * @brief This file is the Header file for usbd_cdc.c
krebyy 1:3a73d77c2cef 45 * @{
krebyy 1:3a73d77c2cef 46 */
krebyy 1:3a73d77c2cef 47
krebyy 1:3a73d77c2cef 48
krebyy 1:3a73d77c2cef 49 /** @defgroup usbd_cdc_Exported_Defines
krebyy 1:3a73d77c2cef 50 * @{
krebyy 1:3a73d77c2cef 51 */
krebyy 1:3a73d77c2cef 52 #define CDC_IN_EP 0x81 /* EP1 for data IN */
krebyy 1:3a73d77c2cef 53 #define CDC_OUT_EP 0x01 /* EP1 for data OUT */
krebyy 1:3a73d77c2cef 54 #define CDC_CMD_EP 0x82 /* EP2 for CDC commands */
krebyy 1:3a73d77c2cef 55
krebyy 1:3a73d77c2cef 56 /* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
krebyy 1:3a73d77c2cef 57 #define CDC_DATA_HS_MAX_PACKET_SIZE 512 /* Endpoint IN & OUT Packet size */
krebyy 1:3a73d77c2cef 58 #define CDC_DATA_FS_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */
krebyy 1:3a73d77c2cef 59 #define CDC_CMD_PACKET_SIZE 8 /* Control Endpoint Packet size */
krebyy 1:3a73d77c2cef 60
krebyy 1:3a73d77c2cef 61 #define USB_CDC_CONFIG_DESC_SIZ 67
krebyy 1:3a73d77c2cef 62 #define CDC_DATA_HS_IN_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE
krebyy 1:3a73d77c2cef 63 #define CDC_DATA_HS_OUT_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE
krebyy 1:3a73d77c2cef 64
krebyy 1:3a73d77c2cef 65 #define CDC_DATA_FS_IN_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE
krebyy 1:3a73d77c2cef 66 #define CDC_DATA_FS_OUT_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE
krebyy 1:3a73d77c2cef 67
krebyy 1:3a73d77c2cef 68 /*---------------------------------------------------------------------*/
krebyy 1:3a73d77c2cef 69 /* CDC definitions */
krebyy 1:3a73d77c2cef 70 /*---------------------------------------------------------------------*/
krebyy 1:3a73d77c2cef 71 #define CDC_SEND_ENCAPSULATED_COMMAND 0x00
krebyy 1:3a73d77c2cef 72 #define CDC_GET_ENCAPSULATED_RESPONSE 0x01
krebyy 1:3a73d77c2cef 73 #define CDC_SET_COMM_FEATURE 0x02
krebyy 1:3a73d77c2cef 74 #define CDC_GET_COMM_FEATURE 0x03
krebyy 1:3a73d77c2cef 75 #define CDC_CLEAR_COMM_FEATURE 0x04
krebyy 1:3a73d77c2cef 76 #define CDC_SET_LINE_CODING 0x20
krebyy 1:3a73d77c2cef 77 #define CDC_GET_LINE_CODING 0x21
krebyy 1:3a73d77c2cef 78 #define CDC_SET_CONTROL_LINE_STATE 0x22
krebyy 1:3a73d77c2cef 79 #define CDC_SEND_BREAK 0x23
krebyy 1:3a73d77c2cef 80
krebyy 1:3a73d77c2cef 81 /**
krebyy 1:3a73d77c2cef 82 * @}
krebyy 1:3a73d77c2cef 83 */
krebyy 1:3a73d77c2cef 84
krebyy 1:3a73d77c2cef 85
krebyy 1:3a73d77c2cef 86 /** @defgroup USBD_CORE_Exported_TypesDefinitions
krebyy 1:3a73d77c2cef 87 * @{
krebyy 1:3a73d77c2cef 88 */
krebyy 1:3a73d77c2cef 89
krebyy 1:3a73d77c2cef 90 /**
krebyy 1:3a73d77c2cef 91 * @}
krebyy 1:3a73d77c2cef 92 */
krebyy 1:3a73d77c2cef 93 typedef struct
krebyy 1:3a73d77c2cef 94 {
krebyy 1:3a73d77c2cef 95 uint32_t bitrate;
krebyy 1:3a73d77c2cef 96 uint8_t format;
krebyy 1:3a73d77c2cef 97 uint8_t paritytype;
krebyy 1:3a73d77c2cef 98 uint8_t datatype;
krebyy 1:3a73d77c2cef 99 }USBD_CDC_LineCodingTypeDef;
krebyy 1:3a73d77c2cef 100
krebyy 1:3a73d77c2cef 101 typedef struct _USBD_CDC_Itf
krebyy 1:3a73d77c2cef 102 {
krebyy 1:3a73d77c2cef 103 int8_t (* Init) (void);
krebyy 1:3a73d77c2cef 104 int8_t (* DeInit) (void);
krebyy 1:3a73d77c2cef 105 int8_t (* Control) (uint8_t, uint8_t * , uint16_t);
krebyy 1:3a73d77c2cef 106 int8_t (* Receive) (uint8_t *, uint32_t *);
krebyy 1:3a73d77c2cef 107
krebyy 1:3a73d77c2cef 108 }USBD_CDC_ItfTypeDef;
krebyy 1:3a73d77c2cef 109
krebyy 1:3a73d77c2cef 110
krebyy 1:3a73d77c2cef 111 typedef struct
krebyy 1:3a73d77c2cef 112 {
krebyy 1:3a73d77c2cef 113 uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE/4]; /* Force 32bits alignment */
krebyy 1:3a73d77c2cef 114 uint8_t CmdOpCode;
krebyy 1:3a73d77c2cef 115 uint8_t CmdLength;
krebyy 1:3a73d77c2cef 116 uint8_t *RxBuffer;
krebyy 1:3a73d77c2cef 117 uint8_t *TxBuffer;
krebyy 1:3a73d77c2cef 118 uint32_t RxLength;
krebyy 1:3a73d77c2cef 119 uint32_t TxLength;
krebyy 1:3a73d77c2cef 120
krebyy 1:3a73d77c2cef 121 __IO uint32_t TxState;
krebyy 1:3a73d77c2cef 122 __IO uint32_t RxState;
krebyy 1:3a73d77c2cef 123 }
krebyy 1:3a73d77c2cef 124 USBD_CDC_HandleTypeDef;
krebyy 1:3a73d77c2cef 125
krebyy 1:3a73d77c2cef 126
krebyy 1:3a73d77c2cef 127
krebyy 1:3a73d77c2cef 128 /** @defgroup USBD_CORE_Exported_Macros
krebyy 1:3a73d77c2cef 129 * @{
krebyy 1:3a73d77c2cef 130 */
krebyy 1:3a73d77c2cef 131
krebyy 1:3a73d77c2cef 132 /**
krebyy 1:3a73d77c2cef 133 * @}
krebyy 1:3a73d77c2cef 134 */
krebyy 1:3a73d77c2cef 135
krebyy 1:3a73d77c2cef 136 /** @defgroup USBD_CORE_Exported_Variables
krebyy 1:3a73d77c2cef 137 * @{
krebyy 1:3a73d77c2cef 138 */
krebyy 1:3a73d77c2cef 139
krebyy 1:3a73d77c2cef 140 extern USBD_ClassTypeDef USBD_CDC;
krebyy 1:3a73d77c2cef 141 #define USBD_CDC_CLASS &USBD_CDC
krebyy 1:3a73d77c2cef 142 /**
krebyy 1:3a73d77c2cef 143 * @}
krebyy 1:3a73d77c2cef 144 */
krebyy 1:3a73d77c2cef 145
krebyy 1:3a73d77c2cef 146 /** @defgroup USB_CORE_Exported_Functions
krebyy 1:3a73d77c2cef 147 * @{
krebyy 1:3a73d77c2cef 148 */
krebyy 1:3a73d77c2cef 149 uint8_t USBD_CDC_RegisterInterface (USBD_HandleTypeDef *pdev,
krebyy 1:3a73d77c2cef 150 USBD_CDC_ItfTypeDef *fops);
krebyy 1:3a73d77c2cef 151
krebyy 1:3a73d77c2cef 152 uint8_t USBD_CDC_SetTxBuffer (USBD_HandleTypeDef *pdev,
krebyy 1:3a73d77c2cef 153 uint8_t *pbuff,
krebyy 1:3a73d77c2cef 154 uint16_t length);
krebyy 1:3a73d77c2cef 155
krebyy 1:3a73d77c2cef 156 uint8_t USBD_CDC_SetRxBuffer (USBD_HandleTypeDef *pdev,
krebyy 1:3a73d77c2cef 157 uint8_t *pbuff);
krebyy 1:3a73d77c2cef 158
krebyy 1:3a73d77c2cef 159 uint8_t USBD_CDC_ReceivePacket (USBD_HandleTypeDef *pdev);
krebyy 1:3a73d77c2cef 160
krebyy 1:3a73d77c2cef 161 uint8_t USBD_CDC_TransmitPacket (USBD_HandleTypeDef *pdev);
krebyy 1:3a73d77c2cef 162 /**
krebyy 1:3a73d77c2cef 163 * @}
krebyy 1:3a73d77c2cef 164 */
krebyy 1:3a73d77c2cef 165
krebyy 1:3a73d77c2cef 166 #ifdef __cplusplus
krebyy 1:3a73d77c2cef 167 }
krebyy 1:3a73d77c2cef 168 #endif
krebyy 1:3a73d77c2cef 169
krebyy 1:3a73d77c2cef 170 #endif /* __USB_CDC_H */
krebyy 1:3a73d77c2cef 171 /**
krebyy 1:3a73d77c2cef 172 * @}
krebyy 1:3a73d77c2cef 173 */
krebyy 1:3a73d77c2cef 174
krebyy 1:3a73d77c2cef 175 /**
krebyy 1:3a73d77c2cef 176 * @}
krebyy 1:3a73d77c2cef 177 */
krebyy 1:3a73d77c2cef 178
krebyy 1:3a73d77c2cef 179 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/