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
hal/common/Stream.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 Microcontroller 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 | #include "Stream.h" |
tvendov | 0:6435b67ad23c | 17 | |
tvendov | 0:6435b67ad23c | 18 | namespace mbed { |
tvendov | 0:6435b67ad23c | 19 | |
tvendov | 0:6435b67ad23c | 20 | Stream::Stream(const char *name) : FileLike(name), _file(NULL) { |
tvendov | 0:6435b67ad23c | 21 | // No lock needed in constructor |
tvendov | 0:6435b67ad23c | 22 | /* open ourselves */ |
tvendov | 0:6435b67ad23c | 23 | char buf[12]; /* :0x12345678 + null byte */ |
tvendov | 0:6435b67ad23c | 24 | std::sprintf(buf, ":%p", this); |
tvendov | 0:6435b67ad23c | 25 | _file = std::fopen(buf, "w+"); |
tvendov | 0:6435b67ad23c | 26 | mbed_set_unbuffered_stream(_file); |
tvendov | 0:6435b67ad23c | 27 | } |
tvendov | 0:6435b67ad23c | 28 | |
tvendov | 0:6435b67ad23c | 29 | Stream::~Stream() { |
tvendov | 0:6435b67ad23c | 30 | // No lock can be used in destructor |
tvendov | 0:6435b67ad23c | 31 | fclose(_file); |
tvendov | 0:6435b67ad23c | 32 | } |
tvendov | 0:6435b67ad23c | 33 | |
tvendov | 0:6435b67ad23c | 34 | int Stream::putc(int c) { |
tvendov | 0:6435b67ad23c | 35 | lock(); |
tvendov | 0:6435b67ad23c | 36 | fflush(_file); |
tvendov | 0:6435b67ad23c | 37 | int ret = std::fputc(c, _file); |
tvendov | 0:6435b67ad23c | 38 | unlock(); |
tvendov | 0:6435b67ad23c | 39 | return ret; |
tvendov | 0:6435b67ad23c | 40 | } |
tvendov | 0:6435b67ad23c | 41 | int Stream::puts(const char *s) { |
tvendov | 0:6435b67ad23c | 42 | lock(); |
tvendov | 0:6435b67ad23c | 43 | fflush(_file); |
tvendov | 0:6435b67ad23c | 44 | int ret = std::fputs(s, _file); |
tvendov | 0:6435b67ad23c | 45 | unlock(); |
tvendov | 0:6435b67ad23c | 46 | return ret; |
tvendov | 0:6435b67ad23c | 47 | } |
tvendov | 0:6435b67ad23c | 48 | int Stream::getc() { |
tvendov | 0:6435b67ad23c | 49 | lock(); |
tvendov | 0:6435b67ad23c | 50 | fflush(_file); |
tvendov | 0:6435b67ad23c | 51 | int ret = mbed_getc(_file); |
tvendov | 0:6435b67ad23c | 52 | unlock(); |
tvendov | 0:6435b67ad23c | 53 | return ret; |
tvendov | 0:6435b67ad23c | 54 | } |
tvendov | 0:6435b67ad23c | 55 | char* Stream::gets(char *s, int size) { |
tvendov | 0:6435b67ad23c | 56 | lock(); |
tvendov | 0:6435b67ad23c | 57 | fflush(_file); |
tvendov | 0:6435b67ad23c | 58 | char *ret = mbed_gets(s,size,_file); |
tvendov | 0:6435b67ad23c | 59 | unlock(); |
tvendov | 0:6435b67ad23c | 60 | return ret; |
tvendov | 0:6435b67ad23c | 61 | } |
tvendov | 0:6435b67ad23c | 62 | |
tvendov | 0:6435b67ad23c | 63 | int Stream::close() { |
tvendov | 0:6435b67ad23c | 64 | return 0; |
tvendov | 0:6435b67ad23c | 65 | } |
tvendov | 0:6435b67ad23c | 66 | |
tvendov | 0:6435b67ad23c | 67 | ssize_t Stream::write(const void* buffer, size_t length) { |
tvendov | 0:6435b67ad23c | 68 | const char* ptr = (const char*)buffer; |
tvendov | 0:6435b67ad23c | 69 | const char* end = ptr + length; |
tvendov | 0:6435b67ad23c | 70 | |
tvendov | 0:6435b67ad23c | 71 | lock(); |
tvendov | 0:6435b67ad23c | 72 | while (ptr != end) { |
tvendov | 0:6435b67ad23c | 73 | if (_putc(*ptr++) == EOF) { |
tvendov | 0:6435b67ad23c | 74 | break; |
tvendov | 0:6435b67ad23c | 75 | } |
tvendov | 0:6435b67ad23c | 76 | } |
tvendov | 0:6435b67ad23c | 77 | unlock(); |
tvendov | 0:6435b67ad23c | 78 | |
tvendov | 0:6435b67ad23c | 79 | return ptr - (const char*)buffer; |
tvendov | 0:6435b67ad23c | 80 | } |
tvendov | 0:6435b67ad23c | 81 | |
tvendov | 0:6435b67ad23c | 82 | ssize_t Stream::read(void* buffer, size_t length) { |
tvendov | 0:6435b67ad23c | 83 | char* ptr = (char*)buffer; |
tvendov | 0:6435b67ad23c | 84 | char* end = ptr + length; |
tvendov | 0:6435b67ad23c | 85 | |
tvendov | 0:6435b67ad23c | 86 | lock(); |
tvendov | 0:6435b67ad23c | 87 | while (ptr != end) { |
tvendov | 0:6435b67ad23c | 88 | int c = _getc(); |
tvendov | 0:6435b67ad23c | 89 | if (c==EOF) break; |
tvendov | 0:6435b67ad23c | 90 | *ptr++ = c; |
tvendov | 0:6435b67ad23c | 91 | } |
tvendov | 0:6435b67ad23c | 92 | unlock(); |
tvendov | 0:6435b67ad23c | 93 | |
tvendov | 0:6435b67ad23c | 94 | return ptr - (const char*)buffer; |
tvendov | 0:6435b67ad23c | 95 | } |
tvendov | 0:6435b67ad23c | 96 | |
tvendov | 0:6435b67ad23c | 97 | off_t Stream::lseek(off_t offset, int whence) { |
tvendov | 0:6435b67ad23c | 98 | return 0; |
tvendov | 0:6435b67ad23c | 99 | } |
tvendov | 0:6435b67ad23c | 100 | |
tvendov | 0:6435b67ad23c | 101 | int Stream::isatty() { |
tvendov | 0:6435b67ad23c | 102 | return 0; |
tvendov | 0:6435b67ad23c | 103 | } |
tvendov | 0:6435b67ad23c | 104 | |
tvendov | 0:6435b67ad23c | 105 | int Stream::fsync() { |
tvendov | 0:6435b67ad23c | 106 | return 0; |
tvendov | 0:6435b67ad23c | 107 | } |
tvendov | 0:6435b67ad23c | 108 | |
tvendov | 0:6435b67ad23c | 109 | off_t Stream::flen() { |
tvendov | 0:6435b67ad23c | 110 | return 0; |
tvendov | 0:6435b67ad23c | 111 | } |
tvendov | 0:6435b67ad23c | 112 | |
tvendov | 0:6435b67ad23c | 113 | int Stream::printf(const char* format, ...) { |
tvendov | 0:6435b67ad23c | 114 | lock(); |
tvendov | 0:6435b67ad23c | 115 | std::va_list arg; |
tvendov | 0:6435b67ad23c | 116 | va_start(arg, format); |
tvendov | 0:6435b67ad23c | 117 | fflush(_file); |
tvendov | 0:6435b67ad23c | 118 | int r = vfprintf(_file, format, arg); |
tvendov | 0:6435b67ad23c | 119 | va_end(arg); |
tvendov | 0:6435b67ad23c | 120 | unlock(); |
tvendov | 0:6435b67ad23c | 121 | return r; |
tvendov | 0:6435b67ad23c | 122 | } |
tvendov | 0:6435b67ad23c | 123 | |
tvendov | 0:6435b67ad23c | 124 | int Stream::scanf(const char* format, ...) { |
tvendov | 0:6435b67ad23c | 125 | lock(); |
tvendov | 0:6435b67ad23c | 126 | std::va_list arg; |
tvendov | 0:6435b67ad23c | 127 | va_start(arg, format); |
tvendov | 0:6435b67ad23c | 128 | fflush(_file); |
tvendov | 0:6435b67ad23c | 129 | int r = vfscanf(_file, format, arg); |
tvendov | 0:6435b67ad23c | 130 | va_end(arg); |
tvendov | 0:6435b67ad23c | 131 | unlock(); |
tvendov | 0:6435b67ad23c | 132 | return r; |
tvendov | 0:6435b67ad23c | 133 | } |
tvendov | 0:6435b67ad23c | 134 | |
tvendov | 0:6435b67ad23c | 135 | int Stream::vprintf(const char* format, std::va_list args) { |
tvendov | 0:6435b67ad23c | 136 | lock(); |
tvendov | 0:6435b67ad23c | 137 | fflush(_file); |
tvendov | 0:6435b67ad23c | 138 | int r = vfprintf(_file, format, args); |
tvendov | 0:6435b67ad23c | 139 | unlock(); |
tvendov | 0:6435b67ad23c | 140 | return r; |
tvendov | 0:6435b67ad23c | 141 | } |
tvendov | 0:6435b67ad23c | 142 | |
tvendov | 0:6435b67ad23c | 143 | int Stream::vscanf(const char* format, std::va_list args) { |
tvendov | 0:6435b67ad23c | 144 | lock(); |
tvendov | 0:6435b67ad23c | 145 | fflush(_file); |
tvendov | 0:6435b67ad23c | 146 | int r = vfscanf(_file, format, args); |
tvendov | 0:6435b67ad23c | 147 | unlock(); |
tvendov | 0:6435b67ad23c | 148 | return r; |
tvendov | 0:6435b67ad23c | 149 | } |
tvendov | 0:6435b67ad23c | 150 | |
tvendov | 0:6435b67ad23c | 151 | } // namespace mbed |
tvendov | 0:6435b67ad23c | 152 |