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.cpp@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 | #include "USBDeviceConnected.h" |
tvendov | 0:6435b67ad23c | 18 | #include "dbg.h" |
tvendov | 0:6435b67ad23c | 19 | |
tvendov | 0:6435b67ad23c | 20 | USBDeviceConnected::USBDeviceConnected() { |
tvendov | 0:6435b67ad23c | 21 | init(); |
tvendov | 0:6435b67ad23c | 22 | } |
tvendov | 0:6435b67ad23c | 23 | |
tvendov | 0:6435b67ad23c | 24 | void USBDeviceConnected::init() { |
tvendov | 0:6435b67ad23c | 25 | hub_nb = 0; |
tvendov | 0:6435b67ad23c | 26 | port = 0; |
tvendov | 0:6435b67ad23c | 27 | vid = 0; |
tvendov | 0:6435b67ad23c | 28 | pid = 0; |
tvendov | 0:6435b67ad23c | 29 | nb_interf = 0; |
tvendov | 0:6435b67ad23c | 30 | enumerated = false; |
tvendov | 0:6435b67ad23c | 31 | activeAddr = false; |
tvendov | 0:6435b67ad23c | 32 | sizeControlEndpoint = 8; |
tvendov | 0:6435b67ad23c | 33 | device_class = 0; |
tvendov | 0:6435b67ad23c | 34 | device_subclass = 0; |
tvendov | 0:6435b67ad23c | 35 | proto = 0; |
tvendov | 0:6435b67ad23c | 36 | speed = false; |
tvendov | 0:6435b67ad23c | 37 | for (int i = 0; i < MAX_INTF; i++) { |
tvendov | 0:6435b67ad23c | 38 | memset((void *)&intf[i], 0, sizeof(INTERFACE)); |
tvendov | 0:6435b67ad23c | 39 | intf[i].in_use = false; |
tvendov | 0:6435b67ad23c | 40 | for (int j = 0; j < MAX_ENDPOINT_PER_INTERFACE; j++) { |
tvendov | 0:6435b67ad23c | 41 | intf[i].ep[j] = NULL; |
tvendov | 0:6435b67ad23c | 42 | strcpy(intf[i].name, "Unknown"); |
tvendov | 0:6435b67ad23c | 43 | } |
tvendov | 0:6435b67ad23c | 44 | } |
tvendov | 0:6435b67ad23c | 45 | hub_parent = NULL; |
tvendov | 0:6435b67ad23c | 46 | hub = NULL; |
tvendov | 0:6435b67ad23c | 47 | nb_interf = 0; |
tvendov | 0:6435b67ad23c | 48 | } |
tvendov | 0:6435b67ad23c | 49 | |
tvendov | 0:6435b67ad23c | 50 | INTERFACE * USBDeviceConnected::getInterface(uint8_t index) { |
tvendov | 0:6435b67ad23c | 51 | if (index >= MAX_INTF) |
tvendov | 0:6435b67ad23c | 52 | return NULL; |
tvendov | 0:6435b67ad23c | 53 | |
tvendov | 0:6435b67ad23c | 54 | if (intf[index].in_use) |
tvendov | 0:6435b67ad23c | 55 | return &intf[index]; |
tvendov | 0:6435b67ad23c | 56 | |
tvendov | 0:6435b67ad23c | 57 | return NULL; |
tvendov | 0:6435b67ad23c | 58 | } |
tvendov | 0:6435b67ad23c | 59 | |
tvendov | 0:6435b67ad23c | 60 | bool USBDeviceConnected::addInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) { |
tvendov | 0:6435b67ad23c | 61 | if ((intf_nb >= MAX_INTF) || (intf[intf_nb].in_use)) { |
tvendov | 0:6435b67ad23c | 62 | return false; |
tvendov | 0:6435b67ad23c | 63 | } |
tvendov | 0:6435b67ad23c | 64 | intf[intf_nb].in_use = true; |
tvendov | 0:6435b67ad23c | 65 | intf[intf_nb].intf_class = intf_class; |
tvendov | 0:6435b67ad23c | 66 | intf[intf_nb].intf_subclass = intf_subclass; |
tvendov | 0:6435b67ad23c | 67 | intf[intf_nb].intf_protocol = intf_protocol; |
tvendov | 0:6435b67ad23c | 68 | intf[intf_nb].nb_endpoint = 0; |
tvendov | 0:6435b67ad23c | 69 | return true; |
tvendov | 0:6435b67ad23c | 70 | } |
tvendov | 0:6435b67ad23c | 71 | |
tvendov | 0:6435b67ad23c | 72 | bool USBDeviceConnected::addEndpoint(uint8_t intf_nb, USBEndpoint * ept) { |
tvendov | 0:6435b67ad23c | 73 | if ((intf_nb >= MAX_INTF) || (intf[intf_nb].in_use == false) || (intf[intf_nb].nb_endpoint >= MAX_ENDPOINT_PER_INTERFACE)) { |
tvendov | 0:6435b67ad23c | 74 | return false; |
tvendov | 0:6435b67ad23c | 75 | } |
tvendov | 0:6435b67ad23c | 76 | intf[intf_nb].nb_endpoint++; |
tvendov | 0:6435b67ad23c | 77 | |
tvendov | 0:6435b67ad23c | 78 | for (int i = 0; i < MAX_ENDPOINT_PER_INTERFACE; i++) { |
tvendov | 0:6435b67ad23c | 79 | if (intf[intf_nb].ep[i] == NULL) { |
tvendov | 0:6435b67ad23c | 80 | intf[intf_nb].ep[i] = ept; |
tvendov | 0:6435b67ad23c | 81 | return true; |
tvendov | 0:6435b67ad23c | 82 | } |
tvendov | 0:6435b67ad23c | 83 | } |
tvendov | 0:6435b67ad23c | 84 | return false; |
tvendov | 0:6435b67ad23c | 85 | } |
tvendov | 0:6435b67ad23c | 86 | |
tvendov | 0:6435b67ad23c | 87 | void USBDeviceConnected::init(uint8_t hub_, uint8_t port_, bool lowSpeed_) { |
tvendov | 0:6435b67ad23c | 88 | USB_DBG("init dev: %p", this); |
tvendov | 0:6435b67ad23c | 89 | init(); |
tvendov | 0:6435b67ad23c | 90 | hub_nb = hub_; |
tvendov | 0:6435b67ad23c | 91 | port = port_; |
tvendov | 0:6435b67ad23c | 92 | speed = lowSpeed_; |
tvendov | 0:6435b67ad23c | 93 | } |
tvendov | 0:6435b67ad23c | 94 | |
tvendov | 0:6435b67ad23c | 95 | void USBDeviceConnected::disconnect() { |
tvendov | 0:6435b67ad23c | 96 | for(int i = 0; i < MAX_INTF; i++) { |
tvendov | 0:6435b67ad23c | 97 | intf[i].detach.call(); |
tvendov | 0:6435b67ad23c | 98 | } |
tvendov | 0:6435b67ad23c | 99 | init(); |
tvendov | 0:6435b67ad23c | 100 | } |
tvendov | 0:6435b67ad23c | 101 | |
tvendov | 0:6435b67ad23c | 102 | |
tvendov | 0:6435b67ad23c | 103 | USBEndpoint * USBDeviceConnected::getEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir, uint8_t index) { |
tvendov | 0:6435b67ad23c | 104 | if (intf_nb >= MAX_INTF) { |
tvendov | 0:6435b67ad23c | 105 | return NULL; |
tvendov | 0:6435b67ad23c | 106 | } |
tvendov | 0:6435b67ad23c | 107 | for (int i = 0; i < MAX_ENDPOINT_PER_INTERFACE; i++) { |
tvendov | 0:6435b67ad23c | 108 | if ((intf[intf_nb].ep[i]->getType() == type) && (intf[intf_nb].ep[i]->getDir() == dir)) { |
tvendov | 0:6435b67ad23c | 109 | if(index) { |
tvendov | 0:6435b67ad23c | 110 | index--; |
tvendov | 0:6435b67ad23c | 111 | } else { |
tvendov | 0:6435b67ad23c | 112 | return intf[intf_nb].ep[i]; |
tvendov | 0:6435b67ad23c | 113 | } |
tvendov | 0:6435b67ad23c | 114 | } |
tvendov | 0:6435b67ad23c | 115 | } |
tvendov | 0:6435b67ad23c | 116 | return NULL; |
tvendov | 0:6435b67ad23c | 117 | } |
tvendov | 0:6435b67ad23c | 118 | |
tvendov | 0:6435b67ad23c | 119 | USBEndpoint * USBDeviceConnected::getEndpoint(uint8_t intf_nb, uint8_t index) { |
tvendov | 0:6435b67ad23c | 120 | if ((intf_nb >= MAX_INTF) || (index >= MAX_ENDPOINT_PER_INTERFACE)) { |
tvendov | 0:6435b67ad23c | 121 | return NULL; |
tvendov | 0:6435b67ad23c | 122 | } |
tvendov | 0:6435b67ad23c | 123 | return intf[intf_nb].ep[index]; |
tvendov | 0:6435b67ad23c | 124 | } |