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/USBHostCam/USBHostCam.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 | // USBHostCam.h |
tvendov | 0:6435b67ad23c | 2 | #include "USBHostConf.h" |
tvendov | 0:6435b67ad23c | 3 | #include "USBHost.h" |
tvendov | 0:6435b67ad23c | 4 | #include "USBIsochronous.h" |
tvendov | 0:6435b67ad23c | 5 | #include "BaseUvc.h" |
tvendov | 0:6435b67ad23c | 6 | #include "decodeMJPEG.h" |
tvendov | 0:6435b67ad23c | 7 | #pragma once |
tvendov | 0:6435b67ad23c | 8 | |
tvendov | 0:6435b67ad23c | 9 | #define _640x480 1 |
tvendov | 0:6435b67ad23c | 10 | #define _160x120 2 |
tvendov | 0:6435b67ad23c | 11 | #define _176x144 3 |
tvendov | 0:6435b67ad23c | 12 | #define _320x176 4 |
tvendov | 0:6435b67ad23c | 13 | #define _320x240 5 |
tvendov | 0:6435b67ad23c | 14 | #define _352x288 6 |
tvendov | 0:6435b67ad23c | 15 | #define _432x240 7 |
tvendov | 0:6435b67ad23c | 16 | #define _544x288 8 |
tvendov | 0:6435b67ad23c | 17 | #define _640x360 9 |
tvendov | 0:6435b67ad23c | 18 | // |
tvendov | 0:6435b67ad23c | 19 | #define _752x416 10 |
tvendov | 0:6435b67ad23c | 20 | #define _800x448 11 |
tvendov | 0:6435b67ad23c | 21 | #define _800x600 12 |
tvendov | 0:6435b67ad23c | 22 | // |
tvendov | 0:6435b67ad23c | 23 | #define _864x480 13 |
tvendov | 0:6435b67ad23c | 24 | #define _960x544 14 |
tvendov | 0:6435b67ad23c | 25 | #define _960x720 15 |
tvendov | 0:6435b67ad23c | 26 | // |
tvendov | 0:6435b67ad23c | 27 | #define _1024x576 16 |
tvendov | 0:6435b67ad23c | 28 | #define _1184x656 17 |
tvendov | 0:6435b67ad23c | 29 | #define _1280x720 18 |
tvendov | 0:6435b67ad23c | 30 | #define _1280x960 19 |
tvendov | 0:6435b67ad23c | 31 | |
tvendov | 0:6435b67ad23c | 32 | /* |
tvendov | 0:6435b67ad23c | 33 | #define _640x480 1 |
tvendov | 0:6435b67ad23c | 34 | #define _352x288 2 |
tvendov | 0:6435b67ad23c | 35 | #define _320x240 3 |
tvendov | 0:6435b67ad23c | 36 | #define _176x144 4 |
tvendov | 0:6435b67ad23c | 37 | #define _160x120 5 |
tvendov | 0:6435b67ad23c | 38 | #define _544x288 6 |
tvendov | 0:6435b67ad23c | 39 | #define _432x240 7 |
tvendov | 0:6435b67ad23c | 40 | #define _320x176 8 |
tvendov | 0:6435b67ad23c | 41 | #define _640x360 9 |
tvendov | 0:6435b67ad23c | 42 | |
tvendov | 0:6435b67ad23c | 43 | #define _800x480 10 |
tvendov | 0:6435b67ad23c | 44 | |
tvendov | 0:6435b67ad23c | 45 | #define _1024x768 11 |
tvendov | 0:6435b67ad23c | 46 | */ |
tvendov | 0:6435b67ad23c | 47 | |
tvendov | 0:6435b67ad23c | 48 | |
tvendov | 0:6435b67ad23c | 49 | #define TEST_ASSERT(A) while(!(A)){fprintf(stderr,"\n\n%s@%d %s ASSERT!\n\n",__PRETTY_FUNCTION__,__LINE__,#A);exit(1);}; |
tvendov | 0:6435b67ad23c | 50 | |
tvendov | 0:6435b67ad23c | 51 | struct CamInfo { |
tvendov | 0:6435b67ad23c | 52 | uint16_t vid; |
tvendov | 0:6435b67ad23c | 53 | uint16_t pid; |
tvendov | 0:6435b67ad23c | 54 | uint8_t size; |
tvendov | 0:6435b67ad23c | 55 | uint8_t option; |
tvendov | 0:6435b67ad23c | 56 | // |
tvendov | 0:6435b67ad23c | 57 | const char* name; |
tvendov | 0:6435b67ad23c | 58 | uint8_t formatIndex; |
tvendov | 0:6435b67ad23c | 59 | uint8_t frameIndex; |
tvendov | 0:6435b67ad23c | 60 | uint32_t interval; |
tvendov | 0:6435b67ad23c | 61 | uint8_t en; |
tvendov | 0:6435b67ad23c | 62 | uint16_t mps; |
tvendov | 0:6435b67ad23c | 63 | uint8_t if_alt; |
tvendov | 0:6435b67ad23c | 64 | uint8_t frameCount; // ITD frame count 1-8 |
tvendov | 0:6435b67ad23c | 65 | uint8_t queueLimit; // ITD queue limit 1-3 |
tvendov | 0:6435b67ad23c | 66 | }; |
tvendov | 0:6435b67ad23c | 67 | |
tvendov | 0:6435b67ad23c | 68 | /** |
tvendov | 0:6435b67ad23c | 69 | * A class to communicate a Cam |
tvendov | 0:6435b67ad23c | 70 | */ |
tvendov | 0:6435b67ad23c | 71 | class USBHostCam : public IUSBEnumerator, public BaseUvc, public decodeMJPEG { |
tvendov | 0:6435b67ad23c | 72 | public: |
tvendov | 0:6435b67ad23c | 73 | /** |
tvendov | 0:6435b67ad23c | 74 | * Constructor |
tvendov | 0:6435b67ad23c | 75 | * |
tvendov | 0:6435b67ad23c | 76 | */ |
tvendov | 0:6435b67ad23c | 77 | USBHostCam(uint8_t size = _160x120, uint8_t option = 0, CamInfo* user_caminfo = NULL); |
tvendov | 0:6435b67ad23c | 78 | |
tvendov | 0:6435b67ad23c | 79 | /** |
tvendov | 0:6435b67ad23c | 80 | * Check if a Cam device is connected |
tvendov | 0:6435b67ad23c | 81 | * |
tvendov | 0:6435b67ad23c | 82 | * @return true if a Cam device is connected |
tvendov | 0:6435b67ad23c | 83 | */ |
tvendov | 0:6435b67ad23c | 84 | bool connected(); |
tvendov | 0:6435b67ad23c | 85 | |
tvendov | 0:6435b67ad23c | 86 | /** |
tvendov | 0:6435b67ad23c | 87 | * Check if a usb connector is plugged |
tvendov | 0:6435b67ad23c | 88 | * |
tvendov | 0:6435b67ad23c | 89 | * @return true if a connector is plugged |
tvendov | 0:6435b67ad23c | 90 | */ |
tvendov | 0:6435b67ad23c | 91 | bool plugged(); |
tvendov | 0:6435b67ad23c | 92 | |
tvendov | 0:6435b67ad23c | 93 | /** |
tvendov | 0:6435b67ad23c | 94 | * Try to connect to a Cam device |
tvendov | 0:6435b67ad23c | 95 | * |
tvendov | 0:6435b67ad23c | 96 | * @return true if connection was successful |
tvendov | 0:6435b67ad23c | 97 | */ |
tvendov | 0:6435b67ad23c | 98 | bool connect(); |
tvendov | 0:6435b67ad23c | 99 | |
tvendov | 0:6435b67ad23c | 100 | /** |
tvendov | 0:6435b67ad23c | 101 | * read jpeg image |
tvendov | 0:6435b67ad23c | 102 | * |
tvendov | 0:6435b67ad23c | 103 | * @param buf read buffer |
tvendov | 0:6435b67ad23c | 104 | * @param size buffer size |
tvendov | 0:6435b67ad23c | 105 | * @param timeout_ms timeout default 15sec |
tvendov | 0:6435b67ad23c | 106 | * @return jpeg size if read success else -1 |
tvendov | 0:6435b67ad23c | 107 | */ |
tvendov | 0:6435b67ad23c | 108 | int readJPEG(uint8_t* buf, int size, int timeout_ms = 15*1000); |
tvendov | 0:6435b67ad23c | 109 | |
tvendov | 0:6435b67ad23c | 110 | protected: |
tvendov | 0:6435b67ad23c | 111 | //From IUSBEnumerator |
tvendov | 0:6435b67ad23c | 112 | virtual void setVidPid(uint16_t vid, uint16_t pid); |
tvendov | 0:6435b67ad23c | 113 | 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 |
tvendov | 0:6435b67ad23c | 114 | virtual bool useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir); //Must return true if the endpoint will be used |
tvendov | 0:6435b67ad23c | 115 | |
tvendov | 0:6435b67ad23c | 116 | private: |
tvendov | 0:6435b67ad23c | 117 | bool dev_connected; |
tvendov | 0:6435b67ad23c | 118 | |
tvendov | 0:6435b67ad23c | 119 | int cam_intf; |
tvendov | 0:6435b67ad23c | 120 | bool device_found; |
tvendov | 0:6435b67ad23c | 121 | bool caminfo_found; |
tvendov | 0:6435b67ad23c | 122 | uint8_t _seq; |
tvendov | 0:6435b67ad23c | 123 | uint8_t* _buf; |
tvendov | 0:6435b67ad23c | 124 | int _pos; |
tvendov | 0:6435b67ad23c | 125 | int _size; |
tvendov | 0:6435b67ad23c | 126 | CamInfo* CamInfoList; |
tvendov | 0:6435b67ad23c | 127 | CamInfo* caminfo; |
tvendov | 0:6435b67ad23c | 128 | uint8_t _caminfo_size; |
tvendov | 0:6435b67ad23c | 129 | uint8_t _caminfo_option; |
tvendov | 0:6435b67ad23c | 130 | |
tvendov | 0:6435b67ad23c | 131 | virtual void outputJPEG(uint8_t c, int status); // from decodeMJPEG |
tvendov | 0:6435b67ad23c | 132 | void callback_motion_jpeg(uint16_t frame, uint8_t* buf, int len); |
tvendov | 0:6435b67ad23c | 133 | void init(); |
tvendov | 0:6435b67ad23c | 134 | void onDisconnect(); |
tvendov | 0:6435b67ad23c | 135 | }; |