MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / write

Method write

libraries/SHEX/SHEX.cpp:45–87  ·  view source on GitHub ↗

////////////////////////////////////// WRITE - the core

Source from the content-addressed store, hash-verified

43// WRITE - the core
44//
45size_t SHEX::write(uint8_t c)
46{
47 // PASS THROUGH MODE
48 if (_hexOutput == false) return _stream->write(c);
49
50 // HEX MODE
51 // handle end of line and position number
52 if ((_charCount % _length) == 0)
53 {
54 // insert ASCII array here
55
56 _stream->println();
57 // separator line every _vtab (default 8) lines
58 if ((_charCount % (_length * _vtab)) == 0)
59 {
60 _stream->println();
61 }
62
63 // next line
64 if (_digits > 0)
65 {
66 uint32_t mask = 0xF000;
67 if (_digits > 4) mask = 0xF00000;
68 if (_digits > 6) mask = 0xF0000000;
69 while((mask > 0xF) && (mask & _charCount) == 0)
70 {
71 _stream->print('0');
72 mask >>= 4;
73 }
74 _stream->print(_charCount, HEX);
75 _stream->print('\t');
76 }
77 }
78
79 // Print char as HEX
80 if (c < 0x10) _stream->print('0');
81 _stream->print(c, HEX);
82 _stream->print(_separator);
83 _charCount++;
84 if ((_charCount % 4) == 0) _stream->print(_separator);
85
86 return 1;
87}
88
89
90void SHEX::setHEX(bool hexOutput)

Callers 5

writeCmdMethod · 0.45
_commandMethod · 0.45
writeCmdMethod · 0.45
writeCmdMethod · 0.45
flushASCIIMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected