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-2015 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 "I2C.h"
tvendov 0:6435b67ad23c 17
tvendov 0:6435b67ad23c 18 #if DEVICE_I2C
tvendov 0:6435b67ad23c 19
tvendov 0:6435b67ad23c 20 namespace mbed {
tvendov 0:6435b67ad23c 21
tvendov 0:6435b67ad23c 22 I2C *I2C::_owner = NULL;
tvendov 0:6435b67ad23c 23 SingletonPtr<PlatformMutex> I2C::_mutex;
tvendov 0:6435b67ad23c 24
tvendov 0:6435b67ad23c 25 I2C::I2C(PinName sda, PinName scl) :
tvendov 0:6435b67ad23c 26 #if DEVICE_I2C_ASYNCH
tvendov 0:6435b67ad23c 27 _irq(this), _usage(DMA_USAGE_NEVER),
tvendov 0:6435b67ad23c 28 #endif
tvendov 0:6435b67ad23c 29 _i2c(), _hz(100000) {
tvendov 0:6435b67ad23c 30 // No lock needed in the constructor
tvendov 0:6435b67ad23c 31
tvendov 0:6435b67ad23c 32 // The init function also set the frequency to 100000
tvendov 0:6435b67ad23c 33 i2c_init(&_i2c, sda, scl);
tvendov 0:6435b67ad23c 34
tvendov 0:6435b67ad23c 35 // Used to avoid unnecessary frequency updates
tvendov 0:6435b67ad23c 36 _owner = this;
tvendov 0:6435b67ad23c 37 }
tvendov 0:6435b67ad23c 38
tvendov 0:6435b67ad23c 39 void I2C::frequency(int hz) {
tvendov 0:6435b67ad23c 40 lock();
tvendov 0:6435b67ad23c 41 _hz = hz;
tvendov 0:6435b67ad23c 42
tvendov 0:6435b67ad23c 43 // We want to update the frequency even if we are already the bus owners
tvendov 0:6435b67ad23c 44 i2c_frequency(&_i2c, _hz);
tvendov 0:6435b67ad23c 45
tvendov 0:6435b67ad23c 46 // Updating the frequency of the bus we become the owners of it
tvendov 0:6435b67ad23c 47 _owner = this;
tvendov 0:6435b67ad23c 48 unlock();
tvendov 0:6435b67ad23c 49 }
tvendov 0:6435b67ad23c 50
tvendov 0:6435b67ad23c 51 void I2C::aquire() {
tvendov 0:6435b67ad23c 52 lock();
tvendov 0:6435b67ad23c 53 if (_owner != this) {
tvendov 0:6435b67ad23c 54 i2c_frequency(&_i2c, _hz);
tvendov 0:6435b67ad23c 55 _owner = this;
tvendov 0:6435b67ad23c 56 }
tvendov 0:6435b67ad23c 57 unlock();
tvendov 0:6435b67ad23c 58 }
tvendov 0:6435b67ad23c 59
tvendov 0:6435b67ad23c 60 // write - Master Transmitter Mode
tvendov 0:6435b67ad23c 61 int I2C::write(int address, const char* data, int length, bool repeated) {
tvendov 0:6435b67ad23c 62 lock();
tvendov 0:6435b67ad23c 63 aquire();
tvendov 0:6435b67ad23c 64
tvendov 0:6435b67ad23c 65 int stop = (repeated) ? 0 : 1;
tvendov 0:6435b67ad23c 66 int written = i2c_write(&_i2c, address, data, length, stop);
tvendov 0:6435b67ad23c 67
tvendov 0:6435b67ad23c 68 unlock();
tvendov 0:6435b67ad23c 69 return length != written;
tvendov 0:6435b67ad23c 70 }
tvendov 0:6435b67ad23c 71
tvendov 0:6435b67ad23c 72 int I2C::write(int data) {
tvendov 0:6435b67ad23c 73 lock();
tvendov 0:6435b67ad23c 74 int ret = i2c_byte_write(&_i2c, data);
tvendov 0:6435b67ad23c 75 unlock();
tvendov 0:6435b67ad23c 76 return ret;
tvendov 0:6435b67ad23c 77 }
tvendov 0:6435b67ad23c 78
tvendov 0:6435b67ad23c 79 // read - Master Reciever Mode
tvendov 0:6435b67ad23c 80 int I2C::read(int address, char* data, int length, bool repeated) {
tvendov 0:6435b67ad23c 81 lock();
tvendov 0:6435b67ad23c 82 aquire();
tvendov 0:6435b67ad23c 83
tvendov 0:6435b67ad23c 84 int stop = (repeated) ? 0 : 1;
tvendov 0:6435b67ad23c 85 int read = i2c_read(&_i2c, address, data, length, stop);
tvendov 0:6435b67ad23c 86
tvendov 0:6435b67ad23c 87 unlock();
tvendov 0:6435b67ad23c 88 return length != read;
tvendov 0:6435b67ad23c 89 }
tvendov 0:6435b67ad23c 90
tvendov 0:6435b67ad23c 91 int I2C::read(int ack) {
tvendov 0:6435b67ad23c 92 lock();
tvendov 0:6435b67ad23c 93 int ret;
tvendov 0:6435b67ad23c 94 if (ack) {
tvendov 0:6435b67ad23c 95 ret = i2c_byte_read(&_i2c, 0);
tvendov 0:6435b67ad23c 96 } else {
tvendov 0:6435b67ad23c 97 ret = i2c_byte_read(&_i2c, 1);
tvendov 0:6435b67ad23c 98 }
tvendov 0:6435b67ad23c 99 unlock();
tvendov 0:6435b67ad23c 100 return ret;
tvendov 0:6435b67ad23c 101 }
tvendov 0:6435b67ad23c 102
tvendov 0:6435b67ad23c 103 void I2C::start(void) {
tvendov 0:6435b67ad23c 104 lock();
tvendov 0:6435b67ad23c 105 i2c_start(&_i2c);
tvendov 0:6435b67ad23c 106 unlock();
tvendov 0:6435b67ad23c 107 }
tvendov 0:6435b67ad23c 108
tvendov 0:6435b67ad23c 109 void I2C::stop(void) {
tvendov 0:6435b67ad23c 110 lock();
tvendov 0:6435b67ad23c 111 i2c_stop(&_i2c);
tvendov 0:6435b67ad23c 112 unlock();
tvendov 0:6435b67ad23c 113 }
tvendov 0:6435b67ad23c 114
tvendov 0:6435b67ad23c 115 void I2C::lock() {
tvendov 0:6435b67ad23c 116 _mutex->lock();
tvendov 0:6435b67ad23c 117 }
tvendov 0:6435b67ad23c 118
tvendov 0:6435b67ad23c 119 void I2C::unlock() {
tvendov 0:6435b67ad23c 120 _mutex->unlock();
tvendov 0:6435b67ad23c 121 }
tvendov 0:6435b67ad23c 122
tvendov 0:6435b67ad23c 123 #if DEVICE_I2C_ASYNCH
tvendov 0:6435b67ad23c 124
tvendov 0:6435b67ad23c 125 int I2C::transfer(int address, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t& callback, int event, bool repeated)
tvendov 0:6435b67ad23c 126 {
tvendov 0:6435b67ad23c 127 lock();
tvendov 0:6435b67ad23c 128 if (i2c_active(&_i2c)) {
tvendov 0:6435b67ad23c 129 unlock();
tvendov 0:6435b67ad23c 130 return -1; // transaction ongoing
tvendov 0:6435b67ad23c 131 }
tvendov 0:6435b67ad23c 132 aquire();
tvendov 0:6435b67ad23c 133
tvendov 0:6435b67ad23c 134 _callback = callback;
tvendov 0:6435b67ad23c 135 int stop = (repeated) ? 0 : 1;
tvendov 0:6435b67ad23c 136 _irq.callback(&I2C::irq_handler_asynch);
tvendov 0:6435b67ad23c 137 i2c_transfer_asynch(&_i2c, (void *)tx_buffer, tx_length, (void *)rx_buffer, rx_length, address, stop, _irq.entry(), event, _usage);
tvendov 0:6435b67ad23c 138 unlock();
tvendov 0:6435b67ad23c 139 return 0;
tvendov 0:6435b67ad23c 140 }
tvendov 0:6435b67ad23c 141
tvendov 0:6435b67ad23c 142 void I2C::abort_transfer(void)
tvendov 0:6435b67ad23c 143 {
tvendov 0:6435b67ad23c 144 lock();
tvendov 0:6435b67ad23c 145 i2c_abort_asynch(&_i2c);
tvendov 0:6435b67ad23c 146 unlock();
tvendov 0:6435b67ad23c 147 }
tvendov 0:6435b67ad23c 148
tvendov 0:6435b67ad23c 149 void I2C::irq_handler_asynch(void)
tvendov 0:6435b67ad23c 150 {
tvendov 0:6435b67ad23c 151 int event = i2c_irq_handler_asynch(&_i2c);
tvendov 0:6435b67ad23c 152 if (_callback && event) {
tvendov 0:6435b67ad23c 153 _callback.call(event);
tvendov 0:6435b67ad23c 154 }
tvendov 0:6435b67ad23c 155
tvendov 0:6435b67ad23c 156 }
tvendov 0:6435b67ad23c 157
tvendov 0:6435b67ad23c 158
tvendov 0:6435b67ad23c 159 #endif
tvendov 0:6435b67ad23c 160
tvendov 0:6435b67ad23c 161 } // namespace mbed
tvendov 0:6435b67ad23c 162
tvendov 0:6435b67ad23c 163 #endif
tvendov 0:6435b67ad23c 164