MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / write

Method write

src/Display/Lcd/Lcd.cpp:91–153  ·  view source on GitHub ↗

Write a UTF8 byte. If textYpos is off the end of the display, then don't write anything, just update textXpos and lastCharColData

Source from the content-addressed store, hash-verified

89// Write a UTF8 byte.
90// If textYpos is off the end of the display, then don't write anything, just update textXpos and lastCharColData
91size_t Lcd::write(uint8_t c) noexcept
92{
93 if (numContinuationBytesLeft == 0)
94 {
95 if (c < 0x80)
96 {
97 return writeNative(c);
98 }
99 else if ((c & 0xE0) == 0xC0)
100 {
101 charVal = (uint32_t)(c & 0x1F);
102 numContinuationBytesLeft = 1;
103 return 1;
104 }
105 else if ((c & 0xF0) == 0xE0)
106 {
107 charVal = (uint32_t)(c & 0x0F);
108 numContinuationBytesLeft = 2;
109 return 1;
110 }
111 else if ((c & 0xF8) == 0xF0)
112 {
113 charVal = (uint32_t)(c & 0x07);
114 numContinuationBytesLeft = 3;
115 return 1;
116 }
117 else if ((c & 0xFC) == 0xF8)
118 {
119 charVal = (uint32_t)(c & 0x03);
120 numContinuationBytesLeft = 4;
121 return 1;
122 }
123 else if ((c & 0xFE) == 0xFC)
124 {
125 charVal = (uint32_t)(c & 0x01);
126 numContinuationBytesLeft = 5;
127 return 1;
128 }
129 else
130 {
131 return writeNative(0x7F);
132 }
133 }
134 else if ((c & 0xC0) == 0x80)
135 {
136 charVal = (charVal << 6) | (c & 0x3F);
137 --numContinuationBytesLeft;
138 if (numContinuationBytesLeft == 0)
139 {
140 return writeNative((charVal < 0x10000) ? (uint16_t)charVal : 0x007F);
141 }
142 else
143 {
144 return 1;
145 }
146 }
147 else
148 {

Callers 15

altcp_writeFunction · 0.45
recvFunction · 0.45
ppp_writeFunction · 0.45
writePacketRawMethod · 0.45
WriteByteRawMethod · 0.45
WriteByteSlipMethod · 0.45
xFunction · 0.45
jquery.jsFile · 0.45
FilesMenuItem.cppFile · 0.45
DebugMessageMethod · 0.45
initMethod · 0.45
THROWSFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected