-
Notifications
You must be signed in to change notification settings - Fork 25
/
USAGE.txt
448 lines (428 loc) · 16.2 KB
/
USAGE.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
Help on module pylcdsysinfo:
NAME
pylcdsysinfo
FILE
pylcdsysinfo.py
DESCRIPTION
# -*- coding: UTF-8 -*-
#
# Interface with LCD Sys Info USB device
#
# Copyright (C) 2012 Dan Gardner
#
# USB initialisation code has been adapted from pywws by Jim Easterbrook
# display_{text,icon}_anywhere by Manuel Mausz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See <http://www.gnu.org/licenses/gpl-3.0.txt>
CLASSES
__builtin__.object
BackgroundColours
LCDSysInfo
TextAlignment
TextColours
TextLines
class BackgroundColours(__builtin__.object)
| Palette of 16-bit (highcolor) background colours
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BLACK = 0
|
| BLUE = 31
|
| BROWN = 31200
|
| CYAN = 2047
|
| DARK_GREY = 31727
|
| GOLD = 64800
|
| GREEN = 2016
|
| LIGHT_GREY = 48631
|
| ORANGE = 64480
|
| PURPLE = 63519
|
| RED = 63488
|
| WHITE = 65535
|
| YELLOW = 65504
class LCDSysInfo(__builtin__.object)
| A Python driver for the Coldtears LCD Sys Info
| (http://coldtearselectronics.wikispaces.com/)
|
| Methods defined here:
|
| __del__(self)
| Closes the handle to the LCD Sys Info device.
|
| __init__(self, index=0)
| Opens a handle to an LCD Sys Info device.
|
| Args:
| index (int): The index of the device in the list of connected LCD
| Sys Info devices, with zero (the default) being the first device.
| Raises:
| IOError: An error ocurred while opening the LCD Sys Info device.
| RuntimeError: PyUSB 0.4 or later is required.
|
| clear_lines(self, lines, colour)
| Clear lines of the display using a coloured background.
|
| Args:
| lines (int): A number representing the lines to be cleared, using the
| values from pylcdsysinfo.TextLines OR'd together to form bits 0 to 5.
| colour (int): The background colour from pylcdsysinfo.BackgroundColours.
|
| dim_when_idle(self, value)
| Set whether to dim the LCD backlight after the device has been idle for 10 seconds.
|
| Args:
| value (bool): If true, the LCD backlight will dim when the device is idle,
| otherwise the function will be disabled.
|
| display_cpu_info(self, cpu_util, cpu_temp, util_colour=1, temp_colour=1)
| Display CPU utilisation and temperature information.
|
| Args:
| cpu_util (int): Percentage CPU utilisation, to a maximum of 4 digits,
| e.g. 994 will display 99.4%.
| cpu_temp (int): CPU temperature in degrees Celsius, to a maximum of 2 digits,
| e.g. 32 will display 32°C.
| util_colour (int): The colour of the CPU utilitisation, from
| pylcdsysinfo.BackgroundColours (defaults to GREEN).
| temp_colour (int): The colour of the CPU temperature, from
| pylcdsysinfo.BackgroundColours (defaults to GREEN).
|
| display_fan_info(self, cpufan, chafan, cpufan_colour=1, chafan_colour=1)
| Display fan speed information.
|
| Args:
| cpufan (int): Current CPU fan speed, to a maximum of 4 digits,
| e.g. 1994 will display 1994rpm.
| chafan (int): Current chassis fan speed, to a maximum of 4 digits,
| e.g. 1994 will display 1994rpm.
| cpufan_colour (int): The colour of the CPU fan speed, from
| pylcdsysinfo.BackgroundColours (defaults to GREEN).
| chafan_colour (int): The colour of the chassis fan speed, from
| pylcdsysinfo.BackgroundColours (defaults to GREEN).
|
| display_icon(self, position, icon_number)
| Display an icon at a specified position on the device.
|
| Args:
| position (int): Number representing the position in which to display
| the icon, in the range 0 to 47, where 0 is the top-left corner
| of the display and 48 is the bottom-right corner.
| icon_number (int): The index of the icon to be displayed. This may be
| in the range 1 to 43 for the default icons or 257+ for downloaded
| icons. An invalid icon number will display garbage to screen.
|
| display_icon_anywhere(self, pos_x, pos_y, icon_number)
| Display an icon at an exact position on the device.
|
| Requires firmware >=1.04
|
| Args:
| pos_x (int): Number representing the position on the x-axis, in the
| range 0 to 320 minus the width of your icon, where 0 is the left
| edge of the display and 320 is the right edge.
| pos_y (int): Number representing the position on the y-axis, in the
| range 0 to 240 minus the width of your icon, where 0 is the top
| edge of the display and 240 is the bottom edge.
| icon_number (int): The index of the icon to be displayed. This may be
| in the range 1 to 43 for the default icons or 257+ for downloaded
| icons. An invalid icon number will display garbage to screen.
|
| display_network_info(self, recv, sent, recv_colour=1, sent_colour=1, recv_mb=False, sent_mb=False)
| Display network utilisation information.
|
| Args:
| recv (int): Current network receive rate, to a maximum of 4 digits,
| e.g. 1994 will display 1994Mb.
| sent (int): Current network transmit rate, to a maximum of 4 digits,
| e.g. 1994 will display 1994Mb.
| recv_colour (int): The colour of the network receive rate, from
| pylcdsysinfo.BackgroundColours (defaults to GREEN).
| sent_colour (int): The colour of the network transmit rate, from
| pylcdsysinfo.BackgroundColours (defaults to GREEN).
| recv_mb (bool): Display receive rate in kb instead of the default Mb.
| sent_mb (bool): Display transmit rate in kb instead of the default Mb.
|
| display_ram_gpu_info(self, ram, gpu_temp, ram_colour=1, temp_colour=1)
| Display available RAM and GPU temperature information.
|
| Args:
| ram (int): Available RAM in megabytes, to a maximum of 4 digits,
| e.g. 1994 will display 1994Mb.
| gpu_temp (int): GPU temperature in degrees Celsius, to a maximum of 2 digits,
| e.g. 32 will display 32°C.
| util_colour (int): The colour of the available RAM, from
| pylcdsysinfo.BackgroundColours (defaults to GREEN).
| temp_colour (int): The colour of the GPU temperature, from
| pylcdsysinfo.BackgroundColours (defaults to GREEN).
|
| display_text_anywhere(self, pos_x, pos_y, text_string, colour)
| Display text at an exact position on the device.
|
| Requires firmware >=1.04
|
| Args:
| pos_x (int): Number representing the position on the x-axis, in the
| range 0 to 320 minus the width of your icon, where 0 is the left
| edge of the display and 320 is the right edge.
| pos_y (int): Number representing the position on the y-axis, in the
| range 0 to 240 minus the width of your icon, where 0 is the top
| edge of the display and 240 is the bottom edge.
| text_string (str): The text to be displayed
| colour (int): The text colour from pylcdsysinfo.TextColours.
|
| display_text_on_line(self, line, text_string, pad_for_icon, alignment, colour, field_length=8)
| Display text on a line of the device.
|
| Args:
| line (int): The line on which the text should be displayed, in the range 1 to 6.
| text_string (str): The text to be displayed, which will be truncated as
| required. Use "|" for wider spacing blank and "^" to display a "degrees" symbol.
| Use "\t" (TAB) to construct a two-column layout.
| All characters should be printable 7 bit US-ASCII characters.
| Other special characters than TAB, pipe, and caret are space and underscore.
| " " at the start of a string is ignored (instead use pipe, "|").
| "_" is treated as a (very small) small blank space.
| The following characters are ignored, "{", "}", and "~".
| pad_for_icon (bool): If true, padding will be added to the left of the text,
| to accommodate an icon.
| alignment (int): The text alignment from pylcdsysinfo.TextAlignment.
| May be a list/tuple with two values if text_string contains "\t".
| colour (int): The text colour from pylcdsysinfo.TextColours.
| field_length (int): If provided, limits the size of the region in
| which left/center/right alignment applies to the specified
| number of icon widths. Ignored if text_string contains "\t".
|
| get_device_info(self)
| Retrieve device information.
|
| save_brightness(self, off_value, on_value)
| Set the brightness of the LCD backlight when idle and active and
| save the values to the device.
|
| Args:
| off_value (int): Number representing the LCD backlight brightness
| when the LCD is idle.
| on_value (int): Number representing the LCD backlight brightness
| when the LCD is active.
|
| send_command_to_flash(self, address, command)
| Send command to SPI flash memory.
|
| Args:
| address (int): Address of sector or page to write
| command (int): 0=write enable, 1=write disable, 2=erase sector, 3=program page.
|
| set_brightness(self, value)
| Set the brightness of the LCD backlight without saving the value to the device.
|
| Args:
| value (int): Number representing the LCD brightness, in the range 0 to 255.
|
| set_text_background_colour(self, colour)
| Set the background colour for text display.
|
| Args:
| colour (int): The background colour from pylcdsysinfo.BackgroundColours.
|
| write_image_to_flash(self, sector, bitmap, check_sizes=True)
| Write bitmap image to SPI flash memory.
|
| Args:
| sector (int): Address of starting sector (0-511).
| bitmap (str): Contents of BMP bitmap image, in 16bpp, RGB 5:6:5 format.
|
| write_rawimage_to_flash(self, sector, rawfile, check_sizes=True)
| Write raw format bitmap image to SPI flash memory.
|
| Args:
| sector (int): Address of starting sector (0-511).
| bitmap (str/bytes/bytearray): Contents of raw bitmap image, in big endian 16bpp, RGB 5:6:5 format.
| check_sizes (bool): If True ensure image dimensions are either 36x36 or 320x240
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| chars_per_icon = 2.75
|
| clear_line_wait_ms = 1000
|
| display_sysinfo_wait_ms = 50
|
| erase_sector_wait_ms = 220
|
| max_display_icon_wait_ms = 700
|
| max_display_text_wait_ms = 85
|
| min_display_icon_wait_ms = 10
|
| usb_timeout_ms = 5000
|
| write_page_wait_ms = 15
class TextAlignment(__builtin__.object)
| Text alignment specifiers
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CENTRE = 0
|
| LEFT = 1
|
| NONE = -1
|
| RIGHT = 2
class TextColours(__builtin__.object)
| Colour palette for text colours
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BLACK = 13
|
| BRICK_RED = 16
|
| BROWN = 15
|
| CYAN = 6
|
| DARK_BLUE = 17
|
| GOLD = 25
|
| GREEN = 1
|
| GREY = 7
|
| LAVENDER = 26
|
| LIGHT_BLUE = 18
|
| LIGHT_GREEN = 31
|
| MAGENTA = 28
|
| NAVY = 30
|
| ORANGE = 21
|
| ORANGE_RED = 27
|
| PEACH = 24
|
| PINK = 23
|
| PURPLE = 22
|
| RED = 3
|
| WHITE = 5
|
| YELLOW = 2
class TextLines(__builtin__.object)
| Text line specifiers
|
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| ALL = 63
|
| LINE_1 = 1
|
| LINE_2 = 2
|
| LINE_3 = 4
|
| LINE_4 = 8
|
| LINE_5 = 16
|
| LINE_6 = 32
FUNCTIONS
count_bits_set(field)
Count the number of bits set in an integer
Discovered independently by:
- Brian W. Kernighan (C Programming Language 2nd Ed.)
- Peter Wegner (CACM 3 (1960), 322)
- Derrick Lehmer (published in 1964 in a book edited by Beckenbach)
Source: http://www-graphics.stanford.edu/~seander/bithacks.html
image_to_raw(im)
Convert PIL Image into raw image data, reverse of raw_to_image.
This is pretty much a straight clone of the approach taken by _bmp_to_raw()
this is not efficient
raw_to_image(data)
Convert raw image data, as returned from _bmp_to_raw(), into PIL Image.
Raw data is big endian 16 bit rgb565 format with a custom 8 byte header.
simpleimage_resize(im, expected_size=(320, 240))
DATA
COL2LEFT = '|||||||||___'
MAX_IMAGE_SIZE = (320, 240)
__version__ = '0.0.1.a1'
large_image_indexes = [180, 218, 256, 294, 332, 370, 408, 446]
version_info = (0, 0, 1, 'a1')
x = 7
VERSION
0.0.1.a2