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

/media/uploads/tvendov/front_view_hmi_50.png /media/uploads/tvendov/side_view_hmi_50.png

VKLCD70RT

/media/uploads/tvendov/front_view_hmi_70.png/media/uploads/tvendov/side_view_hmi_70.png /media/uploads/tvendov/front_view_lvds.png/media/uploads/tvendov/back_view_lvds.png


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.
      • After import in the online compiler just leave only the VKRZA1H_RAM.sct & delete all others linker files in the TOOLCHAIN_ARM_STD folder.
      • Save the result binary in the SD Card (<SD>:\vkrza1\lcd_sample ), altering vkrza1h.ini by this way
    • 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

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?

UserRevisionLine numberNew 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 "SerialBase.h"
tvendov 0:6435b67ad23c 17 #include "wait_api.h"
tvendov 0:6435b67ad23c 18 #include "critical.h"
tvendov 0:6435b67ad23c 19
tvendov 0:6435b67ad23c 20 #if DEVICE_SERIAL
tvendov 0:6435b67ad23c 21
tvendov 0:6435b67ad23c 22 namespace mbed {
tvendov 0:6435b67ad23c 23
tvendov 0:6435b67ad23c 24 SerialBase::SerialBase(PinName tx, PinName rx) :
tvendov 0:6435b67ad23c 25 #if DEVICE_SERIAL_ASYNCH
tvendov 0:6435b67ad23c 26 _thunk_irq(this), _tx_usage(DMA_USAGE_NEVER),
tvendov 0:6435b67ad23c 27 _rx_usage(DMA_USAGE_NEVER),
tvendov 0:6435b67ad23c 28 #endif
tvendov 0:6435b67ad23c 29 _serial(), _baud(9600) {
tvendov 0:6435b67ad23c 30 // No lock needed in the constructor
tvendov 0:6435b67ad23c 31
tvendov 0:6435b67ad23c 32 serial_init(&_serial, tx, rx);
tvendov 0:6435b67ad23c 33 serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
tvendov 0:6435b67ad23c 34 }
tvendov 0:6435b67ad23c 35
tvendov 0:6435b67ad23c 36 void SerialBase::baud(int baudrate) {
tvendov 0:6435b67ad23c 37 lock();
tvendov 0:6435b67ad23c 38 serial_baud(&_serial, baudrate);
tvendov 0:6435b67ad23c 39 _baud = baudrate;
tvendov 0:6435b67ad23c 40 unlock();
tvendov 0:6435b67ad23c 41 }
tvendov 0:6435b67ad23c 42
tvendov 0:6435b67ad23c 43 void SerialBase::format(int bits, Parity parity, int stop_bits) {
tvendov 0:6435b67ad23c 44 lock();
tvendov 0:6435b67ad23c 45 serial_format(&_serial, bits, (SerialParity)parity, stop_bits);
tvendov 0:6435b67ad23c 46 unlock();
tvendov 0:6435b67ad23c 47 }
tvendov 0:6435b67ad23c 48
tvendov 0:6435b67ad23c 49 int SerialBase::readable() {
tvendov 0:6435b67ad23c 50 lock();
tvendov 0:6435b67ad23c 51 int ret = serial_readable(&_serial);
tvendov 0:6435b67ad23c 52 unlock();
tvendov 0:6435b67ad23c 53 return ret;
tvendov 0:6435b67ad23c 54 }
tvendov 0:6435b67ad23c 55
tvendov 0:6435b67ad23c 56
tvendov 0:6435b67ad23c 57 int SerialBase::writeable() {
tvendov 0:6435b67ad23c 58 lock();
tvendov 0:6435b67ad23c 59 int ret = serial_writable(&_serial);
tvendov 0:6435b67ad23c 60 unlock();
tvendov 0:6435b67ad23c 61 return ret;
tvendov 0:6435b67ad23c 62 }
tvendov 0:6435b67ad23c 63
tvendov 0:6435b67ad23c 64 void SerialBase::attach(Callback<void()> func, IrqType type) {
tvendov 0:6435b67ad23c 65 lock();
tvendov 0:6435b67ad23c 66 // Disable interrupts when attaching interrupt handler
tvendov 0:6435b67ad23c 67 core_util_critical_section_enter();
tvendov 0:6435b67ad23c 68 if (func) {
tvendov 0:6435b67ad23c 69 _irq[type].attach(func);
tvendov 0:6435b67ad23c 70 serial_irq_set(&_serial, (SerialIrq)type, 1);
tvendov 0:6435b67ad23c 71 } else {
tvendov 0:6435b67ad23c 72 serial_irq_set(&_serial, (SerialIrq)type, 0);
tvendov 0:6435b67ad23c 73 }
tvendov 0:6435b67ad23c 74 core_util_critical_section_exit();
tvendov 0:6435b67ad23c 75 unlock();
tvendov 0:6435b67ad23c 76 }
tvendov 0:6435b67ad23c 77
tvendov 0:6435b67ad23c 78 void SerialBase::_irq_handler(uint32_t id, SerialIrq irq_type) {
tvendov 0:6435b67ad23c 79 SerialBase *handler = (SerialBase*)id;
tvendov 0:6435b67ad23c 80 handler->_irq[irq_type].call();
tvendov 0:6435b67ad23c 81 }
tvendov 0:6435b67ad23c 82
tvendov 0:6435b67ad23c 83 int SerialBase::_base_getc() {
tvendov 0:6435b67ad23c 84 // Mutex is already held
tvendov 0:6435b67ad23c 85 return serial_getc(&_serial);
tvendov 0:6435b67ad23c 86 }
tvendov 0:6435b67ad23c 87
tvendov 0:6435b67ad23c 88 int SerialBase::_base_putc(int c) {
tvendov 0:6435b67ad23c 89 // Mutex is already held
tvendov 0:6435b67ad23c 90 serial_putc(&_serial, c);
tvendov 0:6435b67ad23c 91 return c;
tvendov 0:6435b67ad23c 92 }
tvendov 0:6435b67ad23c 93
tvendov 0:6435b67ad23c 94 void SerialBase::send_break() {
tvendov 0:6435b67ad23c 95 lock();
tvendov 0:6435b67ad23c 96 // Wait for 1.5 frames before clearing the break condition
tvendov 0:6435b67ad23c 97 // This will have different effects on our platforms, but should
tvendov 0:6435b67ad23c 98 // ensure that we keep the break active for at least one frame.
tvendov 0:6435b67ad23c 99 // We consider a full frame (1 start bit + 8 data bits bits +
tvendov 0:6435b67ad23c 100 // 1 parity bit + 2 stop bits = 12 bits) for computation.
tvendov 0:6435b67ad23c 101 // One bit time (in us) = 1000000/_baud
tvendov 0:6435b67ad23c 102 // Twelve bits: 12000000/baud delay
tvendov 0:6435b67ad23c 103 // 1.5 frames: 18000000/baud delay
tvendov 0:6435b67ad23c 104 serial_break_set(&_serial);
tvendov 0:6435b67ad23c 105 wait_us(18000000/_baud);
tvendov 0:6435b67ad23c 106 serial_break_clear(&_serial);
tvendov 0:6435b67ad23c 107 unlock();
tvendov 0:6435b67ad23c 108 }
tvendov 0:6435b67ad23c 109
tvendov 0:6435b67ad23c 110 void SerialBase::lock() {
tvendov 0:6435b67ad23c 111 // Stub
tvendov 0:6435b67ad23c 112 }
tvendov 0:6435b67ad23c 113
tvendov 0:6435b67ad23c 114 void SerialBase:: unlock() {
tvendov 0:6435b67ad23c 115 // Stub
tvendov 0:6435b67ad23c 116 }
tvendov 0:6435b67ad23c 117
tvendov 0:6435b67ad23c 118 #if DEVICE_SERIAL_FC
tvendov 0:6435b67ad23c 119 void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2) {
tvendov 0:6435b67ad23c 120 lock();
tvendov 0:6435b67ad23c 121 FlowControl flow_type = (FlowControl)type;
tvendov 0:6435b67ad23c 122 switch(type) {
tvendov 0:6435b67ad23c 123 case RTS:
tvendov 0:6435b67ad23c 124 serial_set_flow_control(&_serial, flow_type, flow1, NC);
tvendov 0:6435b67ad23c 125 break;
tvendov 0:6435b67ad23c 126
tvendov 0:6435b67ad23c 127 case CTS:
tvendov 0:6435b67ad23c 128 serial_set_flow_control(&_serial, flow_type, NC, flow1);
tvendov 0:6435b67ad23c 129 break;
tvendov 0:6435b67ad23c 130
tvendov 0:6435b67ad23c 131 case RTSCTS:
tvendov 0:6435b67ad23c 132 case Disabled:
tvendov 0:6435b67ad23c 133 serial_set_flow_control(&_serial, flow_type, flow1, flow2);
tvendov 0:6435b67ad23c 134 break;
tvendov 0:6435b67ad23c 135
tvendov 0:6435b67ad23c 136 default:
tvendov 0:6435b67ad23c 137 break;
tvendov 0:6435b67ad23c 138 }
tvendov 0:6435b67ad23c 139 unlock();
tvendov 0:6435b67ad23c 140 }
tvendov 0:6435b67ad23c 141 #endif
tvendov 0:6435b67ad23c 142
tvendov 0:6435b67ad23c 143 #if DEVICE_SERIAL_ASYNCH
tvendov 0:6435b67ad23c 144
tvendov 0:6435b67ad23c 145 int SerialBase::write(const uint8_t *buffer, int length, const event_callback_t& callback, int event)
tvendov 0:6435b67ad23c 146 {
tvendov 0:6435b67ad23c 147 if (serial_tx_active(&_serial)) {
tvendov 0:6435b67ad23c 148 return -1; // transaction ongoing
tvendov 0:6435b67ad23c 149 }
tvendov 0:6435b67ad23c 150 start_write((void *)buffer, length, 8, callback, event);
tvendov 0:6435b67ad23c 151 return 0;
tvendov 0:6435b67ad23c 152 }
tvendov 0:6435b67ad23c 153
tvendov 0:6435b67ad23c 154 int SerialBase::write(const uint16_t *buffer, int length, const event_callback_t& callback, int event)
tvendov 0:6435b67ad23c 155 {
tvendov 0:6435b67ad23c 156 if (serial_tx_active(&_serial)) {
tvendov 0:6435b67ad23c 157 return -1; // transaction ongoing
tvendov 0:6435b67ad23c 158 }
tvendov 0:6435b67ad23c 159 start_write((void *)buffer, length, 16, callback, event);
tvendov 0:6435b67ad23c 160 return 0;
tvendov 0:6435b67ad23c 161 }
tvendov 0:6435b67ad23c 162
tvendov 0:6435b67ad23c 163 void SerialBase::start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event)
tvendov 0:6435b67ad23c 164 {
tvendov 0:6435b67ad23c 165 _tx_callback = callback;
tvendov 0:6435b67ad23c 166
tvendov 0:6435b67ad23c 167 _thunk_irq.callback(&SerialBase::interrupt_handler_asynch);
tvendov 0:6435b67ad23c 168 serial_tx_asynch(&_serial, buffer, buffer_size, buffer_width, _thunk_irq.entry(), event, _tx_usage);
tvendov 0:6435b67ad23c 169 }
tvendov 0:6435b67ad23c 170
tvendov 0:6435b67ad23c 171 void SerialBase::abort_write(void)
tvendov 0:6435b67ad23c 172 {
tvendov 0:6435b67ad23c 173 serial_tx_abort_asynch(&_serial);
tvendov 0:6435b67ad23c 174 }
tvendov 0:6435b67ad23c 175
tvendov 0:6435b67ad23c 176 void SerialBase::abort_read(void)
tvendov 0:6435b67ad23c 177 {
tvendov 0:6435b67ad23c 178 serial_rx_abort_asynch(&_serial);
tvendov 0:6435b67ad23c 179 }
tvendov 0:6435b67ad23c 180
tvendov 0:6435b67ad23c 181 int SerialBase::set_dma_usage_tx(DMAUsage usage)
tvendov 0:6435b67ad23c 182 {
tvendov 0:6435b67ad23c 183 if (serial_tx_active(&_serial)) {
tvendov 0:6435b67ad23c 184 return -1;
tvendov 0:6435b67ad23c 185 }
tvendov 0:6435b67ad23c 186 _tx_usage = usage;
tvendov 0:6435b67ad23c 187 return 0;
tvendov 0:6435b67ad23c 188 }
tvendov 0:6435b67ad23c 189
tvendov 0:6435b67ad23c 190 int SerialBase::set_dma_usage_rx(DMAUsage usage)
tvendov 0:6435b67ad23c 191 {
tvendov 0:6435b67ad23c 192 if (serial_tx_active(&_serial)) {
tvendov 0:6435b67ad23c 193 return -1;
tvendov 0:6435b67ad23c 194 }
tvendov 0:6435b67ad23c 195 _rx_usage = usage;
tvendov 0:6435b67ad23c 196 return 0;
tvendov 0:6435b67ad23c 197 }
tvendov 0:6435b67ad23c 198
tvendov 0:6435b67ad23c 199 int SerialBase::read(uint8_t *buffer, int length, const event_callback_t& callback, int event, unsigned char char_match)
tvendov 0:6435b67ad23c 200 {
tvendov 0:6435b67ad23c 201 if (serial_rx_active(&_serial)) {
tvendov 0:6435b67ad23c 202 return -1; // transaction ongoing
tvendov 0:6435b67ad23c 203 }
tvendov 0:6435b67ad23c 204 start_read((void*)buffer, length, 8, callback, event, char_match);
tvendov 0:6435b67ad23c 205 return 0;
tvendov 0:6435b67ad23c 206 }
tvendov 0:6435b67ad23c 207
tvendov 0:6435b67ad23c 208
tvendov 0:6435b67ad23c 209 int SerialBase::read(uint16_t *buffer, int length, const event_callback_t& callback, int event, unsigned char char_match)
tvendov 0:6435b67ad23c 210 {
tvendov 0:6435b67ad23c 211 if (serial_rx_active(&_serial)) {
tvendov 0:6435b67ad23c 212 return -1; // transaction ongoing
tvendov 0:6435b67ad23c 213 }
tvendov 0:6435b67ad23c 214 start_read((void*)buffer, length, 16, callback, event, char_match);
tvendov 0:6435b67ad23c 215 return 0;
tvendov 0:6435b67ad23c 216 }
tvendov 0:6435b67ad23c 217
tvendov 0:6435b67ad23c 218
tvendov 0:6435b67ad23c 219 void SerialBase::start_read(void *buffer, int buffer_size, char buffer_width, const event_callback_t& callback, int event, unsigned char char_match)
tvendov 0:6435b67ad23c 220 {
tvendov 0:6435b67ad23c 221 _rx_callback = callback;
tvendov 0:6435b67ad23c 222 _thunk_irq.callback(&SerialBase::interrupt_handler_asynch);
tvendov 0:6435b67ad23c 223 serial_rx_asynch(&_serial, buffer, buffer_size, buffer_width, _thunk_irq.entry(), event, char_match, _rx_usage);
tvendov 0:6435b67ad23c 224 }
tvendov 0:6435b67ad23c 225
tvendov 0:6435b67ad23c 226 void SerialBase::interrupt_handler_asynch(void)
tvendov 0:6435b67ad23c 227 {
tvendov 0:6435b67ad23c 228 int event = serial_irq_handler_asynch(&_serial);
tvendov 0:6435b67ad23c 229 int rx_event = event & SERIAL_EVENT_RX_MASK;
tvendov 0:6435b67ad23c 230 if (_rx_callback && rx_event) {
tvendov 0:6435b67ad23c 231 _rx_callback.call(rx_event);
tvendov 0:6435b67ad23c 232 }
tvendov 0:6435b67ad23c 233
tvendov 0:6435b67ad23c 234 int tx_event = event & SERIAL_EVENT_TX_MASK;
tvendov 0:6435b67ad23c 235 if (_tx_callback && tx_event) {
tvendov 0:6435b67ad23c 236 _tx_callback.call(tx_event);
tvendov 0:6435b67ad23c 237 }
tvendov 0:6435b67ad23c 238 }
tvendov 0:6435b67ad23c 239
tvendov 0:6435b67ad23c 240 #endif
tvendov 0:6435b67ad23c 241
tvendov 0:6435b67ad23c 242 } // namespace mbed
tvendov 0:6435b67ad23c 243
tvendov 0:6435b67ad23c 244 #endif
tvendov 0:6435b67ad23c 245