Bmag incl gps rettelse

Dependencies:   mbed WDT MODSERIAL BME280

Committer:
gert_lauritsen
Date:
Fri Jul 05 12:55:53 2019 +0000
Branch:
MbedBMAGThrRev
Revision:
61:52a6d0ffd8e5
dato rettel og ID i file lagt ind i version 5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gert_lauritsen 61:52a6d0ffd8e5 1 /* mbed USBHost Library
gert_lauritsen 61:52a6d0ffd8e5 2 * Copyright (c) 2006-2013 ARM Limited
gert_lauritsen 61:52a6d0ffd8e5 3 *
gert_lauritsen 61:52a6d0ffd8e5 4 * Licensed under the Apache License, Version 2.0 (the "License");
gert_lauritsen 61:52a6d0ffd8e5 5 * you may not use this file except in compliance with the License.
gert_lauritsen 61:52a6d0ffd8e5 6 * You may obtain a copy of the License at
gert_lauritsen 61:52a6d0ffd8e5 7 *
gert_lauritsen 61:52a6d0ffd8e5 8 * http://www.apache.org/licenses/LICENSE-2.0
gert_lauritsen 61:52a6d0ffd8e5 9 *
gert_lauritsen 61:52a6d0ffd8e5 10 * Unless required by applicable law or agreed to in writing, software
gert_lauritsen 61:52a6d0ffd8e5 11 * distributed under the License is distributed on an "AS IS" BASIS,
gert_lauritsen 61:52a6d0ffd8e5 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
gert_lauritsen 61:52a6d0ffd8e5 13 * See the License for the specific language governing permissions and
gert_lauritsen 61:52a6d0ffd8e5 14 * limitations under the License.
gert_lauritsen 61:52a6d0ffd8e5 15 */
gert_lauritsen 61:52a6d0ffd8e5 16
gert_lauritsen 61:52a6d0ffd8e5 17 #ifndef USBHOSTHUB_H
gert_lauritsen 61:52a6d0ffd8e5 18 #define USBHOSTHUB_H
gert_lauritsen 61:52a6d0ffd8e5 19
gert_lauritsen 61:52a6d0ffd8e5 20 #include "USBHostConf.h"
gert_lauritsen 61:52a6d0ffd8e5 21
gert_lauritsen 61:52a6d0ffd8e5 22 #if MAX_HUB_NB
gert_lauritsen 61:52a6d0ffd8e5 23
gert_lauritsen 61:52a6d0ffd8e5 24 #include "USBHostTypes.h"
gert_lauritsen 61:52a6d0ffd8e5 25 #include "IUSBEnumerator.h"
gert_lauritsen 61:52a6d0ffd8e5 26
gert_lauritsen 61:52a6d0ffd8e5 27 class USBHost;
gert_lauritsen 61:52a6d0ffd8e5 28 class USBDeviceConnected;
gert_lauritsen 61:52a6d0ffd8e5 29 class USBEndpoint;
gert_lauritsen 61:52a6d0ffd8e5 30
gert_lauritsen 61:52a6d0ffd8e5 31 /**
gert_lauritsen 61:52a6d0ffd8e5 32 * A class to use a USB Hub
gert_lauritsen 61:52a6d0ffd8e5 33 */
gert_lauritsen 61:52a6d0ffd8e5 34 class USBHostHub : public IUSBEnumerator {
gert_lauritsen 61:52a6d0ffd8e5 35 public:
gert_lauritsen 61:52a6d0ffd8e5 36 /**
gert_lauritsen 61:52a6d0ffd8e5 37 * Constructor
gert_lauritsen 61:52a6d0ffd8e5 38 */
gert_lauritsen 61:52a6d0ffd8e5 39 USBHostHub();
gert_lauritsen 61:52a6d0ffd8e5 40
gert_lauritsen 61:52a6d0ffd8e5 41 /**
gert_lauritsen 61:52a6d0ffd8e5 42 * Check if a USB Hub is connected
gert_lauritsen 61:52a6d0ffd8e5 43 *
gert_lauritsen 61:52a6d0ffd8e5 44 * @return true if a serial device is connected
gert_lauritsen 61:52a6d0ffd8e5 45 */
gert_lauritsen 61:52a6d0ffd8e5 46 bool connected();
gert_lauritsen 61:52a6d0ffd8e5 47
gert_lauritsen 61:52a6d0ffd8e5 48 /**
gert_lauritsen 61:52a6d0ffd8e5 49 * Try to connect device
gert_lauritsen 61:52a6d0ffd8e5 50 *
gert_lauritsen 61:52a6d0ffd8e5 51 * @param dev device to connect
gert_lauritsen 61:52a6d0ffd8e5 52 * @return true if connection was successful
gert_lauritsen 61:52a6d0ffd8e5 53 */
gert_lauritsen 61:52a6d0ffd8e5 54 bool connect(USBDeviceConnected * dev);
gert_lauritsen 61:52a6d0ffd8e5 55
gert_lauritsen 61:52a6d0ffd8e5 56 /**
gert_lauritsen 61:52a6d0ffd8e5 57 * Automatically called by USBHost when a device
gert_lauritsen 61:52a6d0ffd8e5 58 * has been enumerated by usb_thread
gert_lauritsen 61:52a6d0ffd8e5 59 *
gert_lauritsen 61:52a6d0ffd8e5 60 * @param dev device connected
gert_lauritsen 61:52a6d0ffd8e5 61 */
gert_lauritsen 61:52a6d0ffd8e5 62 void deviceConnected(USBDeviceConnected * dev);
gert_lauritsen 61:52a6d0ffd8e5 63
gert_lauritsen 61:52a6d0ffd8e5 64 /**
gert_lauritsen 61:52a6d0ffd8e5 65 * Automatically called by USBHost when a device
gert_lauritsen 61:52a6d0ffd8e5 66 * has been disconnected from this hub
gert_lauritsen 61:52a6d0ffd8e5 67 *
gert_lauritsen 61:52a6d0ffd8e5 68 * @param dev device disconnected
gert_lauritsen 61:52a6d0ffd8e5 69 */
gert_lauritsen 61:52a6d0ffd8e5 70 void deviceDisconnected(USBDeviceConnected * dev);
gert_lauritsen 61:52a6d0ffd8e5 71
gert_lauritsen 61:52a6d0ffd8e5 72 /**
gert_lauritsen 61:52a6d0ffd8e5 73 * Rest a specific port
gert_lauritsen 61:52a6d0ffd8e5 74 *
gert_lauritsen 61:52a6d0ffd8e5 75 * @param port port number
gert_lauritsen 61:52a6d0ffd8e5 76 */
gert_lauritsen 61:52a6d0ffd8e5 77 void portReset(uint8_t port);
gert_lauritsen 61:52a6d0ffd8e5 78
gert_lauritsen 61:52a6d0ffd8e5 79 /*
gert_lauritsen 61:52a6d0ffd8e5 80 * Called by USBHost to set the instance of USBHost
gert_lauritsen 61:52a6d0ffd8e5 81 *
gert_lauritsen 61:52a6d0ffd8e5 82 * @param host host instance
gert_lauritsen 61:52a6d0ffd8e5 83 */
gert_lauritsen 61:52a6d0ffd8e5 84 void setHost(USBHost * host);
gert_lauritsen 61:52a6d0ffd8e5 85
gert_lauritsen 61:52a6d0ffd8e5 86 /**
gert_lauritsen 61:52a6d0ffd8e5 87 * Called by USBhost when a hub has been disconnected
gert_lauritsen 61:52a6d0ffd8e5 88 */
gert_lauritsen 61:52a6d0ffd8e5 89 void hubDisconnected();
gert_lauritsen 61:52a6d0ffd8e5 90
gert_lauritsen 61:52a6d0ffd8e5 91 protected:
gert_lauritsen 61:52a6d0ffd8e5 92 //From IUSBEnumerator
gert_lauritsen 61:52a6d0ffd8e5 93 virtual void setVidPid(uint16_t vid, uint16_t pid);
gert_lauritsen 61:52a6d0ffd8e5 94 virtual bool parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); //Must return true if the interface should be parsed
gert_lauritsen 61:52a6d0ffd8e5 95 virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used
gert_lauritsen 61:52a6d0ffd8e5 96
gert_lauritsen 61:52a6d0ffd8e5 97 private:
gert_lauritsen 61:52a6d0ffd8e5 98 USBHost * host;
gert_lauritsen 61:52a6d0ffd8e5 99 USBDeviceConnected * dev;
gert_lauritsen 61:52a6d0ffd8e5 100 bool dev_connected;
gert_lauritsen 61:52a6d0ffd8e5 101 USBEndpoint * int_in;
gert_lauritsen 61:52a6d0ffd8e5 102 uint8_t nb_port;
gert_lauritsen 61:52a6d0ffd8e5 103 uint8_t hub_characteristics;
gert_lauritsen 61:52a6d0ffd8e5 104
gert_lauritsen 61:52a6d0ffd8e5 105 void rxHandler();
gert_lauritsen 61:52a6d0ffd8e5 106
gert_lauritsen 61:52a6d0ffd8e5 107 uint8_t buf[sizeof(HubDescriptor)];
gert_lauritsen 61:52a6d0ffd8e5 108
gert_lauritsen 61:52a6d0ffd8e5 109 int hub_intf;
gert_lauritsen 61:52a6d0ffd8e5 110 bool hub_device_found;
gert_lauritsen 61:52a6d0ffd8e5 111
gert_lauritsen 61:52a6d0ffd8e5 112 void setPortFeature(uint32_t feature, uint8_t port);
gert_lauritsen 61:52a6d0ffd8e5 113 void clearPortFeature(uint32_t feature, uint8_t port);
gert_lauritsen 61:52a6d0ffd8e5 114 uint32_t getPortStatus(uint8_t port);
gert_lauritsen 61:52a6d0ffd8e5 115
gert_lauritsen 61:52a6d0ffd8e5 116 USBDeviceConnected * device_children[MAX_HUB_PORT];
gert_lauritsen 61:52a6d0ffd8e5 117
gert_lauritsen 61:52a6d0ffd8e5 118 void init();
gert_lauritsen 61:52a6d0ffd8e5 119 void disconnect();
gert_lauritsen 61:52a6d0ffd8e5 120
gert_lauritsen 61:52a6d0ffd8e5 121 };
gert_lauritsen 61:52a6d0ffd8e5 122
gert_lauritsen 61:52a6d0ffd8e5 123 #endif
gert_lauritsen 61:52a6d0ffd8e5 124
gert_lauritsen 61:52a6d0ffd8e5 125 #endif