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.
dogm_spi.h@9:2fe93daa2106, 2011-02-22 (annotated)
- Committer:
- hlipka
- Date:
- Tue Feb 22 22:57:44 2011 +0000
- Revision:
- 9:2fe93daa2106
- Parent:
- 3:e5d5e2fe4bf6
fixed semaphore handling - should now be really thread safe (can be called from interrupts)
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 | 3:e5d5e2fe4bf6 | 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 | 3:e5d5e2fe4bf6 | 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 | 3:e5d5e2fe4bf6 | 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 | #ifndef DOGM_SPI_H_ |
hlipka | 0:ae5037e3d6e0 | 25 | #define DOGM_SPI_H_ |
hlipka | 0:ae5037e3d6e0 | 26 | |
hlipka | 0:ae5037e3d6e0 | 27 | #include "lcd_spi.h" |
hlipka | 0:ae5037e3d6e0 | 28 | |
hlipka | 0:ae5037e3d6e0 | 29 | #include "DigitalOut.h" |
hlipka | 0:ae5037e3d6e0 | 30 | #include "SPI.h" |
hlipka | 3:e5d5e2fe4bf6 | 31 | #include "semaphore.h" |
hlipka | 0:ae5037e3d6e0 | 32 | |
hlipka | 3:e5d5e2fe4bf6 | 33 | using namespace mbed; |
hlipka | 0:ae5037e3d6e0 | 34 | |
hlipka | 0:ae5037e3d6e0 | 35 | /** |
hlipka | 0:ae5037e3d6e0 | 36 | * class for connecting a DOGM16x LCD display, from electronic assembly (www.lcd-module.com ) |
hlipka | 0:ae5037e3d6e0 | 37 | */ |
hlipka | 3:e5d5e2fe4bf6 | 38 | class DogmLCDSPI: public SPILCDBase { |
hlipka | 3:e5d5e2fe4bf6 | 39 | public: |
hlipka | 3:e5d5e2fe4bf6 | 40 | /** |
hlipka | 3:e5d5e2fe4bf6 | 41 | * @param columns number of chars per line |
hlipka | 3:e5d5e2fe4bf6 | 42 | * @param rows number of lines (currently only 1 and 2 work) |
hlipka | 3:e5d5e2fe4bf6 | 43 | * @param the SPI object used for sending data (set to 1MHz) |
hlipka | 3:e5d5e2fe4bf6 | 44 | * @param enable the pin name for the enable line (0=active, connected to /CSB) |
hlipka | 3:e5d5e2fe4bf6 | 45 | * @param rs the pin name for the register select line (0=cmd, 1=data) |
hlipka | 3:e5d5e2fe4bf6 | 46 | */ |
hlipka | 3:e5d5e2fe4bf6 | 47 | DogmLCDSPI(unsigned int columns, unsigned int rows, SPI *spi, PinName enable, PinName rs); |
hlipka | 3:e5d5e2fe4bf6 | 48 | virtual void init(); |
hlipka | 3:e5d5e2fe4bf6 | 49 | virtual void writeText(const unsigned int column, const unsigned int row, const char text[]); |
hlipka | 3:e5d5e2fe4bf6 | 50 | virtual void clear(); |
hlipka | 3:e5d5e2fe4bf6 | 51 | virtual void character(int column, int row, int c); |
hlipka | 0:ae5037e3d6e0 | 52 | }; |
hlipka | 0:ae5037e3d6e0 | 53 | |
hlipka | 0:ae5037e3d6e0 | 54 | #endif |