Bmag incl gps rettelse

Dependencies:   mbed WDT MODSERIAL BME280

Committer:
gert_lauritsen
Date:
Thu Jun 20 07:13:18 2019 +0000
Revision:
56:df9052e3808c
change date stamp from gps, reads serialnumb from file.

Who changed what in which revision?

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