Library to use Arduino USB host shield on mbed
ArduinoのUSB Host Shield 2.0をmbedで使えるようにしたライブラリです。
大体のコードがArduinoからそのまま移植可能です。
Arduino UNOやMega用のホストシールド以外にもミニサイズのホストシールドでも使用可能です
シールドについて
3.3VのI/O用にシールドの改造が必要になりますがネット上に記事がたくさんあるのでそちらを参考にしてください
接続例
使い方
Arduinoのコードと違うのはUSBのインスタンスの宣言部分のみです。
ピンを自分で指定できるようにしたので使いやすくなりました。
仕様
- Arduinoのmillis関数、micros関数の移植のために内部でTimerクラスを使用しています。
main.cpp
#include "mbed.h" #include <PS3BT.h> #include <usbhub.h> Serial pc(USBTX, USBRX, 115200); //Nucleo f303k8用 USB Usb(A6, A5, A4, A3, A2); // mosi, miso, sclk, ssel, intr BTD Btd(&Usb); PS3BT PS3(&Btd); int main() { bool printAngle = false; if (Usb.Init() == -1) { pc.printf("\r\nOSC did not start"); while (1); // Halt } pc.printf("\r\nPS3 USB Library Started"); while (1) { Usb.Task(); if (PS3.PS3Connected || PS3.PS3NavigationConnected) { if (PS3.getAnalogHat(LeftHatX) > 137 || PS3.getAnalogHat(LeftHatX) < 117 || PS3.getAnalogHat(LeftHatY) > 137 || PS3.getAnalogHat(LeftHatY) < 117 || PS3.getAnalogHat(RightHatX) > 137 || PS3.getAnalogHat(RightHatX) < 117 || PS3.getAnalogHat(RightHatY) > 137 || PS3.getAnalogHat(RightHatY) < 117) { pc.printf("\r\nLeftHatX: %d", PS3.getAnalogHat(LeftHatX)); pc.printf("\tLeftHatY: %d", PS3.getAnalogHat(LeftHatY)); if (PS3.PS3Connected) { // The Navigation controller only have one joystick pc.printf("\tRightHatX: %d", PS3.getAnalogHat(RightHatX)); pc.printf("\tRightHatY: %d", PS3.getAnalogHat(RightHatY)); } } // Analog button values can be read from almost all buttons if (PS3.getAnalogButton(L2) || PS3.getAnalogButton(R2)) { pc.printf("\r\nL2: %d", PS3.getAnalogButton(L2)); if (!PS3.PS3NavigationConnected) { pc.printf("\tR2: %d", PS3.getAnalogButton(R2)); } } if (PS3.getButtonClick(PS)) { PS3.disconnect(); pc.printf("\r\nPS"); } if (PS3.getButtonClick(TRIANGLE)) pc.printf("\r\nTriangle"); if (PS3.getButtonClick(CIRCLE)) pc.printf("\r\nCircle"); if (PS3.getButtonClick(CROSS)) pc.printf("\r\nCross"); if (PS3.getButtonClick(SQUARE)) pc.printf("\r\nSquare"); if (PS3.getButtonClick(UP)) { pc.printf("\r\nUp"); PS3.setLedOff(); PS3.setLedOn(CONTROLLER_LED4); } if (PS3.getButtonClick(RIGHT)) { pc.printf("\r\nRight"); PS3.setLedOff(); PS3.setLedOn(CONTROLLER_LED1); } if (PS3.getButtonClick(DOWN)) { pc.printf("\r\nDown"); PS3.setLedOff(); PS3.setLedOn(CONTROLLER_LED2); } if (PS3.getButtonClick(LEFT)) { pc.printf("\r\nLeft"); PS3.setLedOff(); PS3.setLedOn(CONTROLLER_LED3); } if (PS3.getButtonClick(L1)) pc.printf("\r\nL1"); if (PS3.getButtonClick(L3)) pc.printf("\r\nL3"); if (PS3.getButtonClick(R1)) pc.printf("\r\nR1"); if (PS3.getButtonClick(R3)) pc.printf("\r\nR3"); if (PS3.getButtonClick(SELECT)) { pc.printf("\r\nSelect - "); PS3.printStatusString(); } if (PS3.getButtonClick(START)) { pc.printf("\r\nStart"); printAngle = !printAngle; } if (printAngle) { pc.printf("\r\nPitch: %.3lf", PS3.getAngle(Pitch)); pc.printf("\tRoll: %.3lf", PS3.getAngle(Roll)); } } else { pc.printf("not connect\n"); } } }
USB_Host/cdcacm.h@1:da31140f2a1c, 2020-05-02 (annotated)
- Committer:
- robo_ichinoseki_a
- Date:
- Sat May 02 05:56:48 2020 +0000
- Revision:
- 1:da31140f2a1c
- Parent:
- 0:b1ce54272580
update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kotakku | 0:b1ce54272580 | 1 | /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. |
kotakku | 0:b1ce54272580 | 2 | |
kotakku | 0:b1ce54272580 | 3 | This software may be distributed and modified under the terms of the GNU |
kotakku | 0:b1ce54272580 | 4 | General Public License version 2 (GPL2) as published by the Free Software |
kotakku | 0:b1ce54272580 | 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of |
kotakku | 0:b1ce54272580 | 6 | this file. Please note that GPL2 Section 2[b] requires that all works based |
kotakku | 0:b1ce54272580 | 7 | on this software must also be made publicly available under the terms of |
kotakku | 0:b1ce54272580 | 8 | the GPL2 ("Copyleft"). |
kotakku | 0:b1ce54272580 | 9 | |
kotakku | 0:b1ce54272580 | 10 | Contact information |
kotakku | 0:b1ce54272580 | 11 | ------------------- |
kotakku | 0:b1ce54272580 | 12 | |
kotakku | 0:b1ce54272580 | 13 | Circuits At Home, LTD |
kotakku | 0:b1ce54272580 | 14 | Web : http://www.circuitsathome.com |
kotakku | 0:b1ce54272580 | 15 | e-mail : support@circuitsathome.com |
kotakku | 0:b1ce54272580 | 16 | */ |
kotakku | 0:b1ce54272580 | 17 | #if !defined(__CDCACM_H__) |
kotakku | 0:b1ce54272580 | 18 | #define __CDCACM_H__ |
kotakku | 0:b1ce54272580 | 19 | |
kotakku | 0:b1ce54272580 | 20 | #include "Usb.h" |
kotakku | 0:b1ce54272580 | 21 | |
kotakku | 0:b1ce54272580 | 22 | #define bmREQ_CDCOUT USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE |
kotakku | 0:b1ce54272580 | 23 | #define bmREQ_CDCIN USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE |
kotakku | 0:b1ce54272580 | 24 | |
kotakku | 0:b1ce54272580 | 25 | // CDC Subclass Constants |
kotakku | 0:b1ce54272580 | 26 | #define CDC_SUBCLASS_DLCM 0x01 // Direct Line Control Model |
kotakku | 0:b1ce54272580 | 27 | #define CDC_SUBCLASS_ACM 0x02 // Abstract Control Model |
kotakku | 0:b1ce54272580 | 28 | #define CDC_SUBCLASS_TCM 0x03 // Telephone Control Model |
kotakku | 0:b1ce54272580 | 29 | #define CDC_SUBCLASS_MCCM 0x04 // Multi Channel Control Model |
kotakku | 0:b1ce54272580 | 30 | #define CDC_SUBCLASS_CAPI 0x05 // CAPI Control Model |
kotakku | 0:b1ce54272580 | 31 | #define CDC_SUBCLASS_ETHERNET 0x06 // Ethernet Network Control Model |
kotakku | 0:b1ce54272580 | 32 | #define CDC_SUBCLASS_ATM 0x07 // ATM Network Control Model |
kotakku | 0:b1ce54272580 | 33 | #define CDC_SUBCLASS_WIRELESS_HANDSET 0x08 // Wireless Handset Control Model |
kotakku | 0:b1ce54272580 | 34 | #define CDC_SUBCLASS_DEVICE_MANAGEMENT 0x09 // Device Management |
kotakku | 0:b1ce54272580 | 35 | #define CDC_SUBCLASS_MOBILE_DIRECT_LINE 0x0A // Mobile Direct Line Model |
kotakku | 0:b1ce54272580 | 36 | #define CDC_SUBCLASS_OBEX 0x0B // OBEX |
kotakku | 0:b1ce54272580 | 37 | #define CDC_SUBCLASS_ETHERNET_EMU 0x0C // Ethernet Emulation Model |
kotakku | 0:b1ce54272580 | 38 | |
kotakku | 0:b1ce54272580 | 39 | // Communication Interface Class Control Protocol Codes |
kotakku | 0:b1ce54272580 | 40 | #define CDC_PROTOCOL_ITU_T_V_250 0x01 // AT Commands defined by ITU-T V.250 |
kotakku | 0:b1ce54272580 | 41 | #define CDC_PROTOCOL_PCCA_101 0x02 // AT Commands defined by PCCA-101 |
kotakku | 0:b1ce54272580 | 42 | #define CDC_PROTOCOL_PCCA_101_O 0x03 // AT Commands defined by PCCA-101 & Annex O |
kotakku | 0:b1ce54272580 | 43 | #define CDC_PROTOCOL_GSM_7_07 0x04 // AT Commands defined by GSM 7.07 |
kotakku | 0:b1ce54272580 | 44 | #define CDC_PROTOCOL_3GPP_27_07 0x05 // AT Commands defined by 3GPP 27.007 |
kotakku | 0:b1ce54272580 | 45 | #define CDC_PROTOCOL_C_S0017_0 0x06 // AT Commands defined by TIA for CDMA |
kotakku | 0:b1ce54272580 | 46 | #define CDC_PROTOCOL_USB_EEM 0x07 // Ethernet Emulation Model |
kotakku | 0:b1ce54272580 | 47 | |
kotakku | 0:b1ce54272580 | 48 | // CDC Commands defined by CDC 1.2 |
kotakku | 0:b1ce54272580 | 49 | #define CDC_SEND_ENCAPSULATED_COMMAND 0x00 |
kotakku | 0:b1ce54272580 | 50 | #define CDC_GET_ENCAPSULATED_RESPONSE 0x01 |
kotakku | 0:b1ce54272580 | 51 | |
kotakku | 0:b1ce54272580 | 52 | // CDC Commands defined by PSTN 1.2 |
kotakku | 0:b1ce54272580 | 53 | #define CDC_SET_COMM_FEATURE 0x02 |
kotakku | 0:b1ce54272580 | 54 | #define CDC_GET_COMM_FEATURE 0x03 |
kotakku | 0:b1ce54272580 | 55 | #define CDC_CLEAR_COMM_FEATURE 0x04 |
kotakku | 0:b1ce54272580 | 56 | #define CDC_SET_AUX_LINE_STATE 0x10 |
kotakku | 0:b1ce54272580 | 57 | #define CDC_SET_HOOK_STATE 0x11 |
kotakku | 0:b1ce54272580 | 58 | #define CDC_PULSE_SETUP 0x12 |
kotakku | 0:b1ce54272580 | 59 | #define CDC_SEND_PULSE 0x13 |
kotakku | 0:b1ce54272580 | 60 | #define CDC_SET_PULSE_TIME 0x14 |
kotakku | 0:b1ce54272580 | 61 | #define CDC_RING_AUX_JACK 0x15 |
kotakku | 0:b1ce54272580 | 62 | #define CDC_SET_LINE_CODING 0x20 |
kotakku | 0:b1ce54272580 | 63 | #define CDC_GET_LINE_CODING 0x21 |
kotakku | 0:b1ce54272580 | 64 | #define CDC_SET_CONTROL_LINE_STATE 0x22 |
kotakku | 0:b1ce54272580 | 65 | #define CDC_SEND_BREAK 0x23 |
kotakku | 0:b1ce54272580 | 66 | #define CDC_SET_RINGER_PARMS 0x30 |
kotakku | 0:b1ce54272580 | 67 | #define CDC_GET_RINGER_PARMS 0x31 |
kotakku | 0:b1ce54272580 | 68 | #define CDC_SET_OPERATION_PARMS 0x32 |
kotakku | 0:b1ce54272580 | 69 | #define CDC_GET_OPERATION_PARMS 0x33 |
kotakku | 0:b1ce54272580 | 70 | #define CDC_SET_LINE_PARMS 0x34 |
kotakku | 0:b1ce54272580 | 71 | #define CDC_GET_LINE_PARMS 0x35 |
kotakku | 0:b1ce54272580 | 72 | #define CDC_DIAL_DIGITS 0x36 |
kotakku | 0:b1ce54272580 | 73 | |
kotakku | 0:b1ce54272580 | 74 | //Class-Specific Notification Codes |
kotakku | 0:b1ce54272580 | 75 | #define NETWORK_CONNECTION 0x00 |
kotakku | 0:b1ce54272580 | 76 | #define RESPONSE_AVAILABLE 0x01 |
kotakku | 0:b1ce54272580 | 77 | #define AUX_JACK_HOOK_STATE 0x08 |
kotakku | 0:b1ce54272580 | 78 | #define RING_DETECT 0x09 |
kotakku | 0:b1ce54272580 | 79 | #define SERIAL_STATE 0x20 |
kotakku | 0:b1ce54272580 | 80 | #define CALL_STATE_CHANGE 0x28 |
kotakku | 0:b1ce54272580 | 81 | #define LINE_STATE_CHANGE 0x29 |
kotakku | 0:b1ce54272580 | 82 | #define CONNECTION_SPEED_CHANGE 0x2a |
kotakku | 0:b1ce54272580 | 83 | |
kotakku | 0:b1ce54272580 | 84 | // CDC Functional Descriptor Structures |
kotakku | 0:b1ce54272580 | 85 | |
kotakku | 0:b1ce54272580 | 86 | typedef struct { |
kotakku | 0:b1ce54272580 | 87 | uint8_t bFunctionLength; |
kotakku | 0:b1ce54272580 | 88 | uint8_t bDescriptorType; |
kotakku | 0:b1ce54272580 | 89 | uint8_t bDescriptorSubtype; |
kotakku | 0:b1ce54272580 | 90 | uint8_t bmCapabilities; |
kotakku | 0:b1ce54272580 | 91 | uint8_t bDataInterface; |
kotakku | 0:b1ce54272580 | 92 | } CALL_MGMNT_FUNC_DESCR; |
kotakku | 0:b1ce54272580 | 93 | |
kotakku | 0:b1ce54272580 | 94 | typedef struct { |
kotakku | 0:b1ce54272580 | 95 | uint8_t bFunctionLength; |
kotakku | 0:b1ce54272580 | 96 | uint8_t bDescriptorType; |
kotakku | 0:b1ce54272580 | 97 | uint8_t bDescriptorSubtype; |
kotakku | 0:b1ce54272580 | 98 | uint8_t bmCapabilities; |
kotakku | 0:b1ce54272580 | 99 | } ACM_FUNC_DESCR, DLM_FUNC_DESCR, TEL_OPER_MODES_FUNC_DESCR, |
kotakku | 0:b1ce54272580 | 100 | TEL_CALL_STATE_REP_CPBL_FUNC_DESCR; |
kotakku | 0:b1ce54272580 | 101 | |
kotakku | 0:b1ce54272580 | 102 | typedef struct { |
kotakku | 0:b1ce54272580 | 103 | uint8_t bFunctionLength; |
kotakku | 0:b1ce54272580 | 104 | uint8_t bDescriptorType; |
kotakku | 0:b1ce54272580 | 105 | uint8_t bDescriptorSubtype; |
kotakku | 0:b1ce54272580 | 106 | uint8_t bRingerVolSteps; |
kotakku | 0:b1ce54272580 | 107 | uint8_t bNumRingerPatterns; |
kotakku | 0:b1ce54272580 | 108 | } TEL_RINGER_FUNC_DESCR; |
kotakku | 0:b1ce54272580 | 109 | |
kotakku | 0:b1ce54272580 | 110 | typedef struct { |
kotakku | 0:b1ce54272580 | 111 | uint32_t dwDTERate; // Data Terminal Rate in bits per second |
kotakku | 0:b1ce54272580 | 112 | uint8_t bCharFormat; // 0 - 1 stop bit, 1 - 1.5 stop bits, 2 - 2 stop bits |
kotakku | 0:b1ce54272580 | 113 | uint8_t bParityType; // 0 - None, 1 - Odd, 2 - Even, 3 - Mark, 4 - Space |
kotakku | 0:b1ce54272580 | 114 | uint8_t bDataBits; // Data bits (5, 6, 7, 8 or 16) |
kotakku | 0:b1ce54272580 | 115 | } LINE_CODING; |
kotakku | 0:b1ce54272580 | 116 | |
kotakku | 0:b1ce54272580 | 117 | typedef struct { |
kotakku | 0:b1ce54272580 | 118 | uint8_t bmRequestType; // 0xa1 for class-specific notifications |
kotakku | 0:b1ce54272580 | 119 | uint8_t bNotification; |
kotakku | 0:b1ce54272580 | 120 | uint16_t wValue; |
kotakku | 0:b1ce54272580 | 121 | uint16_t wIndex; |
kotakku | 0:b1ce54272580 | 122 | uint16_t wLength; |
kotakku | 0:b1ce54272580 | 123 | uint16_t bmState; //UART state bitmap for SERIAL_STATE, other notifications variable length |
kotakku | 0:b1ce54272580 | 124 | } CLASS_NOTIFICATION; |
kotakku | 0:b1ce54272580 | 125 | |
kotakku | 0:b1ce54272580 | 126 | class ACM; |
kotakku | 0:b1ce54272580 | 127 | |
kotakku | 0:b1ce54272580 | 128 | class CDCAsyncOper { |
kotakku | 0:b1ce54272580 | 129 | public: |
kotakku | 0:b1ce54272580 | 130 | |
kotakku | 0:b1ce54272580 | 131 | virtual uint8_t OnInit(ACM *pacm __attribute__((unused))) { |
kotakku | 0:b1ce54272580 | 132 | return 0; |
kotakku | 0:b1ce54272580 | 133 | }; |
kotakku | 0:b1ce54272580 | 134 | //virtual void OnDataRcvd(ACM *pacm, uint8_t nbytes, uint8_t *dataptr) = 0; |
kotakku | 0:b1ce54272580 | 135 | //virtual void OnDisconnected(ACM *pacm) = 0; |
kotakku | 0:b1ce54272580 | 136 | }; |
kotakku | 0:b1ce54272580 | 137 | |
kotakku | 0:b1ce54272580 | 138 | /** |
kotakku | 0:b1ce54272580 | 139 | * This structure is used to report the extended capabilities of the connected device. |
kotakku | 0:b1ce54272580 | 140 | * It is also used to report the current status. |
kotakku | 0:b1ce54272580 | 141 | * Regular CDC-ACM reports all as false. |
kotakku | 0:b1ce54272580 | 142 | */ |
kotakku | 0:b1ce54272580 | 143 | typedef struct { |
kotakku | 0:b1ce54272580 | 144 | |
kotakku | 0:b1ce54272580 | 145 | union { |
kotakku | 0:b1ce54272580 | 146 | uint8_t tty; |
kotakku | 0:b1ce54272580 | 147 | |
kotakku | 0:b1ce54272580 | 148 | struct { |
kotakku | 0:b1ce54272580 | 149 | bool enhanced : 1; // Do we have the ability to set/clear any features? |
kotakku | 0:b1ce54272580 | 150 | // Status and 8th bit in data stream. |
kotakku | 0:b1ce54272580 | 151 | // Presence only indicates feature is available, but this isn't used for CDC-ACM. |
kotakku | 0:b1ce54272580 | 152 | bool wide : 1; |
kotakku | 0:b1ce54272580 | 153 | bool autoflow_RTS : 1; // Has autoflow on RTS/CTS |
kotakku | 0:b1ce54272580 | 154 | bool autoflow_DSR : 1; // Has autoflow on DTR/DSR |
kotakku | 0:b1ce54272580 | 155 | bool autoflow_XON : 1; // Has autoflow XON/XOFF |
kotakku | 0:b1ce54272580 | 156 | bool half_duplex : 1; // Has half-duplex capability. |
kotakku | 0:b1ce54272580 | 157 | } __attribute__((packed)); |
kotakku | 0:b1ce54272580 | 158 | }; |
kotakku | 0:b1ce54272580 | 159 | } tty_features; |
kotakku | 0:b1ce54272580 | 160 | |
kotakku | 0:b1ce54272580 | 161 | #define ACM_MAX_ENDPOINTS 4 |
kotakku | 0:b1ce54272580 | 162 | |
kotakku | 0:b1ce54272580 | 163 | class ACM : public USBDeviceConfig, public UsbConfigXtracter { |
kotakku | 0:b1ce54272580 | 164 | protected: |
kotakku | 0:b1ce54272580 | 165 | USB *pUsb; |
kotakku | 0:b1ce54272580 | 166 | CDCAsyncOper *pAsync; |
kotakku | 0:b1ce54272580 | 167 | uint8_t bAddress; |
kotakku | 0:b1ce54272580 | 168 | uint8_t bConfNum; // configuration number |
kotakku | 0:b1ce54272580 | 169 | uint8_t bControlIface; // Control interface value |
kotakku | 0:b1ce54272580 | 170 | uint8_t bDataIface; // Data interface value |
kotakku | 0:b1ce54272580 | 171 | uint8_t bNumEP; // total number of EP in the configuration |
kotakku | 0:b1ce54272580 | 172 | uint32_t qNextPollTime; // next poll time |
kotakku | 0:b1ce54272580 | 173 | volatile bool bPollEnable; // poll enable flag |
kotakku | 0:b1ce54272580 | 174 | volatile bool ready; //device ready indicator |
kotakku | 0:b1ce54272580 | 175 | tty_features _enhanced_status; // current status |
kotakku | 0:b1ce54272580 | 176 | |
kotakku | 0:b1ce54272580 | 177 | void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr); |
kotakku | 0:b1ce54272580 | 178 | |
kotakku | 0:b1ce54272580 | 179 | public: |
kotakku | 0:b1ce54272580 | 180 | static const uint8_t epDataInIndex; // DataIn endpoint index |
kotakku | 0:b1ce54272580 | 181 | static const uint8_t epDataOutIndex; // DataOUT endpoint index |
kotakku | 0:b1ce54272580 | 182 | static const uint8_t epInterruptInIndex; // InterruptIN endpoint index |
kotakku | 0:b1ce54272580 | 183 | EpInfo epInfo[ACM_MAX_ENDPOINTS]; |
kotakku | 0:b1ce54272580 | 184 | |
kotakku | 0:b1ce54272580 | 185 | ACM(USB *pusb, CDCAsyncOper *pasync); |
kotakku | 0:b1ce54272580 | 186 | |
kotakku | 0:b1ce54272580 | 187 | uint8_t SetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr); |
kotakku | 0:b1ce54272580 | 188 | uint8_t GetCommFeature(uint16_t fid, uint8_t nbytes, uint8_t *dataptr); |
kotakku | 0:b1ce54272580 | 189 | uint8_t ClearCommFeature(uint16_t fid); |
kotakku | 0:b1ce54272580 | 190 | uint8_t SetLineCoding(const LINE_CODING *dataptr); |
kotakku | 0:b1ce54272580 | 191 | uint8_t GetLineCoding(LINE_CODING *dataptr); |
kotakku | 0:b1ce54272580 | 192 | uint8_t SetControlLineState(uint8_t state); |
kotakku | 0:b1ce54272580 | 193 | uint8_t SendBreak(uint16_t duration); |
kotakku | 0:b1ce54272580 | 194 | uint8_t GetNotif(uint16_t *bytes_rcvd, uint8_t *dataptr); |
kotakku | 0:b1ce54272580 | 195 | |
kotakku | 0:b1ce54272580 | 196 | // Methods for receiving and sending data |
kotakku | 0:b1ce54272580 | 197 | uint8_t RcvData(uint16_t *nbytesptr, uint8_t *dataptr); |
kotakku | 0:b1ce54272580 | 198 | uint8_t SndData(uint16_t nbytes, uint8_t *dataptr); |
kotakku | 0:b1ce54272580 | 199 | |
kotakku | 0:b1ce54272580 | 200 | // USBDeviceConfig implementation |
kotakku | 0:b1ce54272580 | 201 | uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed); |
kotakku | 0:b1ce54272580 | 202 | uint8_t Release(); |
kotakku | 0:b1ce54272580 | 203 | uint8_t Poll(); |
kotakku | 0:b1ce54272580 | 204 | |
kotakku | 0:b1ce54272580 | 205 | bool available(void) { |
kotakku | 0:b1ce54272580 | 206 | return false; |
kotakku | 0:b1ce54272580 | 207 | }; |
kotakku | 0:b1ce54272580 | 208 | |
kotakku | 0:b1ce54272580 | 209 | virtual uint8_t GetAddress() { |
kotakku | 0:b1ce54272580 | 210 | return bAddress; |
kotakku | 0:b1ce54272580 | 211 | }; |
kotakku | 0:b1ce54272580 | 212 | |
kotakku | 0:b1ce54272580 | 213 | virtual bool isReady() { |
kotakku | 0:b1ce54272580 | 214 | return ready; |
kotakku | 0:b1ce54272580 | 215 | }; |
kotakku | 0:b1ce54272580 | 216 | |
kotakku | 0:b1ce54272580 | 217 | virtual tty_features enhanced_status(void) { |
kotakku | 0:b1ce54272580 | 218 | return _enhanced_status; |
kotakku | 0:b1ce54272580 | 219 | }; |
kotakku | 0:b1ce54272580 | 220 | |
kotakku | 0:b1ce54272580 | 221 | virtual tty_features enhanced_features(void) { |
kotakku | 0:b1ce54272580 | 222 | tty_features rv; |
kotakku | 0:b1ce54272580 | 223 | rv.enhanced = false; |
kotakku | 0:b1ce54272580 | 224 | rv.autoflow_RTS = false; |
kotakku | 0:b1ce54272580 | 225 | rv.autoflow_DSR = false; |
kotakku | 0:b1ce54272580 | 226 | rv.autoflow_XON = false; |
kotakku | 0:b1ce54272580 | 227 | rv.half_duplex = false; |
kotakku | 0:b1ce54272580 | 228 | rv.wide = false; |
kotakku | 0:b1ce54272580 | 229 | return rv; |
kotakku | 0:b1ce54272580 | 230 | }; |
kotakku | 0:b1ce54272580 | 231 | |
kotakku | 0:b1ce54272580 | 232 | virtual void autoflowRTS(bool s __attribute__((unused))) { |
kotakku | 0:b1ce54272580 | 233 | }; |
kotakku | 0:b1ce54272580 | 234 | |
kotakku | 0:b1ce54272580 | 235 | virtual void autoflowDSR(bool s __attribute__((unused))) { |
kotakku | 0:b1ce54272580 | 236 | }; |
kotakku | 0:b1ce54272580 | 237 | |
kotakku | 0:b1ce54272580 | 238 | virtual void autoflowXON(bool s __attribute__((unused))) { |
kotakku | 0:b1ce54272580 | 239 | }; |
kotakku | 0:b1ce54272580 | 240 | |
kotakku | 0:b1ce54272580 | 241 | virtual void half_duplex(bool s __attribute__((unused))) { |
kotakku | 0:b1ce54272580 | 242 | }; |
kotakku | 0:b1ce54272580 | 243 | |
kotakku | 0:b1ce54272580 | 244 | virtual void wide(bool s __attribute__((unused))) { |
kotakku | 0:b1ce54272580 | 245 | }; |
kotakku | 0:b1ce54272580 | 246 | |
kotakku | 0:b1ce54272580 | 247 | // UsbConfigXtracter implementation |
kotakku | 0:b1ce54272580 | 248 | void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep); |
kotakku | 0:b1ce54272580 | 249 | }; |
kotakku | 0:b1ce54272580 | 250 | |
kotakku | 0:b1ce54272580 | 251 | #endif // __CDCACM_H__ |
kotakku | 0:b1ce54272580 | 252 |