MCPcopy Create free account
hub / github.com/RetiredWizard/PyDOS / putchar

Method putchar

cpython/lib/lcd_api.py:135–155  ·  view source on GitHub ↗

Writes the indicated character to the LCD at the current cursor position, and advances the cursor by one position.

(self, char)

Source from the content-addressed store, hash-verified

133 self.hal_write_command(self.LCD_DDRAM | addr)
134
135 def putchar(self, char):
136 """Writes the indicated character to the LCD at the current cursor
137 position, and advances the cursor by one position.
138 """
139 if char == '\n':
140 if self.implied_newline:
141 # self.implied_newline means we advanced due to a wraparound,
142 # so if we get a newline right after that we ignore it.
143 self.implied_newline = False
144 else:
145 self.cursor_x = self.num_columns
146 else:
147 self.hal_write_data(ord(char))
148 self.cursor_x += 1
149 if self.cursor_x >= self.num_columns:
150 self.cursor_x = 0
151 self.cursor_y += 1
152 self.implied_newline = (char != '\n')
153 if self.cursor_y >= self.num_lines:
154 self.cursor_y = 0
155 self.move_to(self.cursor_x, self.cursor_y)
156
157 def putstr(self, string):
158 """Write the indicated string to the LCD at the current cursor

Callers 1

putstrMethod · 0.95

Calls 2

hal_write_dataMethod · 0.95
move_toMethod · 0.95

Tested by

no test coverage detected