LCDDogm1286.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2019, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
255 #ifndef ti_drivers_lcd_LCDDogm1286__include
256 #define ti_drivers_lcd_LCDDogm1286__include
257 
258 #include <ti/drivers/SPI.h>
259 #include <ti/drivers/dpl/SemaphoreP.h>
260 
261 #ifdef __cplusplus
262 extern "C" {
263 #endif
264 
266 #define LCD_PIXELS 8192
267 
268 #define LCD_BYTES 1024
269 
270 #define LCD_COLS 128
271 
272 #define LCD_X_MIN 0
273 
274 #define LCD_X_MAX (LCD_COLS - 1)
275 
276 #define LCD_ROWS 64
277 
278 #define LCD_Y_MIN 0
279 
280 #define LCD_Y_MAX (LCD_ROWS - 1)
281 
282 #define LCD_PAGES 8
283 
284 #define LCD_PAGE_ROWS 8
285 
286 #define LCD_CHAR_WIDTH 6
287 
288 #define LCD_FONT_WIDTH 5
289 
293 typedef struct LCD_Config *LCD_Handle;
294 
302 typedef enum LCD_Align
303 {
307 } LCD_Align;
308 
316 typedef enum LCD_Page
317 {
327 } LCD_Page;
328 
336 typedef enum LCD_X_Limit
337 {
340 } LCD_X_Limit;
341 
349 typedef enum LCD_Y_Limit
350 {
353 } LCD_Y_Limit;
354 
362 typedef struct LCD_Params
363 {
364  unsigned int lcdWriteTimeout;
366  /* SPI parameters */
367  unsigned int spiBitRate;
369 } LCD_Params;
370 
375 typedef struct LCD_Command
376 {
378  char adcSet;
381  char lcdBias;
390  char displayEn;
391  char setPage;
392  char columnHi;
393  char columnLo;
394 } LCD_Command;
395 
407 typedef struct LCD_Buffer
408 {
409  char *pcBuffer;
410  unsigned int bufSize;
411  SemaphoreP_Struct bufMutex;
412 } LCD_Buffer;
413 
419 typedef struct LCD_Object
420 {
421  /* LCD control variables */
422  bool isOpen; /* Has the obj been opened? */
423  SPI_Handle spiHandle; /* SPI handle used by the LCD */
424  unsigned int lcdWriteTimeout; /* Timeout for write semaphore */
425  SemaphoreP_Struct lcdMutex; /* Semaphore associated with the lcd */
426  LCD_Buffer *lcdBuffers; /* Pointer to the array
427  with lcd buffers */
428  uint8_t nBuffers; /* number of buffers availible */
429 } LCD_Object;
430 
445 typedef struct LCD_HWAttrs
446 {
449  /* LCD mode pin */
450  uint8_t lcdModePin;
451  /* LCD reset pin */
452  uint8_t lcdResetPin;
453  /* LCD CSn pin */
454  uint8_t lcdCsnPin;
455  /* Logical peripheral number indexed
456  into the SPI_config table */
457  uint8_t spiIndex;
458 
459 } LCD_HWAttrs;
460 
466 typedef struct LCD_Config
467 {
472 } LCD_Config;
473 
482 static const LCD_Command LCD_initCmd = {
483  0x40, /*Display start line 0 */
484  0xA1, /*ADC reverse, 6 oclock viewing direction */
485  0xC0, /*Normal COM0...COM63 */
486  0xA6, /*Display normal, not mirrored */
487  0xA2, /*Set Bias 1/9 (Duty 1/65) */
488  0x2F, /*Booster, Regulator and Follower On */
489  0xF8, /*Set internal Booster to 4x */
490  0x00, /* */
491  0x27, /*Contrast set */
492  0x81, /* */
493  0x16, /* <- use value from LCD-MODULE .doc guide*/
494  /* for better contrast (not 0x10) */
495  0xAC, /*No indicator */
496  0x00, /* */
497  0xAF, /*Display on */
498  0xB0, /*Set Page 0 */
499  0x10, /*High-Nibble of column address */
500  0x00 /*Low-Nibble of column address */
501 };
502 
514 extern void LCD_close(LCD_Handle handle);
515 
524 extern void LCD_init(void);
525 
545 extern LCD_Handle LCD_open(LCD_Buffer *buffers, uint8_t nBuffers, LCD_Params *params);
546 
561 extern void LCD_Params_init(LCD_Params *params);
562 
590 extern void LCD_writeLine(LCD_Handle handle,
591  unsigned int bufIndex,
592  char *str,
593  unsigned int uiValue,
594  unsigned char ucFormat,
595  unsigned char ucLine);
596 
611 extern void LCD_update(LCD_Handle handle, unsigned int bufIndex);
612 
649 extern void LCD_updatePart(LCD_Handle handle,
650  unsigned int bufIndex,
651  unsigned char ucXFrom,
652  unsigned char ucXTo,
653  LCD_Page iPageFrom,
654  LCD_Page iPageTo);
655 
670 extern void LCD_bufferClear(LCD_Handle handle, unsigned int bufIndex);
671 
699 extern void LCD_bufferClearPage(LCD_Handle handle, unsigned int bufIndex, LCD_Page iPage);
700 
737 extern void LCD_bufferClearPart(LCD_Handle handle,
738  unsigned int bufIndex,
739  unsigned char ucXFrom,
740  unsigned char ucXTo,
741  LCD_Page iPageFrom,
742  LCD_Page iPageTo);
743 
769 extern void LCD_bufferInvert(LCD_Handle handle,
770  unsigned int bufIndex,
771  unsigned char ucXFrom,
772  unsigned char ucYFrom,
773  unsigned char ucXTo,
774  unsigned char ucYTo);
775 
808 extern void LCD_bufferInvertPage(LCD_Handle handle,
809  unsigned int bufIndex,
810  unsigned char ucXFrom,
811  unsigned char ucXTo,
812  LCD_Page iPage);
813 
844 extern void LCD_bufferPrintString(LCD_Handle handle,
845  unsigned int bufIndex,
846  const char *pcStr,
847  unsigned char ucX,
848  LCD_Page iPage);
849 
886 extern void LCD_bufferPrintStringAligned(LCD_Handle handle,
887  unsigned int bufIndex,
888  const char *pcStr,
889  LCD_Align iAlignment,
890  LCD_Page iPage);
891 
921 extern void LCD_bufferPrintInt(LCD_Handle handle,
922  unsigned int bufIndex,
923  int i32Number,
924  unsigned char ucX,
925  LCD_Page iPage);
926 
962 extern void LCD_bufferPrintIntAligned(LCD_Handle handle,
963  unsigned int bufIndex,
964  int i32Number,
965  LCD_Align iAlignment,
966  LCD_Page iPage);
967 
1004 extern void LCD_bufferPrintFloat(LCD_Handle handle,
1005  unsigned int bufIndex,
1006  float fNumber,
1007  unsigned char ucDecimals,
1008  unsigned char ucX,
1009  LCD_Page iPage);
1010 
1049 extern void LCD_bufferPrintFloatAligned(LCD_Handle handle,
1050  unsigned int bufIndex,
1051  float fNumber,
1052  unsigned char ucDecimals,
1053  LCD_Align iAlignment,
1054  LCD_Page iPage);
1055 
1082 extern void LCD_bufferSetLine(LCD_Handle handle,
1083  unsigned int bufIndex,
1084  unsigned char ucXFrom,
1085  unsigned char ucYFrom,
1086  unsigned char ucXTo,
1087  unsigned char ucYTo);
1088 
1115 extern void LCD_bufferClearLine(LCD_Handle handle,
1116  unsigned int bufIndex,
1117  unsigned char ucXFrom,
1118  unsigned char ucYFrom,
1119  unsigned char ucXTo,
1120  unsigned char ucYTo);
1121 
1145 extern void LCD_bufferSetHLine(LCD_Handle handle,
1146  unsigned int bufIndex,
1147  unsigned char ucXFrom,
1148  unsigned char ucXTo,
1149  unsigned char ucY);
1150 
1174 extern void LCD_bufferClearHLine(LCD_Handle handle,
1175  unsigned int bufIndex,
1176  unsigned char ucXFrom,
1177  unsigned char ucXTo,
1178  unsigned char ucY);
1179 
1203 extern void LCD_bufferSetVLine(LCD_Handle handle,
1204  unsigned int bufIndex,
1205  unsigned char ucX,
1206  unsigned char ucYFrom,
1207  unsigned char ucYTo);
1208 
1232 extern void LCD_bufferClearVLine(LCD_Handle handle,
1233  unsigned int bufIndex,
1234  unsigned char ucX,
1235  unsigned char ucYFrom,
1236  unsigned char ucYTo);
1237 
1263 extern void LCD_bufferHArrow(LCD_Handle handle,
1264  unsigned int bufIndex,
1265  unsigned char ucXFrom,
1266  unsigned char ucXTo,
1267  unsigned char ucY);
1268 
1294 extern void LCD_bufferVArrow(LCD_Handle handle,
1295  unsigned int bufIndex,
1296  unsigned char ucX,
1297  unsigned char ucYFrom,
1298  unsigned char ucYTo);
1299 
1320 extern void LCD_bufferSetPx(LCD_Handle handle, unsigned int bufIndex, unsigned char ucX, unsigned char ucY);
1321 
1341 extern void LCD_bufferClearPx(LCD_Handle handle, unsigned int bufIndex, unsigned char ucX, unsigned char ucY);
1342 
1362 extern void LCD_bufferCopy(LCD_Handle handle, unsigned int fromBufIndex, unsigned int toBufIndex);
1363 
1378 extern void LCD_setContrast(LCD_Handle handle, unsigned char ucContrast);
1379 
1380 #ifdef __cplusplus
1381 }
1382 #endif
1383 
1384 #endif /* ti_drivers_lcd_LCDDogm1286__include */
char displayStartLine
Definition: LCDDogm1286.h:377
LCD_Command const * LCD_initCmd
Definition: LCDDogm1286.h:448
ADC_Params params
Definition: Driver_Init.h:11
void LCD_bufferInvertPage(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucXTo, LCD_Page iPage)
This function inverts a range of columns in the display buffer on a specified page (for example...
void LCD_bufferClearPage(LCD_Handle handle, unsigned int bufIndex, LCD_Page iPage)
This function clears the page specified by iPage in the given buffer.
void LCD_Params_init(LCD_Params *params)
Function to initialize the LCD_Params struct to its defaults.
char setPage
Definition: LCDDogm1286.h:391
void LCD_writeLine(LCD_Handle handle, unsigned int bufIndex, char *str, unsigned int uiValue, unsigned char ucFormat, unsigned char ucLine)
Function that writes a string and value to a buffer and sends it to the LCD display. The written page is being cleared before it is written to.
void LCD_bufferPrintString(LCD_Handle handle, unsigned int bufIndex, const char *pcStr, unsigned char ucX, LCD_Page iPage)
Function that writes a string to the specified buffer.
void LCD_bufferCopy(LCD_Handle handle, unsigned int fromBufIndex, unsigned int toBufIndex)
This function copies the content of fromBufIndex to toBufIndex.
Definition: LCDDogm1286.h:306
unsigned int bufSize
Definition: LCDDogm1286.h:410
char contrastSet1
Definition: LCDDogm1286.h:386
void LCD_bufferClearVLine(LCD_Handle handle, unsigned int bufIndex, unsigned char ucX, unsigned char ucYFrom, unsigned char ucYTo)
This function clears a vertical line from (ucX,ucYFrom) to (ucX,ucYTo) from the buffer specified...
void LCD_bufferSetPx(LCD_Handle handle, unsigned int bufIndex, unsigned char ucX, unsigned char ucY)
This function sets a pixel on (ucX,ucY).
Serial Peripheral Interface (SPI) Driver Interface.
void LCD_bufferClear(LCD_Handle handle, unsigned int bufIndex)
Function that empties the specified LCD buffer.
struct LCD_Config LCD_Config
The LCD_Config structure contains a set of pointers used to characterize the LCD driver implementatio...
bool isOpen
Definition: LCDDogm1286.h:422
LCD_Align
LCD alignment enum.
Definition: LCDDogm1286.h:302
void LCD_bufferPrintFloat(LCD_Handle handle, unsigned int bufIndex, float fNumber, unsigned char ucDecimals, unsigned char ucX, LCD_Page iPage)
This function writes a number of data type float to the given buffer at a specified column and page...
uint8_t spiIndex
Definition: LCDDogm1286.h:457
char adcSet
Definition: LCDDogm1286.h:378
struct LCD_Params LCD_Params
LCD Parameters are used to with the LCD_open() call. Default values for these parameters are set usin...
LCD Object.
Definition: LCDDogm1286.h:419
unsigned int lcdWriteTimeout
Definition: LCDDogm1286.h:424
struct LCD_HWAttrs LCD_HWAttrs
LCD Hardware attributes.
char columnLo
Definition: LCDDogm1286.h:393
LCD_Buffer used to store data to be printed on the LCD display.
Definition: LCDDogm1286.h:407
char staticIndicator1
Definition: LCDDogm1286.h:389
static const LCD_Command LCD_initCmd
Definition: LCDDogm1286.h:482
Definition: LCDDogm1286.h:338
void LCD_bufferClearHLine(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucXTo, unsigned char ucY)
This function clears a horizontal line from (ucXFrom,ucY) to (ucXTo,ucY) from the specified buffer...
struct LCD_Object LCD_Object
LCD Object.
void LCD_bufferPrintIntAligned(LCD_Handle handle, unsigned int bufIndex, int i32Number, LCD_Align iAlignment, LCD_Page iPage)
This function writes an integer to the given buffer as specified by the iAlignment argument...
void LCD_bufferSetLine(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucYFrom, unsigned char ucXTo, unsigned char ucYTo)
This function draws a line in the specified buffer from (ucXFrom,ucYFrom) to (ucXTo,ucYTo). The function uses Bresenham&#39;s line algorithm.
Definition: LCDDogm1286.h:304
uint8_t lcdCsnPin
Definition: LCDDogm1286.h:454
LCD_Page
LCD page enum.
Definition: LCDDogm1286.h:316
#define LCD_ROWS
Definition: LCDDogm1286.h:276
SPI_FrameFormat spiFrameFormat
Definition: LCDDogm1286.h:368
void LCD_close(LCD_Handle handle)
Function to close the LCD instance specified by the LCD handle.
void LCD_bufferClearLine(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucYFrom, unsigned char ucXTo, unsigned char ucYTo)
This function clears a line in the specified buffer from (ucXFrom,ucYFrom) to (ucXTo,ucYTo). The function uses Bresenham&#39;s line algorithm.
Definition: LCDDogm1286.h:319
LCD Parameters are used to with the LCD_open() call. Default values for these parameters are set usin...
Definition: LCDDogm1286.h:362
The LCD_Config structure contains a set of pointers used to characterize the LCD driver implementatio...
Definition: LCDDogm1286.h:466
LCD_Handle LCD_open(LCD_Buffer *buffers, uint8_t nBuffers, LCD_Params *params)
Function to set up the DOGM128W-6 LCD display.
struct LCD_Buffer LCD_Buffer
LCD_Buffer used to store data to be printed on the LCD display.
void LCD_init(void)
This function initializes the LCD driver module.
void LCD_bufferPrintFloatAligned(LCD_Handle handle, unsigned int bufIndex, float fNumber, unsigned char ucDecimals, LCD_Align iAlignment, LCD_Page iPage)
This function writes a float number to the given buffer as specified by the iAlignment argument...
#define LCD_COLS
Definition: LCDDogm1286.h:270
void LCD_bufferPrintInt(LCD_Handle handle, unsigned int bufIndex, int i32Number, unsigned char ucX, LCD_Page iPage)
Function that writes an integer to the specified buffer.
LCD_X_Limit
LCD x-axis enum.
Definition: LCDDogm1286.h:336
Definition: LCDDogm1286.h:321
void LCD_bufferPrintStringAligned(LCD_Handle handle, unsigned int bufIndex, const char *pcStr, LCD_Align iAlignment, LCD_Page iPage)
This function writes a string to the given buffer specified by the iAlignment argument.
char contrastSet2
Definition: LCDDogm1286.h:387
char columnHi
Definition: LCDDogm1286.h:392
void LCD_bufferClearPx(LCD_Handle handle, unsigned int bufIndex, unsigned char ucX, unsigned char ucY)
This function clears the pixel at (ucX,ucY).
uint8_t nBuffers
Definition: LCDDogm1286.h:428
Definition: LCDDogm1286.h:324
void LCD_bufferClearPart(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucXTo, LCD_Page iPageFrom, LCD_Page iPageTo)
This function clears the pixels in a given piece of a page. Resolution is given in coulmns [0–127] a...
uint8_t lcdModePin
Definition: LCDDogm1286.h:450
LCD Hardware attributes.
Definition: LCDDogm1286.h:445
Definition: LCDDogm1286.h:320
char staticIndicator0
Definition: LCDDogm1286.h:388
unsigned int lcdWriteTimeout
Definition: LCDDogm1286.h:364
Definition: LCDDogm1286.h:325
struct LCD_Config * LCD_Handle
A handle that is returned from a LCD_open() call.
Definition: LCDDogm1286.h:293
char outputMode
Definition: LCDDogm1286.h:379
struct LCD_Command LCD_Command
Format of LCD commands used by the LCD controller.
char contrastSet0
Definition: LCDDogm1286.h:385
SPI Global configuration.
Definition: SPI.h:744
uint8_t lcdResetPin
Definition: LCDDogm1286.h:452
Definition: LCDDogm1286.h:305
LCD_Buffer * lcdBuffers
Definition: LCDDogm1286.h:426
char displayType
Definition: LCDDogm1286.h:380
void LCD_bufferVArrow(LCD_Handle handle, unsigned int bufIndex, unsigned char ucX, unsigned char ucYFrom, unsigned char ucYTo)
This function draws a vertical arrow from (ucX,ucYFrom) to (ucX,ucYTo) to the buffer specified...
void LCD_update(LCD_Handle handle, unsigned int bufIndex)
Function that writes the specified buffer to the LCD display.
char lcdBias
Definition: LCDDogm1286.h:381
void LCD_bufferSetVLine(LCD_Handle handle, unsigned int bufIndex, unsigned char ucX, unsigned char ucYFrom, unsigned char ucYTo)
This function draws a vertical line from (ucX,ucYFrom) to (ucX,ucYTo) into the specified buffer...
char boosterRadio1
Definition: LCDDogm1286.h:384
void LCD_bufferInvert(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucYFrom, unsigned char ucXTo, unsigned char ucYTo)
This function inverts the pixels (bits) in a given region of the specified buffer.
Definition: LCDDogm1286.h:339
void LCD_updatePart(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucXTo, LCD_Page iPageFrom, LCD_Page iPageTo)
Function that sends the specified part of the given buffer to the corresponding part on the LCD...
Definition: LCDDogm1286.h:352
LCD_Object * object
Definition: LCDDogm1286.h:469
Definition: LCDDogm1286.h:323
char displayEn
Definition: LCDDogm1286.h:390
Definition: LCDDogm1286.h:351
char * pcBuffer
Definition: LCDDogm1286.h:409
Format of LCD commands used by the LCD controller.
Definition: LCDDogm1286.h:375
char powerControl
Definition: LCDDogm1286.h:382
void LCD_bufferSetHLine(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucXTo, unsigned char ucY)
This function draws a horizontal line from (ucXFrom,ucY) to (ucXTo,ucY) into the specified buffer...
void LCD_bufferHArrow(LCD_Handle handle, unsigned int bufIndex, unsigned char ucXFrom, unsigned char ucXTo, unsigned char ucY)
This function draws a horizontal arrow from (ucXFrom,ucY) to (ucXTo,ucY) to buffer specified...
Definition: LCDDogm1286.h:318
SPI_Handle spiHandle
Definition: LCDDogm1286.h:423
SemaphoreP_Struct lcdMutex
Definition: LCDDogm1286.h:425
void LCD_setContrast(LCD_Handle handle, unsigned char ucContrast)
This Function sets the LCD contrast.
char boosterRadio0
Definition: LCDDogm1286.h:383
unsigned int spiBitRate
Definition: LCDDogm1286.h:367
SPI_FrameFormat
Definitions for various SPI data frame formats.
Definition: SPI.h:601
Definition: LCDDogm1286.h:326
Definition: LCDDogm1286.h:322
SemaphoreP_Struct bufMutex
Definition: LCDDogm1286.h:411
LCD_HWAttrs const * hwAttrs
Definition: LCDDogm1286.h:471
LCD_Y_Limit
LCD y-axis enum.
Definition: LCDDogm1286.h:349
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale