Display text on LCD displays (even on multiple ones). Allow to create windows (frames) on display, and to combine them (split, add, duplicate, scroll). See http://mbed.org/users/hlipka/notebook/lcdwindow/ for more information.
teewindow.cpp@3:e5d5e2fe4bf6, 2010-11-28 (annotated)
- Committer:
- hlipka
- Date:
- Sun Nov 28 22:09:54 2010 +0000
- Revision:
- 3:e5d5e2fe4bf6
- Parent:
- 2:5ac5bab7daaf
Made LCD driver thread safe (to allow usage from timers)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hlipka | 0:ae5037e3d6e0 | 1 | /* |
hlipka | 0:ae5037e3d6e0 | 2 | * mbed LCDWindow library |
hlipka | 0:ae5037e3d6e0 | 3 | * Copyright (c) 2010 Hendrik Lipka |
hlipka | 0:ae5037e3d6e0 | 4 | * |
hlipka | 0:ae5037e3d6e0 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
hlipka | 0:ae5037e3d6e0 | 6 | * of this software and associated documentation files (the "Software"), to deal |
hlipka | 0:ae5037e3d6e0 | 7 | * in the Software without restriction, including without limitation the rights |
hlipka | 0:ae5037e3d6e0 | 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
hlipka | 0:ae5037e3d6e0 | 9 | * copies of the Software, and to permit persons to whom the Software is |
hlipka | 0:ae5037e3d6e0 | 10 | * furnished to do so, subject to the following conditions: |
hlipka | 0:ae5037e3d6e0 | 11 | * |
hlipka | 0:ae5037e3d6e0 | 12 | * The above copyright notice and this permission notice shall be included in |
hlipka | 0:ae5037e3d6e0 | 13 | * all copies or substantial portions of the Software. |
hlipka | 0:ae5037e3d6e0 | 14 | * |
hlipka | 0:ae5037e3d6e0 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
hlipka | 0:ae5037e3d6e0 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
hlipka | 0:ae5037e3d6e0 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
hlipka | 0:ae5037e3d6e0 | 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
hlipka | 0:ae5037e3d6e0 | 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
hlipka | 0:ae5037e3d6e0 | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
hlipka | 0:ae5037e3d6e0 | 21 | * THE SOFTWARE. |
hlipka | 0:ae5037e3d6e0 | 22 | */ |
hlipka | 0:ae5037e3d6e0 | 23 | |
hlipka | 0:ae5037e3d6e0 | 24 | #include "teewindow.h" |
hlipka | 0:ae5037e3d6e0 | 25 | |
hlipka | 3:e5d5e2fe4bf6 | 26 | TeeWindow::TeeWindow(vector<Window*> lcds):Window() { |
hlipka | 0:ae5037e3d6e0 | 27 | _lcds=lcds; |
hlipka | 0:ae5037e3d6e0 | 28 | int len=_lcds.size(); |
hlipka | 2:5ac5bab7daaf | 29 | _columns=_lcds[0]->getColumns(); |
hlipka | 2:5ac5bab7daaf | 30 | _rows=_lcds[0]->getRows(); |
hlipka | 0:ae5037e3d6e0 | 31 | } |
hlipka | 0:ae5037e3d6e0 | 32 | |
hlipka | 2:5ac5bab7daaf | 33 | void TeeWindow::character(int column, int row, int c) |
hlipka | 2:5ac5bab7daaf | 34 | { |
hlipka | 0:ae5037e3d6e0 | 35 | int len=_lcds.size(); |
hlipka | 0:ae5037e3d6e0 | 36 | for (int i=0;i<len;i++) { |
hlipka | 2:5ac5bab7daaf | 37 | _lcds[i]->character(column,row,c); |
hlipka | 2:5ac5bab7daaf | 38 | } |
hlipka | 2:5ac5bab7daaf | 39 | } |
hlipka | 2:5ac5bab7daaf | 40 | |
hlipka | 2:5ac5bab7daaf | 41 | void TeeWindow::writeText(const unsigned int column, const unsigned int row, const char text[]) { |
hlipka | 2:5ac5bab7daaf | 42 | int len=_lcds.size(); |
hlipka | 2:5ac5bab7daaf | 43 | for (int i=0;i<len;i++) { |
hlipka | 2:5ac5bab7daaf | 44 | _lcds[i]->writeText(column,row,text); |
hlipka | 0:ae5037e3d6e0 | 45 | } |
hlipka | 0:ae5037e3d6e0 | 46 | } |
hlipka | 0:ae5037e3d6e0 | 47 | |
hlipka | 0:ae5037e3d6e0 | 48 | void TeeWindow::clear() { |
hlipka | 0:ae5037e3d6e0 | 49 | int len=_lcds.size(); |
hlipka | 0:ae5037e3d6e0 | 50 | for (int i=0;i<len;i++) { |
hlipka | 0:ae5037e3d6e0 | 51 | _lcds[i]->clear();; |
hlipka | 0:ae5037e3d6e0 | 52 | } |
hlipka | 0:ae5037e3d6e0 | 53 | } |