A slightly updated version for use in ENGO 333 at the University of Calgary.
Dependents: 1TestDECAWAVE_plus_others 3TestBeaconDECAWAVE_plus_others DecaWave etch-a-sketch-engo333 ... more
Fork of C12832 by
C12832.h@17:878d97d7c263, 2015-10-30 (annotated)
- Committer:
- mpetovello
- Date:
- Fri Oct 30 04:55:38 2015 +0000
- Revision:
- 17:878d97d7c263
- Parent:
- 16:7de323fa46fe
Commented C12832.h and MMA7760.h for use with ENGO 333
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreschpe | 0:4bbc531be6e2 | 1 | /* mbed library for the mbed Lab Board 128*32 pixel LCD |
dreschpe | 0:4bbc531be6e2 | 2 | * use C12832 controller |
dreschpe | 0:4bbc531be6e2 | 3 | * Copyright (c) 2012 Peter Drescher - DC2PD |
dreschpe | 0:4bbc531be6e2 | 4 | * Released under the MIT License: http://mbed.org/license/mit |
dreschpe | 0:4bbc531be6e2 | 5 | * |
dreschpe | 0:4bbc531be6e2 | 6 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
dreschpe | 0:4bbc531be6e2 | 7 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
dreschpe | 0:4bbc531be6e2 | 8 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
dreschpe | 0:4bbc531be6e2 | 9 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
dreschpe | 0:4bbc531be6e2 | 10 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
dreschpe | 0:4bbc531be6e2 | 11 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
dreschpe | 0:4bbc531be6e2 | 12 | * THE SOFTWARE. |
dreschpe | 0:4bbc531be6e2 | 13 | */ |
dreschpe | 0:4bbc531be6e2 | 14 | |
dreschpe | 0:4bbc531be6e2 | 15 | #ifndef C12832_H |
dreschpe | 0:4bbc531be6e2 | 16 | #define C12832_H |
dreschpe | 0:4bbc531be6e2 | 17 | |
dreschpe | 0:4bbc531be6e2 | 18 | #include "mbed.h" |
dreschpe | 0:4bbc531be6e2 | 19 | #include "GraphicsDisplay.h" |
dreschpe | 0:4bbc531be6e2 | 20 | |
dreschpe | 0:4bbc531be6e2 | 21 | |
dreschpe | 1:66dd8afbfd06 | 22 | /** optional Defines : |
dreschpe | 0:4bbc531be6e2 | 23 | * #define debug_lcd 1 enable infos to PC_USB |
dreschpe | 0:4bbc531be6e2 | 24 | */ |
dreschpe | 0:4bbc531be6e2 | 25 | |
dreschpe | 0:4bbc531be6e2 | 26 | // some defines for the DMA use |
dreschpe | 0:4bbc531be6e2 | 27 | #define DMA_CHANNEL_ENABLE 1 |
dreschpe | 0:4bbc531be6e2 | 28 | #define DMA_TRANSFER_TYPE_M2P (1UL << 11) |
dreschpe | 0:4bbc531be6e2 | 29 | #define DMA_CHANNEL_TCIE (1UL << 31) |
dreschpe | 0:4bbc531be6e2 | 30 | #define DMA_CHANNEL_SRC_INC (1UL << 26) |
dreschpe | 0:4bbc531be6e2 | 31 | #define DMA_MASK_IE (1UL << 14) |
dreschpe | 0:4bbc531be6e2 | 32 | #define DMA_MASK_ITC (1UL << 15) |
dreschpe | 0:4bbc531be6e2 | 33 | #define DMA_SSP1_TX (1UL << 2) |
dreschpe | 0:4bbc531be6e2 | 34 | #define DMA_SSP0_TX (0) |
dreschpe | 0:4bbc531be6e2 | 35 | #define DMA_DEST_SSP1_TX (2UL << 6) |
dreschpe | 0:4bbc531be6e2 | 36 | #define DMA_DEST_SSP0_TX (0UL << 6) |
dreschpe | 0:4bbc531be6e2 | 37 | |
dreschpe | 1:66dd8afbfd06 | 38 | /** Draw mode |
dreschpe | 1:66dd8afbfd06 | 39 | * NORMAl |
dreschpe | 1:66dd8afbfd06 | 40 | * XOR set pixel by xor the screen |
dreschpe | 1:66dd8afbfd06 | 41 | */ |
dreschpe | 0:4bbc531be6e2 | 42 | enum {NORMAL,XOR}; |
dreschpe | 0:4bbc531be6e2 | 43 | |
dreschpe | 7:0f5a3b0f3cab | 44 | /** Bitmap |
dreschpe | 7:0f5a3b0f3cab | 45 | */ |
dreschpe | 7:0f5a3b0f3cab | 46 | struct Bitmap{ |
dreschpe | 7:0f5a3b0f3cab | 47 | int xSize; |
dreschpe | 7:0f5a3b0f3cab | 48 | int ySize; |
dreschpe | 7:0f5a3b0f3cab | 49 | int Byte_in_Line; |
dreschpe | 7:0f5a3b0f3cab | 50 | char* data; |
dreschpe | 7:0f5a3b0f3cab | 51 | }; |
dreschpe | 7:0f5a3b0f3cab | 52 | |
chris | 16:7de323fa46fe | 53 | class C12832 : public GraphicsDisplay |
dreschpe | 0:4bbc531be6e2 | 54 | { |
dreschpe | 0:4bbc531be6e2 | 55 | public: |
mpetovello | 17:878d97d7c263 | 56 | |
mpetovello | 17:878d97d7c263 | 57 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
mpetovello | 17:878d97d7c263 | 58 | // START: Functions Relevant to ENGO 333 Lab #8 |
mpetovello | 17:878d97d7c263 | 59 | |
dreschpe | 0:4bbc531be6e2 | 60 | |
mpetovello | 17:878d97d7c263 | 61 | // Constructor |
mpetovello | 17:878d97d7c263 | 62 | // |
mpetovello | 17:878d97d7c263 | 63 | // Arguments are the pins used for communicating with the device |
mpetovello | 17:878d97d7c263 | 64 | // (do not worry about these details): |
mpetovello | 17:878d97d7c263 | 65 | // mosi - MOSI (master out slave in) pin number |
mpetovello | 17:878d97d7c263 | 66 | // sck - SCK pin number |
mpetovello | 17:878d97d7c263 | 67 | // reset - RESET pin number |
mpetovello | 17:878d97d7c263 | 68 | // ao - A0 pin |
mpetovello | 17:878d97d7c263 | 69 | // ncs - NCS pin number |
chris | 16:7de323fa46fe | 70 | C12832(PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs, const char* name = "LCD"); |
dreschpe | 0:4bbc531be6e2 | 71 | |
chris | 13:8a9cad03124b | 72 | |
mpetovello | 17:878d97d7c263 | 73 | // Get the the width of the LCD screen in units of pixels |
mpetovello | 17:878d97d7c263 | 74 | // |
mpetovello | 17:878d97d7c263 | 75 | // Arguments: |
mpetovello | 17:878d97d7c263 | 76 | // None |
mpetovello | 17:878d97d7c263 | 77 | // |
mpetovello | 17:878d97d7c263 | 78 | // Returns: |
mpetovello | 17:878d97d7c263 | 79 | // The width of the screen |
dreschpe | 0:4bbc531be6e2 | 80 | virtual int width(); |
dreschpe | 0:4bbc531be6e2 | 81 | |
mpetovello | 17:878d97d7c263 | 82 | |
mpetovello | 17:878d97d7c263 | 83 | // Get the the height of the LCD screen in units of pixels |
mpetovello | 17:878d97d7c263 | 84 | // |
mpetovello | 17:878d97d7c263 | 85 | // Arguments: |
mpetovello | 17:878d97d7c263 | 86 | // None |
mpetovello | 17:878d97d7c263 | 87 | // |
mpetovello | 17:878d97d7c263 | 88 | // Returns: |
mpetovello | 17:878d97d7c263 | 89 | // The height of the screen |
dreschpe | 0:4bbc531be6e2 | 90 | virtual int height(); |
dreschpe | 0:4bbc531be6e2 | 91 | |
mpetovello | 17:878d97d7c263 | 92 | |
mpetovello | 17:878d97d7c263 | 93 | // Specify the value of a pixel. |
mpetovello | 17:878d97d7c263 | 94 | // |
mpetovello | 17:878d97d7c263 | 95 | // Arguments: |
mpetovello | 17:878d97d7c263 | 96 | // x - X coordinate of the pixel whose value is to be set |
mpetovello | 17:878d97d7c263 | 97 | // y - Y coordinate of the pixel whose value is to be set |
mpetovello | 17:878d97d7c263 | 98 | // colour - The value of the pixel (1 = on, 0 = off) |
mpetovello | 17:878d97d7c263 | 99 | // |
mpetovello | 17:878d97d7c263 | 100 | // Returns: |
mpetovello | 17:878d97d7c263 | 101 | // Nothing |
mpetovello | 17:878d97d7c263 | 102 | // |
mpetovello | 17:878d97d7c263 | 103 | // Remarks: |
mpetovello | 17:878d97d7c263 | 104 | // - This function does NOT update the LCD, it only sets the value |
mpetovello | 17:878d97d7c263 | 105 | // of the pixel in an internally stored buffer. To actually update |
mpetovello | 17:878d97d7c263 | 106 | // the LCD, you need to copy the buffer to the LCD using the |
mpetovello | 17:878d97d7c263 | 107 | // copy_to_lcd() function. |
mpetovello | 17:878d97d7c263 | 108 | // |
mpetovello | 17:878d97d7c263 | 109 | // - Pixel locations are zero-based meaning a value of zero is the |
mpetovello | 17:878d97d7c263 | 110 | // smallest possible value and the largest value is the width/height |
mpetovello | 17:878d97d7c263 | 111 | // (in pixels) less one. |
mpetovello | 17:878d97d7c263 | 112 | // |
mpetovello | 17:878d97d7c263 | 113 | // - The origin (X=0,Y=0) point is in the upper left corner of the screen |
mpetovello | 17:878d97d7c263 | 114 | // with X increasing to the right and Y increasing downward. |
mpetovello | 17:878d97d7c263 | 115 | // |
mpetovello | 17:878d97d7c263 | 116 | // - If the given pixel location is outside the boundaries of the |
mpetovello | 17:878d97d7c263 | 117 | // LCD, nothing happens. |
dreschpe | 0:4bbc531be6e2 | 118 | virtual void pixel(int x, int y,int colour); |
dreschpe | 0:4bbc531be6e2 | 119 | |
mpetovello | 17:878d97d7c263 | 120 | |
mpetovello | 17:878d97d7c263 | 121 | // Copy the internally-stored buffer to the LCD. This effectively updates what is |
mpetovello | 17:878d97d7c263 | 122 | // shown/displayed on the LCD. |
mpetovello | 17:878d97d7c263 | 123 | // |
mpetovello | 17:878d97d7c263 | 124 | // Arguments: |
mpetovello | 17:878d97d7c263 | 125 | // None |
mpetovello | 17:878d97d7c263 | 126 | // |
mpetovello | 17:878d97d7c263 | 127 | // Returns: |
mpetovello | 17:878d97d7c263 | 128 | // Nothing |
mpetovello | 17:878d97d7c263 | 129 | void copy_to_lcd(void); |
mpetovello | 17:878d97d7c263 | 130 | |
mpetovello | 17:878d97d7c263 | 131 | |
mpetovello | 17:878d97d7c263 | 132 | // Clear the LCD screen |
mpetovello | 17:878d97d7c263 | 133 | // |
mpetovello | 17:878d97d7c263 | 134 | // Arguments: |
mpetovello | 17:878d97d7c263 | 135 | // None |
mpetovello | 17:878d97d7c263 | 136 | // |
mpetovello | 17:878d97d7c263 | 137 | // Returns: |
mpetovello | 17:878d97d7c263 | 138 | // Nothing |
mpetovello | 17:878d97d7c263 | 139 | virtual void cls(void); |
mpetovello | 17:878d97d7c263 | 140 | |
mpetovello | 17:878d97d7c263 | 141 | |
mpetovello | 17:878d97d7c263 | 142 | // END: Functions Relevant to ENGO 333 Lab #8 |
mpetovello | 17:878d97d7c263 | 143 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
mpetovello | 17:878d97d7c263 | 144 | |
mpetovello | 17:878d97d7c263 | 145 | |
dreschpe | 0:4bbc531be6e2 | 146 | /** draw a circle |
dreschpe | 0:4bbc531be6e2 | 147 | * |
dreschpe | 0:4bbc531be6e2 | 148 | * @param x0,y0 center |
dreschpe | 0:4bbc531be6e2 | 149 | * @param r radius |
dreschpe | 0:4bbc531be6e2 | 150 | * @param colour ,1 set pixel ,0 erase pixel |
dreschpe | 0:4bbc531be6e2 | 151 | * |
dreschpe | 0:4bbc531be6e2 | 152 | */ |
dreschpe | 0:4bbc531be6e2 | 153 | void circle(int x, int y, int r, int colour); |
dreschpe | 0:4bbc531be6e2 | 154 | |
dreschpe | 0:4bbc531be6e2 | 155 | /** draw a filled circle |
dreschpe | 0:4bbc531be6e2 | 156 | * |
dreschpe | 0:4bbc531be6e2 | 157 | * @param x0,y0 center |
dreschpe | 0:4bbc531be6e2 | 158 | * @param r radius |
dreschpe | 0:4bbc531be6e2 | 159 | * @param color ,1 set pixel ,0 erase pixel |
dreschpe | 0:4bbc531be6e2 | 160 | * |
dreschpe | 0:4bbc531be6e2 | 161 | * use circle with different radius, |
dreschpe | 0:4bbc531be6e2 | 162 | * can miss some pixel |
dreschpe | 0:4bbc531be6e2 | 163 | */ |
dreschpe | 0:4bbc531be6e2 | 164 | void fillcircle(int x, int y, int r, int colour); |
dreschpe | 0:4bbc531be6e2 | 165 | |
dreschpe | 0:4bbc531be6e2 | 166 | /** draw a 1 pixel line |
dreschpe | 0:4bbc531be6e2 | 167 | * |
dreschpe | 0:4bbc531be6e2 | 168 | * @param x0,y0 start point |
dreschpe | 0:4bbc531be6e2 | 169 | * @param x1,y1 stop point |
dreschpe | 0:4bbc531be6e2 | 170 | * @param color ,1 set pixel ,0 erase pixel |
dreschpe | 0:4bbc531be6e2 | 171 | * |
dreschpe | 0:4bbc531be6e2 | 172 | */ |
dreschpe | 0:4bbc531be6e2 | 173 | void line(int x0, int y0, int x1, int y1, int colour); |
dreschpe | 1:66dd8afbfd06 | 174 | |
dreschpe | 0:4bbc531be6e2 | 175 | /** draw a rect |
dreschpe | 1:66dd8afbfd06 | 176 | * |
dreschpe | 1:66dd8afbfd06 | 177 | * @param x0,y0 top left corner |
dreschpe | 1:66dd8afbfd06 | 178 | * @param x1,y1 down right corner |
dreschpe | 1:66dd8afbfd06 | 179 | * @param color 1 set pixel ,0 erase pixel |
dreschpe | 1:66dd8afbfd06 | 180 | * * |
dreschpe | 1:66dd8afbfd06 | 181 | */ |
dreschpe | 1:66dd8afbfd06 | 182 | void rect(int x0, int y0, int x1, int y1, int colour); |
dreschpe | 1:66dd8afbfd06 | 183 | |
dreschpe | 1:66dd8afbfd06 | 184 | /** draw a filled rect |
dreschpe | 1:66dd8afbfd06 | 185 | * |
dreschpe | 1:66dd8afbfd06 | 186 | * @param x0,y0 top left corner |
dreschpe | 1:66dd8afbfd06 | 187 | * @param x1,y1 down right corner |
dreschpe | 1:66dd8afbfd06 | 188 | * @param color 1 set pixel ,0 erase pixel |
dreschpe | 0:4bbc531be6e2 | 189 | * |
dreschpe | 0:4bbc531be6e2 | 190 | */ |
dreschpe | 1:66dd8afbfd06 | 191 | void fillrect(int x0, int y0, int x1, int y1, int colour); |
dreschpe | 1:66dd8afbfd06 | 192 | |
dreschpe | 0:4bbc531be6e2 | 193 | |
dreschpe | 0:4bbc531be6e2 | 194 | /** set the orienation of the screen |
dreschpe | 1:66dd8afbfd06 | 195 | * |
dreschpe | 1:66dd8afbfd06 | 196 | */ |
dreschpe | 0:4bbc531be6e2 | 197 | void set_contrast(unsigned int o); |
dreschpe | 1:66dd8afbfd06 | 198 | |
dreschpe | 1:66dd8afbfd06 | 199 | /** read the contrast level |
dreschpe | 1:66dd8afbfd06 | 200 | * |
dreschpe | 1:66dd8afbfd06 | 201 | */ |
dreschpe | 1:66dd8afbfd06 | 202 | unsigned int get_contrast(void); |
dreschpe | 1:66dd8afbfd06 | 203 | |
dreschpe | 1:66dd8afbfd06 | 204 | /** invert the screen |
dreschpe | 1:66dd8afbfd06 | 205 | * |
dreschpe | 1:66dd8afbfd06 | 206 | * @param o = 0 normal, 1 invert |
dreschpe | 1:66dd8afbfd06 | 207 | */ |
dreschpe | 0:4bbc531be6e2 | 208 | void invert(unsigned int o); |
dreschpe | 1:66dd8afbfd06 | 209 | |
dreschpe | 1:66dd8afbfd06 | 210 | /** set the drawing mode |
dreschpe | 1:66dd8afbfd06 | 211 | * |
dreschpe | 1:66dd8afbfd06 | 212 | * @param mode NORMAl or XOR |
dreschpe | 1:66dd8afbfd06 | 213 | */ |
dreschpe | 1:66dd8afbfd06 | 214 | |
dreschpe | 1:66dd8afbfd06 | 215 | void setmode(int mode); |
dreschpe | 1:66dd8afbfd06 | 216 | |
dreschpe | 6:6b96b16aad47 | 217 | virtual int columns(void); |
dreschpe | 1:66dd8afbfd06 | 218 | |
dreschpe | 1:66dd8afbfd06 | 219 | /** calculate the max number of columns |
dreschpe | 1:66dd8afbfd06 | 220 | * |
dreschpe | 1:66dd8afbfd06 | 221 | * @returns max column |
dreschpe | 1:66dd8afbfd06 | 222 | * depends on actual font size |
dreschpe | 1:66dd8afbfd06 | 223 | * |
dreschpe | 1:66dd8afbfd06 | 224 | */ |
dreschpe | 6:6b96b16aad47 | 225 | virtual int rows(void); |
dreschpe | 1:66dd8afbfd06 | 226 | |
dreschpe | 1:66dd8afbfd06 | 227 | /** put a char on the screen |
dreschpe | 1:66dd8afbfd06 | 228 | * |
dreschpe | 1:66dd8afbfd06 | 229 | * @param value char to print |
dreschpe | 1:66dd8afbfd06 | 230 | * @returns printed char |
dreschpe | 1:66dd8afbfd06 | 231 | * |
dreschpe | 1:66dd8afbfd06 | 232 | */ |
dreschpe | 6:6b96b16aad47 | 233 | virtual int _putc(int value); |
dreschpe | 1:66dd8afbfd06 | 234 | |
dreschpe | 1:66dd8afbfd06 | 235 | /** draw a character on given position out of the active font to the LCD |
dreschpe | 1:66dd8afbfd06 | 236 | * |
dreschpe | 1:66dd8afbfd06 | 237 | * @param x x-position of char (top left) |
dreschpe | 1:66dd8afbfd06 | 238 | * @param y y-position |
dreschpe | 1:66dd8afbfd06 | 239 | * @param c char to print |
dreschpe | 1:66dd8afbfd06 | 240 | * |
dreschpe | 1:66dd8afbfd06 | 241 | */ |
dreschpe | 1:66dd8afbfd06 | 242 | virtual void character(int x, int y, int c); |
dreschpe | 1:66dd8afbfd06 | 243 | |
dreschpe | 1:66dd8afbfd06 | 244 | /** setup cursor position |
dreschpe | 1:66dd8afbfd06 | 245 | * |
dreschpe | 1:66dd8afbfd06 | 246 | * @param x x-position (top left) |
dreschpe | 1:66dd8afbfd06 | 247 | * @param y y-position |
dreschpe | 1:66dd8afbfd06 | 248 | */ |
dreschpe | 6:6b96b16aad47 | 249 | virtual void locate(int x, int y); |
dreschpe | 3:468cdccff7af | 250 | |
dreschpe | 3:468cdccff7af | 251 | /** setup auto update of screen |
dreschpe | 3:468cdccff7af | 252 | * |
dreschpe | 3:468cdccff7af | 253 | * @param up 1 = on , 0 = off |
dreschpe | 3:468cdccff7af | 254 | * if switched off the program has to call copy_to_lcd() |
dreschpe | 3:468cdccff7af | 255 | * to update screen from framebuffer |
dreschpe | 3:468cdccff7af | 256 | */ |
dreschpe | 5:0f53e522a2bf | 257 | void set_auto_up(unsigned int up); |
dreschpe | 1:66dd8afbfd06 | 258 | |
dreschpe | 3:468cdccff7af | 259 | /** get status of the auto update function |
dreschpe | 3:468cdccff7af | 260 | * |
dreschpe | 3:468cdccff7af | 261 | * @returns if auto update is on |
dreschpe | 3:468cdccff7af | 262 | */ |
dreschpe | 5:0f53e522a2bf | 263 | unsigned int get_auto_up(void); |
dreschpe | 0:4bbc531be6e2 | 264 | |
dreschpe | 0:4bbc531be6e2 | 265 | /** Vars */ |
dreschpe | 0:4bbc531be6e2 | 266 | SPI _spi; |
dreschpe | 0:4bbc531be6e2 | 267 | DigitalOut _reset; |
dreschpe | 0:4bbc531be6e2 | 268 | DigitalOut _A0; |
dreschpe | 0:4bbc531be6e2 | 269 | DigitalOut _CS; |
dreschpe | 0:4bbc531be6e2 | 270 | unsigned char* font; |
dreschpe | 0:4bbc531be6e2 | 271 | unsigned int draw_mode; |
dreschpe | 0:4bbc531be6e2 | 272 | |
dreschpe | 0:4bbc531be6e2 | 273 | |
dreschpe | 1:66dd8afbfd06 | 274 | /** select the font to use |
dreschpe | 1:66dd8afbfd06 | 275 | * |
dreschpe | 1:66dd8afbfd06 | 276 | * @param f pointer to font array |
dreschpe | 1:66dd8afbfd06 | 277 | * |
dreschpe | 1:66dd8afbfd06 | 278 | * font array can created with GLCD Font Creator from http://www.mikroe.com |
dreschpe | 1:66dd8afbfd06 | 279 | * you have to add 4 parameter at the beginning of the font array to use: |
dreschpe | 1:66dd8afbfd06 | 280 | * - the number of byte / char |
dreschpe | 1:66dd8afbfd06 | 281 | * - the vertial size in pixel |
dreschpe | 1:66dd8afbfd06 | 282 | * - the horizontal size in pixel |
dreschpe | 1:66dd8afbfd06 | 283 | * - the number of byte per vertical line |
dreschpe | 1:66dd8afbfd06 | 284 | * you also have to change the array to char[] |
dreschpe | 1:66dd8afbfd06 | 285 | * |
dreschpe | 1:66dd8afbfd06 | 286 | */ |
dreschpe | 1:66dd8afbfd06 | 287 | void set_font(unsigned char* f); |
dreschpe | 7:0f5a3b0f3cab | 288 | |
dreschpe | 7:0f5a3b0f3cab | 289 | /** print bitmap to buffer |
dreschpe | 7:0f5a3b0f3cab | 290 | * |
dreschpe | 7:0f5a3b0f3cab | 291 | * @param bm Bitmap in flash |
dreschpe | 7:0f5a3b0f3cab | 292 | * @param x x start |
dreschpe | 7:0f5a3b0f3cab | 293 | * @param y y start |
dreschpe | 7:0f5a3b0f3cab | 294 | * |
dreschpe | 7:0f5a3b0f3cab | 295 | */ |
dreschpe | 0:4bbc531be6e2 | 296 | |
dreschpe | 7:0f5a3b0f3cab | 297 | void print_bm(Bitmap bm, int x, int y); |
dreschpe | 0:4bbc531be6e2 | 298 | |
dreschpe | 0:4bbc531be6e2 | 299 | protected: |
dreschpe | 0:4bbc531be6e2 | 300 | |
dreschpe | 0:4bbc531be6e2 | 301 | /** draw a horizontal line |
dreschpe | 0:4bbc531be6e2 | 302 | * |
dreschpe | 0:4bbc531be6e2 | 303 | * @param x0 horizontal start |
dreschpe | 0:4bbc531be6e2 | 304 | * @param x1 horizontal stop |
dreschpe | 0:4bbc531be6e2 | 305 | * @param y vertical position |
dreschpe | 0:4bbc531be6e2 | 306 | * @param ,1 set pixel ,0 erase pixel |
dreschpe | 0:4bbc531be6e2 | 307 | * |
dreschpe | 0:4bbc531be6e2 | 308 | */ |
dreschpe | 0:4bbc531be6e2 | 309 | void hline(int x0, int x1, int y, int colour); |
dreschpe | 0:4bbc531be6e2 | 310 | |
dreschpe | 0:4bbc531be6e2 | 311 | /** draw a vertical line |
dreschpe | 0:4bbc531be6e2 | 312 | * |
dreschpe | 0:4bbc531be6e2 | 313 | * @param x horizontal position |
dreschpe | 0:4bbc531be6e2 | 314 | * @param y0 vertical start |
dreschpe | 0:4bbc531be6e2 | 315 | * @param y1 vertical stop |
dreschpe | 0:4bbc531be6e2 | 316 | * @param ,1 set pixel ,0 erase pixel |
dreschpe | 0:4bbc531be6e2 | 317 | */ |
dreschpe | 0:4bbc531be6e2 | 318 | void vline(int y0, int y1, int x, int colour); |
dreschpe | 0:4bbc531be6e2 | 319 | |
dreschpe | 0:4bbc531be6e2 | 320 | /** Init the C12832 LCD controller |
dreschpe | 0:4bbc531be6e2 | 321 | * |
dreschpe | 0:4bbc531be6e2 | 322 | */ |
dreschpe | 0:4bbc531be6e2 | 323 | void lcd_reset(); |
dreschpe | 0:4bbc531be6e2 | 324 | |
dreschpe | 0:4bbc531be6e2 | 325 | /** Write data to the LCD controller |
dreschpe | 0:4bbc531be6e2 | 326 | * |
dreschpe | 0:4bbc531be6e2 | 327 | * @param dat data written to LCD controller |
dreschpe | 0:4bbc531be6e2 | 328 | * |
dreschpe | 0:4bbc531be6e2 | 329 | */ |
dreschpe | 0:4bbc531be6e2 | 330 | void wr_dat(unsigned char value); |
dreschpe | 0:4bbc531be6e2 | 331 | |
dreschpe | 0:4bbc531be6e2 | 332 | /** Write a command the LCD controller |
dreschpe | 0:4bbc531be6e2 | 333 | * |
dreschpe | 0:4bbc531be6e2 | 334 | * @param cmd: command to be written |
dreschpe | 0:4bbc531be6e2 | 335 | * |
dreschpe | 0:4bbc531be6e2 | 336 | */ |
dreschpe | 0:4bbc531be6e2 | 337 | void wr_cmd(unsigned char value); |
dreschpe | 1:66dd8afbfd06 | 338 | |
dreschpe | 0:4bbc531be6e2 | 339 | void wr_cnt(unsigned char cmd); |
dreschpe | 0:4bbc531be6e2 | 340 | |
dreschpe | 0:4bbc531be6e2 | 341 | unsigned int orientation; |
dreschpe | 0:4bbc531be6e2 | 342 | unsigned int char_x; |
dreschpe | 0:4bbc531be6e2 | 343 | unsigned int char_y; |
dreschpe | 0:4bbc531be6e2 | 344 | unsigned char buffer[512]; |
dreschpe | 1:66dd8afbfd06 | 345 | unsigned int contrast; |
dreschpe | 3:468cdccff7af | 346 | unsigned int auto_up; |
dreschpe | 0:4bbc531be6e2 | 347 | |
dreschpe | 0:4bbc531be6e2 | 348 | }; |
dreschpe | 0:4bbc531be6e2 | 349 | |
dreschpe | 0:4bbc531be6e2 | 350 | |
dreschpe | 0:4bbc531be6e2 | 351 | |
dreschpe | 0:4bbc531be6e2 | 352 | |
dreschpe | 0:4bbc531be6e2 | 353 | #endif |