DigolePrimitive - WimWWimW/touchScreen GitHub Wiki
This class implements the basic IO operations. It is the base class of DigoleBasic.
methods:
All output to the display passes here. For more reliable performance it is cut into 64-byte pieces, send with a short wait state in between. +
- parameters
- v :: bytes sequence
read a two bytes integer from the output buffer. If not available, an *ETIMEDOUT* may be raised.
true if output is currenty being copied +
Start recording output to the display in order to collect these data into a binary script See also: stopRecording() +
Return the size of the current recording buffer. If output is not being recorded, 0 is returned. +
Stop recording output and get the resulting record. If no streamHandler is provided, the recording buffer is returned. This costs extra memory for temporary variables to store the buffer while the stream is being closed. + Alternatively, when a streamHandler (function(<stream></stream>)) is defined, a callback is made before the stream is closed. The size of the buffer is returned. +
- parameters
- streamHandler :: None or a function(sourceStream, *args) to save the source stream
- *args :: extra arguments passed unchanged to the handler function
def copyfileobj(fsrc, fdst, length=16*1024):
"""copy data from file-like object fsrc to file-like object fdst"""
while 1:
buf = fsrc.read(length)
if not buf:
break
fdst.write(buf)
if ''_name__ == '__main_''':
i2c = Dummy(1, 2)
d = Display(i2c, 39)
d.screen.startRecording()
d.startUp()
with open("r:/screen.dig", "wb") as f:
script = d.screen.stopRecording(copyfileobj, f, 4)
print(script)
Send raw binary instructions to the display. See startRecording(), stopRecording().
- parameters
- binaryInstructions :: binary
Send a comand sequence to the display. + Arguments of type bytes are passed to _write unchanged; of type string get a trailing zero added, of type int are converted to the propietary 9-bit int format if greater than 255. All other types (except None, which is ignored) are converted to string. +
- parameters
- command :: (bytes) command string (see Digole manual)
- *args :: any arguments required to eecute the command
return size in bytes of a file on disk: +
- parameters
- fileName :: (string) name of the file
send conent of file on disk as raw data: +
- parameters
- fileName :: (string) name of the file
Slowly send data for those commands tha write to the flash memory and are sensitive to transmission pace. +
- parameters
- fileName :: (string) name of the file