Lcd companion boards support (VKLCD50RTA & VKLCD70RT)
What is this ?
This is a demo program using Renesas RGA library & USB Camera to demonstrate VK-RZ/A1H's companion boards workability.
Supported companion Boards:
VKLCD50RTA
VKLCD70RT
How to Configure ?
You can choose which display is installed by altering the lcd_panel.h file
Leave the active one & comment out the others:
#define LCD_VDC5_CH0_PANEL LCD_CH0_PANEL_VKLCD50RTA //#define LCD_VDC5_CH0_PANEL LCD_CH0_PANEL_VKLCD70RT
You can alter the whole demo with your pictures if you like:
How to compile ?
- The Demo can be compiled in 3 modes:
- I. Execution from the internal 10-MB on-chip SRAM.
- II. Execution from the on-board serial FALSH in dual (32-MB) mode.
- After import in the online compiler just leave only the VKRZA1H_DOUBLE.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
- Drag & drop the result binary in MBED disk, (previously inited in double flash mode)
- III. Execution from the on-board serial FALSH in single (16-MB) mode.
- After import in the online compiler just leave only the VKRZA1H_SINGLE.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
- Drag & drop the result binary in MBED disk, (previously inited in single flash mode )
Quick presentation:
Other demos ?
More demos you can find on our FTP
USB/USBHost/USBDeviceConnected.h@0:6435b67ad23c, 2017-02-16 (annotated)
- Committer:
- tvendov
- Date:
- Thu Feb 16 10:23:48 2017 +0000
- Revision:
- 0:6435b67ad23c
Initial lcd support (VKLCD50RTA & VKLCD70RT companion boards)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tvendov | 0:6435b67ad23c | 1 | /* mbed USBHost Library |
tvendov | 0:6435b67ad23c | 2 | * Copyright (c) 2006-2013 ARM Limited |
tvendov | 0:6435b67ad23c | 3 | * |
tvendov | 0:6435b67ad23c | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
tvendov | 0:6435b67ad23c | 5 | * you may not use this file except in compliance with the License. |
tvendov | 0:6435b67ad23c | 6 | * You may obtain a copy of the License at |
tvendov | 0:6435b67ad23c | 7 | * |
tvendov | 0:6435b67ad23c | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
tvendov | 0:6435b67ad23c | 9 | * |
tvendov | 0:6435b67ad23c | 10 | * Unless required by applicable law or agreed to in writing, software |
tvendov | 0:6435b67ad23c | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
tvendov | 0:6435b67ad23c | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
tvendov | 0:6435b67ad23c | 13 | * See the License for the specific language governing permissions and |
tvendov | 0:6435b67ad23c | 14 | * limitations under the License. |
tvendov | 0:6435b67ad23c | 15 | */ |
tvendov | 0:6435b67ad23c | 16 | |
tvendov | 0:6435b67ad23c | 17 | #ifndef USBDEVICECONNECTED_H |
tvendov | 0:6435b67ad23c | 18 | #define USBDEVICECONNECTED_H |
tvendov | 0:6435b67ad23c | 19 | |
tvendov | 0:6435b67ad23c | 20 | #include "stdint.h" |
tvendov | 0:6435b67ad23c | 21 | #include "USBEndpoint.h" |
tvendov | 0:6435b67ad23c | 22 | #include "USBHostConf.h" |
tvendov | 0:6435b67ad23c | 23 | #include "rtos.h" |
tvendov | 0:6435b67ad23c | 24 | |
tvendov | 0:6435b67ad23c | 25 | class USBHostHub; |
tvendov | 0:6435b67ad23c | 26 | |
tvendov | 0:6435b67ad23c | 27 | typedef struct { |
tvendov | 0:6435b67ad23c | 28 | bool in_use; |
tvendov | 0:6435b67ad23c | 29 | uint8_t nb_endpoint; |
tvendov | 0:6435b67ad23c | 30 | uint8_t intf_class; |
tvendov | 0:6435b67ad23c | 31 | uint8_t intf_subclass; |
tvendov | 0:6435b67ad23c | 32 | uint8_t intf_protocol; |
tvendov | 0:6435b67ad23c | 33 | USBEndpoint * ep[MAX_ENDPOINT_PER_INTERFACE]; |
tvendov | 0:6435b67ad23c | 34 | FunctionPointer detach; |
tvendov | 0:6435b67ad23c | 35 | char name[10]; |
tvendov | 0:6435b67ad23c | 36 | } INTERFACE; |
tvendov | 0:6435b67ad23c | 37 | |
tvendov | 0:6435b67ad23c | 38 | /** |
tvendov | 0:6435b67ad23c | 39 | * USBDeviceConnected class |
tvendov | 0:6435b67ad23c | 40 | */ |
tvendov | 0:6435b67ad23c | 41 | class USBDeviceConnected |
tvendov | 0:6435b67ad23c | 42 | { |
tvendov | 0:6435b67ad23c | 43 | public: |
tvendov | 0:6435b67ad23c | 44 | |
tvendov | 0:6435b67ad23c | 45 | /** |
tvendov | 0:6435b67ad23c | 46 | * Constructor |
tvendov | 0:6435b67ad23c | 47 | */ |
tvendov | 0:6435b67ad23c | 48 | USBDeviceConnected(); |
tvendov | 0:6435b67ad23c | 49 | |
tvendov | 0:6435b67ad23c | 50 | /** |
tvendov | 0:6435b67ad23c | 51 | * Attach an USBEndpoint to this device |
tvendov | 0:6435b67ad23c | 52 | * |
tvendov | 0:6435b67ad23c | 53 | * @param intf_nb interface number |
tvendov | 0:6435b67ad23c | 54 | * @param ep pointeur on the USBEndpoint which will be attached |
tvendov | 0:6435b67ad23c | 55 | * @returns true if successful, false otherwise |
tvendov | 0:6435b67ad23c | 56 | */ |
tvendov | 0:6435b67ad23c | 57 | bool addEndpoint(uint8_t intf_nb, USBEndpoint * ep); |
tvendov | 0:6435b67ad23c | 58 | |
tvendov | 0:6435b67ad23c | 59 | /** |
tvendov | 0:6435b67ad23c | 60 | * Retrieve an USBEndpoint by its TYPE and DIRECTION |
tvendov | 0:6435b67ad23c | 61 | * |
tvendov | 0:6435b67ad23c | 62 | * @param intf_nb the interface on which to lookup the USBEndpoint |
tvendov | 0:6435b67ad23c | 63 | * @param type type of the USBEndpoint looked for |
tvendov | 0:6435b67ad23c | 64 | * @param dir direction of the USBEndpoint looked for |
tvendov | 0:6435b67ad23c | 65 | * @param index the index of the USBEndpoint whitin the interface |
tvendov | 0:6435b67ad23c | 66 | * @returns pointer on the USBEndpoint if found, NULL otherwise |
tvendov | 0:6435b67ad23c | 67 | */ |
tvendov | 0:6435b67ad23c | 68 | USBEndpoint * getEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint8_t index = 0); |
tvendov | 0:6435b67ad23c | 69 | |
tvendov | 0:6435b67ad23c | 70 | /** |
tvendov | 0:6435b67ad23c | 71 | * Retrieve an USBEndpoint by its index |
tvendov | 0:6435b67ad23c | 72 | * |
tvendov | 0:6435b67ad23c | 73 | * @param intf_nb interface number |
tvendov | 0:6435b67ad23c | 74 | * @param index index of the USBEndpoint |
tvendov | 0:6435b67ad23c | 75 | * @returns pointer on the USBEndpoint if found, NULL otherwise |
tvendov | 0:6435b67ad23c | 76 | */ |
tvendov | 0:6435b67ad23c | 77 | USBEndpoint * getEndpoint(uint8_t intf_nb, uint8_t index); |
tvendov | 0:6435b67ad23c | 78 | |
tvendov | 0:6435b67ad23c | 79 | /** |
tvendov | 0:6435b67ad23c | 80 | * Add a new interface to this device |
tvendov | 0:6435b67ad23c | 81 | * |
tvendov | 0:6435b67ad23c | 82 | * @param intf_nb interface number |
tvendov | 0:6435b67ad23c | 83 | * @param intf_class interface class |
tvendov | 0:6435b67ad23c | 84 | * @param intf_subclass interface subclass |
tvendov | 0:6435b67ad23c | 85 | * @param intf_protocol interface protocol |
tvendov | 0:6435b67ad23c | 86 | * @returns true if successful, false otherwise |
tvendov | 0:6435b67ad23c | 87 | */ |
tvendov | 0:6435b67ad23c | 88 | bool addInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol); |
tvendov | 0:6435b67ad23c | 89 | |
tvendov | 0:6435b67ad23c | 90 | /** |
tvendov | 0:6435b67ad23c | 91 | * Get a specific interface |
tvendov | 0:6435b67ad23c | 92 | * |
tvendov | 0:6435b67ad23c | 93 | * @param index index of the interface to be fetched |
tvendov | 0:6435b67ad23c | 94 | * @returns interface |
tvendov | 0:6435b67ad23c | 95 | */ |
tvendov | 0:6435b67ad23c | 96 | INTERFACE * getInterface(uint8_t index); |
tvendov | 0:6435b67ad23c | 97 | |
tvendov | 0:6435b67ad23c | 98 | /** |
tvendov | 0:6435b67ad23c | 99 | * Attach a member function to call when a the device has been disconnected |
tvendov | 0:6435b67ad23c | 100 | * |
tvendov | 0:6435b67ad23c | 101 | * @param intf_nb interface number |
tvendov | 0:6435b67ad23c | 102 | * @param tptr pointer to the object to call the member function on |
tvendov | 0:6435b67ad23c | 103 | * @param mptr pointer to the member function to be called |
tvendov | 0:6435b67ad23c | 104 | */ |
tvendov | 0:6435b67ad23c | 105 | template<typename T> |
tvendov | 0:6435b67ad23c | 106 | inline void onDisconnect(uint8_t intf_nb, T* tptr, void (T::*mptr)(void)) { |
tvendov | 0:6435b67ad23c | 107 | if ((mptr != NULL) && (tptr != NULL)) { |
tvendov | 0:6435b67ad23c | 108 | intf[intf_nb].detach.attach(tptr, mptr); |
tvendov | 0:6435b67ad23c | 109 | } |
tvendov | 0:6435b67ad23c | 110 | } |
tvendov | 0:6435b67ad23c | 111 | |
tvendov | 0:6435b67ad23c | 112 | /** |
tvendov | 0:6435b67ad23c | 113 | * Attach a callback called when the device has been disconnected |
tvendov | 0:6435b67ad23c | 114 | * |
tvendov | 0:6435b67ad23c | 115 | * @param intf_nb interface number |
tvendov | 0:6435b67ad23c | 116 | * @param fn function pointer |
tvendov | 0:6435b67ad23c | 117 | */ |
tvendov | 0:6435b67ad23c | 118 | inline void onDisconnect(uint8_t intf_nb, void (*fn)(void)) { |
tvendov | 0:6435b67ad23c | 119 | if (fn != NULL) { |
tvendov | 0:6435b67ad23c | 120 | intf[intf_nb].detach.attach(fn); |
tvendov | 0:6435b67ad23c | 121 | } |
tvendov | 0:6435b67ad23c | 122 | } |
tvendov | 0:6435b67ad23c | 123 | |
tvendov | 0:6435b67ad23c | 124 | /** |
tvendov | 0:6435b67ad23c | 125 | * Disconnect the device by calling a callback function registered by a driver |
tvendov | 0:6435b67ad23c | 126 | */ |
tvendov | 0:6435b67ad23c | 127 | void disconnect(); |
tvendov | 0:6435b67ad23c | 128 | |
tvendov | 0:6435b67ad23c | 129 | // setters |
tvendov | 0:6435b67ad23c | 130 | void init(uint8_t hub, uint8_t port, bool lowSpeed); |
tvendov | 0:6435b67ad23c | 131 | inline void setAddress(uint8_t addr_) { addr = addr_; }; |
tvendov | 0:6435b67ad23c | 132 | inline void setVid(uint16_t vid_) { vid = vid_; }; |
tvendov | 0:6435b67ad23c | 133 | inline void setPid(uint16_t pid_) { pid = pid_; }; |
tvendov | 0:6435b67ad23c | 134 | inline void setClass(uint8_t device_class_) { device_class = device_class_; }; |
tvendov | 0:6435b67ad23c | 135 | inline void setSubClass(uint8_t device_subclass_) { device_subclass = device_subclass_; }; |
tvendov | 0:6435b67ad23c | 136 | inline void setProtocol(uint8_t pr) { proto = pr; }; |
tvendov | 0:6435b67ad23c | 137 | inline void setSizeControlEndpoint(uint32_t size) { sizeControlEndpoint = size; }; |
tvendov | 0:6435b67ad23c | 138 | inline void activeAddress(bool active) { activeAddr = active; }; |
tvendov | 0:6435b67ad23c | 139 | inline void setEnumerated() { enumerated = true; }; |
tvendov | 0:6435b67ad23c | 140 | inline void setNbIntf(uint8_t nb_intf) {nb_interf = nb_intf; }; |
tvendov | 0:6435b67ad23c | 141 | inline void setHubParent(USBHostHub * hub) { hub_parent = hub; }; |
tvendov | 0:6435b67ad23c | 142 | inline void setName(const char * name_, uint8_t intf_nb) { strcpy(intf[intf_nb].name, name_); }; |
tvendov | 0:6435b67ad23c | 143 | |
tvendov | 0:6435b67ad23c | 144 | //getters |
tvendov | 0:6435b67ad23c | 145 | inline uint8_t getPort() { return port; }; |
tvendov | 0:6435b67ad23c | 146 | inline uint8_t getHub() { return hub_nb; }; |
tvendov | 0:6435b67ad23c | 147 | inline uint8_t getAddress() { return addr; }; |
tvendov | 0:6435b67ad23c | 148 | inline uint16_t getVid() { return vid; }; |
tvendov | 0:6435b67ad23c | 149 | inline uint16_t getPid() { return pid; }; |
tvendov | 0:6435b67ad23c | 150 | inline uint8_t getClass() { return device_class; }; |
tvendov | 0:6435b67ad23c | 151 | inline uint8_t getSubClass() { return device_subclass; }; |
tvendov | 0:6435b67ad23c | 152 | inline uint8_t getProtocol() { return proto; }; |
tvendov | 0:6435b67ad23c | 153 | inline bool getSpeed() { return speed; }; |
tvendov | 0:6435b67ad23c | 154 | inline uint32_t getSizeControlEndpoint() { return sizeControlEndpoint; }; |
tvendov | 0:6435b67ad23c | 155 | inline bool isActiveAddress() { return activeAddr; }; |
tvendov | 0:6435b67ad23c | 156 | inline bool isEnumerated() { return enumerated; }; |
tvendov | 0:6435b67ad23c | 157 | inline USBHostHub * getHubParent() { return hub_parent; }; |
tvendov | 0:6435b67ad23c | 158 | inline uint8_t getNbIntf() { return nb_interf; }; |
tvendov | 0:6435b67ad23c | 159 | inline const char * getName(uint8_t intf_nb) { return intf[intf_nb].name; }; |
tvendov | 0:6435b67ad23c | 160 | |
tvendov | 0:6435b67ad23c | 161 | // in case this device is a hub |
tvendov | 0:6435b67ad23c | 162 | USBHostHub * hub; |
tvendov | 0:6435b67ad23c | 163 | |
tvendov | 0:6435b67ad23c | 164 | private: |
tvendov | 0:6435b67ad23c | 165 | USBHostHub * hub_parent; |
tvendov | 0:6435b67ad23c | 166 | |
tvendov | 0:6435b67ad23c | 167 | INTERFACE intf[MAX_INTF]; |
tvendov | 0:6435b67ad23c | 168 | uint32_t sizeControlEndpoint; |
tvendov | 0:6435b67ad23c | 169 | uint8_t hub_nb; |
tvendov | 0:6435b67ad23c | 170 | uint8_t port; |
tvendov | 0:6435b67ad23c | 171 | uint16_t vid; |
tvendov | 0:6435b67ad23c | 172 | uint16_t pid; |
tvendov | 0:6435b67ad23c | 173 | uint8_t addr; |
tvendov | 0:6435b67ad23c | 174 | uint8_t device_class; |
tvendov | 0:6435b67ad23c | 175 | uint8_t device_subclass; |
tvendov | 0:6435b67ad23c | 176 | uint8_t proto; |
tvendov | 0:6435b67ad23c | 177 | bool speed; |
tvendov | 0:6435b67ad23c | 178 | volatile bool activeAddr; |
tvendov | 0:6435b67ad23c | 179 | volatile bool enumerated; |
tvendov | 0:6435b67ad23c | 180 | uint8_t nb_interf; |
tvendov | 0:6435b67ad23c | 181 | |
tvendov | 0:6435b67ad23c | 182 | void init(); |
tvendov | 0:6435b67ad23c | 183 | }; |
tvendov | 0:6435b67ad23c | 184 | |
tvendov | 0:6435b67ad23c | 185 | #endif |