GLCD Library
A C Library for Embedded Applications
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
NT75451.c
Go to the documentation of this file.
1 
7 /*
8  Copyright (c) 2012, Andy Gock
9 
10  All rights reserved.
11 
12  Redistribution and use in source and binary forms, with or without
13  modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright
15  notice, this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright
17  notice, this list of conditions and the following disclaimer in the
18  documentation and/or other materials provided with the distribution.
19  * Neither the name of Andy Gock nor the
20  names of its contributors may be used to endorse or promote products
21  derived from this software without specific prior written permission.
22 
23  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  DISCLAIMED. IN NO EVENT SHALL ANDY GOCK BE LIABLE FOR ANY
27  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34 
35 #if defined(GLCD_CONTROLLER_NT75451)
36 
37 #include "../glcd.h"
38 
39 void glcd_command(uint8_t c)
40 {
41  GLCD_RS_LOW();
42  glcd_parallel_write(c);
43  GLCD_RS_HIGH();
44 }
45 
46 void glcd_data(uint8_t c)
47 {
48  GLCD_RS_HIGH();
49  glcd_parallel_write(c);
50  GLCD_RS_LOW();
51 }
52 
53 void glcd_set_contrast(uint8_t val) {
54 }
55 
56 void glcd_power_down(void)
57 {
58 }
59 
60 void glcd_power_up(void)
61 {
62 }
63 
64 void glcd_set_y_address(uint8_t y)
65 {
68 }
69 
70 void glcd_set_x_address(uint8_t x)
71 {
73  uint8_t lsb, msb;
74 
75  msb = (((x & 0xF0) >> 4)| 0x10);
76  lsb = (x & 0x0F);
77 
78  glcd_command(lsb);
79  glcd_command(msb);
80 }
81 
82 /* Write screen buffer to display, within bounding box only */
83 void glcd_write()
84 {
85  uint8_t bank;
86 
87  for (bank = 0; bank < GLCD_NUMBER_OF_BANKS; bank++) {
88  /* Each bank is a single row 8 bits tall */
89  uint8_t column;
90 
91  if (glcd_bbox_selected->y_min >= (bank+1)*8) {
92  continue; /* Skip the entire bank */
93  }
94 
95  if (glcd_bbox_selected->y_max < bank*8) {
96  break; /* No more banks need updating */
97  }
98 
99  glcd_set_y_address(bank);
101 
102  for (column = glcd_bbox_selected->x_min; column <= glcd_bbox_selected->x_max; column++)
103  {
105  }
106  }
107 
108  /* Display updated, we can reset the bounding box */
109  glcd_reset_bbox();
110 
111 }
112 
113 #endif
114 
void glcd_power_up(void)
Power up the device.
glcd_BoundingBox_t * glcd_bbox_selected
Pointer to bounding box currently in use.
Definition: glcd.c:65
void glcd_write(void)
Update the display within the specified bounding box.
void glcd_set_x_address(uint8_t x)
Set X address of RAM (column).
uint8_t y_max
Definition: glcd.h:166
void glcd_power_down(void)
Power down the device.
uint8_t y_min
Definition: glcd.h:164
void glcd_data(uint8_t c)
Send data byte to LCD.
uint8_t * glcd_buffer_selected
Pointer to screen buffer currently in use.
Definition: glcd.c:60
#define GLCD_NUMBER_OF_BANKS
Definition: glcd.h:149
void glcd_set_y_address(uint8_t y)
Set Y address of RAM (select bank).
void glcd_command(uint8_t c)
Send command byte to LCD.
#define GLCD_NUMBER_OF_COLS
Definition: glcd.h:150
uint8_t x_min
Definition: glcd.h:163
void glcd_set_contrast(uint8_t val)
Set contrast.
void glcd_reset_bbox()
Reset the bounding box.
Definition: glcd.c:101