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 #ifndef MBED_CAN_H
tvendov 0:6435b67ad23c 17 #define MBED_CAN_H
tvendov 0:6435b67ad23c 18
tvendov 0:6435b67ad23c 19 #include "platform.h"
tvendov 0:6435b67ad23c 20
tvendov 0:6435b67ad23c 21 #if DEVICE_CAN
tvendov 0:6435b67ad23c 22
tvendov 0:6435b67ad23c 23 #include "can_api.h"
tvendov 0:6435b67ad23c 24 #include "can_helper.h"
tvendov 0:6435b67ad23c 25 #include "Callback.h"
tvendov 0:6435b67ad23c 26 #include "PlatformMutex.h"
tvendov 0:6435b67ad23c 27
tvendov 0:6435b67ad23c 28 namespace mbed {
tvendov 0:6435b67ad23c 29
tvendov 0:6435b67ad23c 30 /** CANMessage class
tvendov 0:6435b67ad23c 31 *
tvendov 0:6435b67ad23c 32 * @Note Synchronization level: Thread safe
tvendov 0:6435b67ad23c 33 */
tvendov 0:6435b67ad23c 34 class CANMessage : public CAN_Message {
tvendov 0:6435b67ad23c 35
tvendov 0:6435b67ad23c 36 public:
tvendov 0:6435b67ad23c 37 /** Creates empty CAN message.
tvendov 0:6435b67ad23c 38 */
tvendov 0:6435b67ad23c 39 CANMessage() : CAN_Message() {
tvendov 0:6435b67ad23c 40 len = 8;
tvendov 0:6435b67ad23c 41 type = CANData;
tvendov 0:6435b67ad23c 42 format = CANStandard;
tvendov 0:6435b67ad23c 43 id = 0;
tvendov 0:6435b67ad23c 44 memset(data, 0, 8);
tvendov 0:6435b67ad23c 45 }
tvendov 0:6435b67ad23c 46
tvendov 0:6435b67ad23c 47 /** Creates CAN message with specific content.
tvendov 0:6435b67ad23c 48 */
tvendov 0:6435b67ad23c 49 CANMessage(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) {
tvendov 0:6435b67ad23c 50 len = _len & 0xF;
tvendov 0:6435b67ad23c 51 type = _type;
tvendov 0:6435b67ad23c 52 format = _format;
tvendov 0:6435b67ad23c 53 id = _id;
tvendov 0:6435b67ad23c 54 memcpy(data, _data, _len);
tvendov 0:6435b67ad23c 55 }
tvendov 0:6435b67ad23c 56
tvendov 0:6435b67ad23c 57 /** Creates CAN remote message.
tvendov 0:6435b67ad23c 58 */
tvendov 0:6435b67ad23c 59 CANMessage(int _id, CANFormat _format = CANStandard) {
tvendov 0:6435b67ad23c 60 len = 0;
tvendov 0:6435b67ad23c 61 type = CANRemote;
tvendov 0:6435b67ad23c 62 format = _format;
tvendov 0:6435b67ad23c 63 id = _id;
tvendov 0:6435b67ad23c 64 memset(data, 0, 8);
tvendov 0:6435b67ad23c 65 }
tvendov 0:6435b67ad23c 66 };
tvendov 0:6435b67ad23c 67
tvendov 0:6435b67ad23c 68 /** A can bus client, used for communicating with can devices
tvendov 0:6435b67ad23c 69 */
tvendov 0:6435b67ad23c 70 class CAN {
tvendov 0:6435b67ad23c 71
tvendov 0:6435b67ad23c 72 public:
tvendov 0:6435b67ad23c 73 /** Creates an CAN interface connected to specific pins.
tvendov 0:6435b67ad23c 74 *
tvendov 0:6435b67ad23c 75 * @param rd read from transmitter
tvendov 0:6435b67ad23c 76 * @param td transmit to transmitter
tvendov 0:6435b67ad23c 77 *
tvendov 0:6435b67ad23c 78 * Example:
tvendov 0:6435b67ad23c 79 * @code
tvendov 0:6435b67ad23c 80 * #include "mbed.h"
tvendov 0:6435b67ad23c 81 *
tvendov 0:6435b67ad23c 82 * Ticker ticker;
tvendov 0:6435b67ad23c 83 * DigitalOut led1(LED1);
tvendov 0:6435b67ad23c 84 * DigitalOut led2(LED2);
tvendov 0:6435b67ad23c 85 * CAN can1(p9, p10);
tvendov 0:6435b67ad23c 86 * CAN can2(p30, p29);
tvendov 0:6435b67ad23c 87 *
tvendov 0:6435b67ad23c 88 * char counter = 0;
tvendov 0:6435b67ad23c 89 *
tvendov 0:6435b67ad23c 90 * void send() {
tvendov 0:6435b67ad23c 91 * if(can1.write(CANMessage(1337, &counter, 1))) {
tvendov 0:6435b67ad23c 92 * printf("Message sent: %d\n", counter);
tvendov 0:6435b67ad23c 93 * counter++;
tvendov 0:6435b67ad23c 94 * }
tvendov 0:6435b67ad23c 95 * led1 = !led1;
tvendov 0:6435b67ad23c 96 * }
tvendov 0:6435b67ad23c 97 *
tvendov 0:6435b67ad23c 98 * int main() {
tvendov 0:6435b67ad23c 99 * ticker.attach(&send, 1);
tvendov 0:6435b67ad23c 100 * CANMessage msg;
tvendov 0:6435b67ad23c 101 * while(1) {
tvendov 0:6435b67ad23c 102 * if(can2.read(msg)) {
tvendov 0:6435b67ad23c 103 * printf("Message received: %d\n\n", msg.data[0]);
tvendov 0:6435b67ad23c 104 * led2 = !led2;
tvendov 0:6435b67ad23c 105 * }
tvendov 0:6435b67ad23c 106 * wait(0.2);
tvendov 0:6435b67ad23c 107 * }
tvendov 0:6435b67ad23c 108 * }
tvendov 0:6435b67ad23c 109 * @endcode
tvendov 0:6435b67ad23c 110 */
tvendov 0:6435b67ad23c 111 CAN(PinName rd, PinName td);
tvendov 0:6435b67ad23c 112 virtual ~CAN();
tvendov 0:6435b67ad23c 113
tvendov 0:6435b67ad23c 114 /** Set the frequency of the CAN interface
tvendov 0:6435b67ad23c 115 *
tvendov 0:6435b67ad23c 116 * @param hz The bus frequency in hertz
tvendov 0:6435b67ad23c 117 *
tvendov 0:6435b67ad23c 118 * @returns
tvendov 0:6435b67ad23c 119 * 1 if successful,
tvendov 0:6435b67ad23c 120 * 0 otherwise
tvendov 0:6435b67ad23c 121 */
tvendov 0:6435b67ad23c 122 int frequency(int hz);
tvendov 0:6435b67ad23c 123
tvendov 0:6435b67ad23c 124 /** Write a CANMessage to the bus.
tvendov 0:6435b67ad23c 125 *
tvendov 0:6435b67ad23c 126 * @param msg The CANMessage to write.
tvendov 0:6435b67ad23c 127 *
tvendov 0:6435b67ad23c 128 * @returns
tvendov 0:6435b67ad23c 129 * 0 if write failed,
tvendov 0:6435b67ad23c 130 * 1 if write was successful
tvendov 0:6435b67ad23c 131 */
tvendov 0:6435b67ad23c 132 int write(CANMessage msg);
tvendov 0:6435b67ad23c 133
tvendov 0:6435b67ad23c 134 /** Read a CANMessage from the bus.
tvendov 0:6435b67ad23c 135 *
tvendov 0:6435b67ad23c 136 * @param msg A CANMessage to read to.
tvendov 0:6435b67ad23c 137 * @param handle message filter handle (0 for any message)
tvendov 0:6435b67ad23c 138 *
tvendov 0:6435b67ad23c 139 * @returns
tvendov 0:6435b67ad23c 140 * 0 if no message arrived,
tvendov 0:6435b67ad23c 141 * 1 if message arrived
tvendov 0:6435b67ad23c 142 */
tvendov 0:6435b67ad23c 143 int read(CANMessage &msg, int handle = 0);
tvendov 0:6435b67ad23c 144
tvendov 0:6435b67ad23c 145 /** Reset CAN interface.
tvendov 0:6435b67ad23c 146 *
tvendov 0:6435b67ad23c 147 * To use after error overflow.
tvendov 0:6435b67ad23c 148 */
tvendov 0:6435b67ad23c 149 void reset();
tvendov 0:6435b67ad23c 150
tvendov 0:6435b67ad23c 151 /** Puts or removes the CAN interface into silent monitoring mode
tvendov 0:6435b67ad23c 152 *
tvendov 0:6435b67ad23c 153 * @param silent boolean indicating whether to go into silent mode or not
tvendov 0:6435b67ad23c 154 */
tvendov 0:6435b67ad23c 155 void monitor(bool silent);
tvendov 0:6435b67ad23c 156
tvendov 0:6435b67ad23c 157 enum Mode {
tvendov 0:6435b67ad23c 158 Reset = 0,
tvendov 0:6435b67ad23c 159 Normal,
tvendov 0:6435b67ad23c 160 Silent,
tvendov 0:6435b67ad23c 161 LocalTest,
tvendov 0:6435b67ad23c 162 GlobalTest,
tvendov 0:6435b67ad23c 163 SilentTest
tvendov 0:6435b67ad23c 164 };
tvendov 0:6435b67ad23c 165
tvendov 0:6435b67ad23c 166 /** Change CAN operation to the specified mode
tvendov 0:6435b67ad23c 167 *
tvendov 0:6435b67ad23c 168 * @param mode The new operation mode (CAN::Normal, CAN::Silent, CAN::LocalTest, CAN::GlobalTest, CAN::SilentTest)
tvendov 0:6435b67ad23c 169 *
tvendov 0:6435b67ad23c 170 * @returns
tvendov 0:6435b67ad23c 171 * 0 if mode change failed or unsupported,
tvendov 0:6435b67ad23c 172 * 1 if mode change was successful
tvendov 0:6435b67ad23c 173 */
tvendov 0:6435b67ad23c 174 int mode(Mode mode);
tvendov 0:6435b67ad23c 175
tvendov 0:6435b67ad23c 176 /** Filter out incomming messages
tvendov 0:6435b67ad23c 177 *
tvendov 0:6435b67ad23c 178 * @param id the id to filter on
tvendov 0:6435b67ad23c 179 * @param mask the mask applied to the id
tvendov 0:6435b67ad23c 180 * @param format format to filter on (Default CANAny)
tvendov 0:6435b67ad23c 181 * @param handle message filter handle (Optional)
tvendov 0:6435b67ad23c 182 *
tvendov 0:6435b67ad23c 183 * @returns
tvendov 0:6435b67ad23c 184 * 0 if filter change failed or unsupported,
tvendov 0:6435b67ad23c 185 * new filter handle if successful
tvendov 0:6435b67ad23c 186 */
tvendov 0:6435b67ad23c 187 int filter(unsigned int id, unsigned int mask, CANFormat format = CANAny, int handle = 0);
tvendov 0:6435b67ad23c 188
tvendov 0:6435b67ad23c 189 /** Returns number of read errors to detect read overflow errors.
tvendov 0:6435b67ad23c 190 */
tvendov 0:6435b67ad23c 191 unsigned char rderror();
tvendov 0:6435b67ad23c 192
tvendov 0:6435b67ad23c 193 /** Returns number of write errors to detect write overflow errors.
tvendov 0:6435b67ad23c 194 */
tvendov 0:6435b67ad23c 195 unsigned char tderror();
tvendov 0:6435b67ad23c 196
tvendov 0:6435b67ad23c 197 enum IrqType {
tvendov 0:6435b67ad23c 198 RxIrq = 0,
tvendov 0:6435b67ad23c 199 TxIrq,
tvendov 0:6435b67ad23c 200 EwIrq,
tvendov 0:6435b67ad23c 201 DoIrq,
tvendov 0:6435b67ad23c 202 WuIrq,
tvendov 0:6435b67ad23c 203 EpIrq,
tvendov 0:6435b67ad23c 204 AlIrq,
tvendov 0:6435b67ad23c 205 BeIrq,
tvendov 0:6435b67ad23c 206 IdIrq
tvendov 0:6435b67ad23c 207 };
tvendov 0:6435b67ad23c 208
tvendov 0:6435b67ad23c 209 /** Attach a function to call whenever a CAN frame received interrupt is
tvendov 0:6435b67ad23c 210 * generated.
tvendov 0:6435b67ad23c 211 *
tvendov 0:6435b67ad23c 212 * @param func A pointer to a void function, or 0 to set as none
tvendov 0:6435b67ad23c 213 * @param event Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, CAN::TxIrq for transmitted or aborted, CAN::EwIrq for error warning, CAN::DoIrq for data overrun, CAN::WuIrq for wake-up, CAN::EpIrq for error passive, CAN::AlIrq for arbitration lost, CAN::BeIrq for bus error)
tvendov 0:6435b67ad23c 214 */
tvendov 0:6435b67ad23c 215 void attach(Callback<void()> func, IrqType type=RxIrq);
tvendov 0:6435b67ad23c 216
tvendov 0:6435b67ad23c 217 /** Attach a member function to call whenever a CAN frame received interrupt
tvendov 0:6435b67ad23c 218 * is generated.
tvendov 0:6435b67ad23c 219 *
tvendov 0:6435b67ad23c 220 * @param obj pointer to the object to call the member function on
tvendov 0:6435b67ad23c 221 * @param method pointer to the member function to be called
tvendov 0:6435b67ad23c 222 * @param event Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, TxIrq for transmitted or aborted, EwIrq for error warning, DoIrq for data overrun, WuIrq for wake-up, EpIrq for error passive, AlIrq for arbitration lost, BeIrq for bus error)
tvendov 0:6435b67ad23c 223 */
tvendov 0:6435b67ad23c 224 template<typename T>
tvendov 0:6435b67ad23c 225 void attach(T* obj, void (T::*method)(), IrqType type=RxIrq) {
tvendov 0:6435b67ad23c 226 // Underlying call thread safe
tvendov 0:6435b67ad23c 227 attach(Callback<void()>(obj, method), type);
tvendov 0:6435b67ad23c 228 }
tvendov 0:6435b67ad23c 229
tvendov 0:6435b67ad23c 230 /** Attach a member function to call whenever a CAN frame received interrupt
tvendov 0:6435b67ad23c 231 * is generated.
tvendov 0:6435b67ad23c 232 *
tvendov 0:6435b67ad23c 233 * @param obj pointer to the object to call the member function on
tvendov 0:6435b67ad23c 234 * @param method pointer to the member function to be called
tvendov 0:6435b67ad23c 235 * @param event Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, TxIrq for transmitted or aborted, EwIrq for error warning, DoIrq for data overrun, WuIrq for wake-up, EpIrq for error passive, AlIrq for arbitration lost, BeIrq for bus error)
tvendov 0:6435b67ad23c 236 */
tvendov 0:6435b67ad23c 237 template<typename T>
tvendov 0:6435b67ad23c 238 void attach(T* obj, void (*method)(T*), IrqType type=RxIrq) {
tvendov 0:6435b67ad23c 239 // Underlying call thread safe
tvendov 0:6435b67ad23c 240 attach(Callback<void()>(obj, method), type);
tvendov 0:6435b67ad23c 241 }
tvendov 0:6435b67ad23c 242
tvendov 0:6435b67ad23c 243 static void _irq_handler(uint32_t id, CanIrqType type);
tvendov 0:6435b67ad23c 244
tvendov 0:6435b67ad23c 245 protected:
tvendov 0:6435b67ad23c 246 virtual void lock();
tvendov 0:6435b67ad23c 247 virtual void unlock();
tvendov 0:6435b67ad23c 248 can_t _can;
tvendov 0:6435b67ad23c 249 Callback<void()> _irq[9];
tvendov 0:6435b67ad23c 250 PlatformMutex _mutex;
tvendov 0:6435b67ad23c 251 };
tvendov 0:6435b67ad23c 252
tvendov 0:6435b67ad23c 253 } // namespace mbed
tvendov 0:6435b67ad23c 254
tvendov 0:6435b67ad23c 255 #endif
tvendov 0:6435b67ad23c 256
tvendov 0:6435b67ad23c 257 #endif // MBED_CAN_H
tvendov 0:6435b67ad23c 258