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/api/AnalogOut.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 | /* 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_ANALOGOUT_H |
tvendov | 0:6435b67ad23c | 17 | #define MBED_ANALOGOUT_H |
tvendov | 0:6435b67ad23c | 18 | |
tvendov | 0:6435b67ad23c | 19 | #include "platform.h" |
tvendov | 0:6435b67ad23c | 20 | |
tvendov | 0:6435b67ad23c | 21 | #if DEVICE_ANALOGOUT |
tvendov | 0:6435b67ad23c | 22 | |
tvendov | 0:6435b67ad23c | 23 | #include "analogout_api.h" |
tvendov | 0:6435b67ad23c | 24 | #include "PlatformMutex.h" |
tvendov | 0:6435b67ad23c | 25 | |
tvendov | 0:6435b67ad23c | 26 | namespace mbed { |
tvendov | 0:6435b67ad23c | 27 | |
tvendov | 0:6435b67ad23c | 28 | /** An analog output, used for setting the voltage on a pin |
tvendov | 0:6435b67ad23c | 29 | * |
tvendov | 0:6435b67ad23c | 30 | * @Note Synchronization level: Thread safe |
tvendov | 0:6435b67ad23c | 31 | * |
tvendov | 0:6435b67ad23c | 32 | * Example: |
tvendov | 0:6435b67ad23c | 33 | * @code |
tvendov | 0:6435b67ad23c | 34 | * // Make a sawtooth output |
tvendov | 0:6435b67ad23c | 35 | * |
tvendov | 0:6435b67ad23c | 36 | * #include "mbed.h" |
tvendov | 0:6435b67ad23c | 37 | * |
tvendov | 0:6435b67ad23c | 38 | * AnalogOut tri(p18); |
tvendov | 0:6435b67ad23c | 39 | * int main() { |
tvendov | 0:6435b67ad23c | 40 | * while(1) { |
tvendov | 0:6435b67ad23c | 41 | * tri = tri + 0.01; |
tvendov | 0:6435b67ad23c | 42 | * wait_us(1); |
tvendov | 0:6435b67ad23c | 43 | * if(tri == 1) { |
tvendov | 0:6435b67ad23c | 44 | * tri = 0; |
tvendov | 0:6435b67ad23c | 45 | * } |
tvendov | 0:6435b67ad23c | 46 | * } |
tvendov | 0:6435b67ad23c | 47 | * } |
tvendov | 0:6435b67ad23c | 48 | * @endcode |
tvendov | 0:6435b67ad23c | 49 | */ |
tvendov | 0:6435b67ad23c | 50 | class AnalogOut { |
tvendov | 0:6435b67ad23c | 51 | |
tvendov | 0:6435b67ad23c | 52 | public: |
tvendov | 0:6435b67ad23c | 53 | |
tvendov | 0:6435b67ad23c | 54 | /** Create an AnalogOut connected to the specified pin |
tvendov | 0:6435b67ad23c | 55 | * |
tvendov | 0:6435b67ad23c | 56 | * @param AnalogOut pin to connect to (18) |
tvendov | 0:6435b67ad23c | 57 | */ |
tvendov | 0:6435b67ad23c | 58 | AnalogOut(PinName pin) { |
tvendov | 0:6435b67ad23c | 59 | analogout_init(&_dac, pin); |
tvendov | 0:6435b67ad23c | 60 | } |
tvendov | 0:6435b67ad23c | 61 | |
tvendov | 0:6435b67ad23c | 62 | /** Set the output voltage, specified as a percentage (float) |
tvendov | 0:6435b67ad23c | 63 | * |
tvendov | 0:6435b67ad23c | 64 | * @param value A floating-point value representing the output voltage, |
tvendov | 0:6435b67ad23c | 65 | * specified as a percentage. The value should lie between |
tvendov | 0:6435b67ad23c | 66 | * 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%). |
tvendov | 0:6435b67ad23c | 67 | * Values outside this range will be saturated to 0.0f or 1.0f. |
tvendov | 0:6435b67ad23c | 68 | */ |
tvendov | 0:6435b67ad23c | 69 | void write(float value) { |
tvendov | 0:6435b67ad23c | 70 | lock(); |
tvendov | 0:6435b67ad23c | 71 | analogout_write(&_dac, value); |
tvendov | 0:6435b67ad23c | 72 | unlock(); |
tvendov | 0:6435b67ad23c | 73 | } |
tvendov | 0:6435b67ad23c | 74 | |
tvendov | 0:6435b67ad23c | 75 | /** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF] |
tvendov | 0:6435b67ad23c | 76 | * |
tvendov | 0:6435b67ad23c | 77 | * @param value 16-bit unsigned short representing the output voltage, |
tvendov | 0:6435b67ad23c | 78 | * normalised to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v) |
tvendov | 0:6435b67ad23c | 79 | */ |
tvendov | 0:6435b67ad23c | 80 | void write_u16(unsigned short value) { |
tvendov | 0:6435b67ad23c | 81 | lock(); |
tvendov | 0:6435b67ad23c | 82 | analogout_write_u16(&_dac, value); |
tvendov | 0:6435b67ad23c | 83 | unlock(); |
tvendov | 0:6435b67ad23c | 84 | } |
tvendov | 0:6435b67ad23c | 85 | |
tvendov | 0:6435b67ad23c | 86 | /** Return the current output voltage setting, measured as a percentage (float) |
tvendov | 0:6435b67ad23c | 87 | * |
tvendov | 0:6435b67ad23c | 88 | * @returns |
tvendov | 0:6435b67ad23c | 89 | * A floating-point value representing the current voltage being output on the pin, |
tvendov | 0:6435b67ad23c | 90 | * measured as a percentage. The returned value will lie between |
tvendov | 0:6435b67ad23c | 91 | * 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%). |
tvendov | 0:6435b67ad23c | 92 | * |
tvendov | 0:6435b67ad23c | 93 | * @note |
tvendov | 0:6435b67ad23c | 94 | * This value may not match exactly the value set by a previous write(). |
tvendov | 0:6435b67ad23c | 95 | */ |
tvendov | 0:6435b67ad23c | 96 | float read() { |
tvendov | 0:6435b67ad23c | 97 | lock(); |
tvendov | 0:6435b67ad23c | 98 | float ret = analogout_read(&_dac); |
tvendov | 0:6435b67ad23c | 99 | unlock(); |
tvendov | 0:6435b67ad23c | 100 | return ret; |
tvendov | 0:6435b67ad23c | 101 | } |
tvendov | 0:6435b67ad23c | 102 | |
tvendov | 0:6435b67ad23c | 103 | /** An operator shorthand for write() |
tvendov | 0:6435b67ad23c | 104 | */ |
tvendov | 0:6435b67ad23c | 105 | AnalogOut& operator= (float percent) { |
tvendov | 0:6435b67ad23c | 106 | // Underlying write call is thread safe |
tvendov | 0:6435b67ad23c | 107 | write(percent); |
tvendov | 0:6435b67ad23c | 108 | return *this; |
tvendov | 0:6435b67ad23c | 109 | } |
tvendov | 0:6435b67ad23c | 110 | |
tvendov | 0:6435b67ad23c | 111 | AnalogOut& operator= (AnalogOut& rhs) { |
tvendov | 0:6435b67ad23c | 112 | // Underlying write call is thread safe |
tvendov | 0:6435b67ad23c | 113 | write(rhs.read()); |
tvendov | 0:6435b67ad23c | 114 | return *this; |
tvendov | 0:6435b67ad23c | 115 | } |
tvendov | 0:6435b67ad23c | 116 | |
tvendov | 0:6435b67ad23c | 117 | /** An operator shorthand for read() |
tvendov | 0:6435b67ad23c | 118 | */ |
tvendov | 0:6435b67ad23c | 119 | operator float() { |
tvendov | 0:6435b67ad23c | 120 | // Underlying read call is thread safe |
tvendov | 0:6435b67ad23c | 121 | return read(); |
tvendov | 0:6435b67ad23c | 122 | } |
tvendov | 0:6435b67ad23c | 123 | |
tvendov | 0:6435b67ad23c | 124 | virtual ~AnalogOut() { |
tvendov | 0:6435b67ad23c | 125 | // Do nothing |
tvendov | 0:6435b67ad23c | 126 | } |
tvendov | 0:6435b67ad23c | 127 | |
tvendov | 0:6435b67ad23c | 128 | protected: |
tvendov | 0:6435b67ad23c | 129 | |
tvendov | 0:6435b67ad23c | 130 | virtual void lock() { |
tvendov | 0:6435b67ad23c | 131 | _mutex.lock(); |
tvendov | 0:6435b67ad23c | 132 | } |
tvendov | 0:6435b67ad23c | 133 | |
tvendov | 0:6435b67ad23c | 134 | virtual void unlock() { |
tvendov | 0:6435b67ad23c | 135 | _mutex.unlock(); |
tvendov | 0:6435b67ad23c | 136 | } |
tvendov | 0:6435b67ad23c | 137 | |
tvendov | 0:6435b67ad23c | 138 | dac_t _dac; |
tvendov | 0:6435b67ad23c | 139 | PlatformMutex _mutex; |
tvendov | 0:6435b67ad23c | 140 | }; |
tvendov | 0:6435b67ad23c | 141 | |
tvendov | 0:6435b67ad23c | 142 | } // namespace mbed |
tvendov | 0:6435b67ad23c | 143 | |
tvendov | 0:6435b67ad23c | 144 | #endif |
tvendov | 0:6435b67ad23c | 145 | |
tvendov | 0:6435b67ad23c | 146 | #endif |
tvendov | 0:6435b67ad23c | 147 |