arduino-emulator
Loading...
Searching...
No Matches
PluggableUSB.h
1/*
2 PluggableUSB.h
3 Copyright (c) 2015 Arduino LLC
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20#ifndef PUSB_h
21#define PUSB_h
22
23#include "USBAPI.h"
24#include <stdint.h>
25#include <stddef.h>
26
27namespace arduino {
28
30public:
32 numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType)
33 { }
34
35protected:
36 virtual bool setup(USBSetup& setup) = 0;
37 virtual int getInterface(uint8_t* interfaceCount) = 0;
38 virtual int getDescriptor(USBSetup& setup) = 0;
39 virtual uint8_t getShortName(char *name) { name[0] = 'A'+pluggedInterface; return 1; }
40
41 uint8_t pluggedInterface;
42 uint8_t pluggedEndpoint;
43
44 const uint8_t numEndpoints;
45 const uint8_t numInterfaces;
46 const unsigned int *endpointType;
47
49
50 friend class PluggableUSB_;
51};
52
54public:
56 bool plug(PluggableUSBModule *node);
57 int getInterface(uint8_t* interfaceCount);
58 int getDescriptor(USBSetup& setup);
59 bool setup(USBSetup& setup);
60 void getShortName(char *iSerialNum);
61
62private:
63 uint8_t lastIf;
64 uint8_t lastEp;
65 PluggableUSBModule* rootNode;
66 uint8_t totalEP;
67};
68}
69
70// core need to define
71void* epBuffer(unsigned int n); // -> returns a pointer to the Nth element of the EP buffer structure
72
73// Replacement for global singleton.
74// This function prevents static-initialization-order-fiasco
75// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use
76arduino::PluggableUSB_& PluggableUSB();
77
78#endif
Definition DMAPool.h:103
Definition PluggableUSB.h:53
Definition PluggableUSB.h:29
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31