display
¶
Display utilities.
Classes:
| Name | Description |
|---|---|
Display |
Display class. |
Functions:
| Name | Description |
|---|---|
test_display |
Test for the display class. |
Display
¶
Display(i2c: I2C)
Display class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
i2c
|
I2C
|
A |
required |
Methods:
| Name | Description |
|---|---|
clear_display |
Clear the display. |
draw_progressbar |
Draw a progressbar. |
filled_rect |
Draw a filled rectangle on the display. |
print_line |
Print a line of text on the display. |
rect |
Draw a rectangle frame on the display. |
Source code in src/aalec/display.py
15 16 17 18 19 | |
clear_display
¶
clear_display() -> None
Clear the display.
Source code in src/aalec/display.py
42 43 44 45 | |
draw_progressbar
¶
Draw a progressbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
X coordinate of the upper left corner of the progressbar |
required |
y
|
int
|
Y coordinate of the upper left corner of the progressbar |
required |
width
|
int
|
Width of the progressbar in pixel. (x delta to the lower right corner.) |
required |
height
|
int
|
Height of the progressbar in pixel. (y delta to the lower right corner.) |
required |
percent
|
int
|
How many percent the bar is filled (grows to the right). |
required |
Source code in src/aalec/display.py
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 | |
filled_rect
¶
Draw a filled rectangle on the display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
X coordinate of the upper left corner of the progressbar |
required |
y
|
int
|
Y coordinate of the upper left corner of the progressbar |
required |
width
|
int
|
Width of the progressbar in pixel. (x delta to the lower right corner.) |
required |
height
|
int
|
Height of the progressbar in pixel. (y delta to the lower right corner.) |
required |
color
|
int
|
Fill color ( |
required |
Source code in src/aalec/display.py
60 61 62 63 64 65 66 67 68 69 70 71 | |
print_line
¶
Print a line of text on the display.
A line can be at most 16 characters long. (A character has a size of 8x8 pixels.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
int
|
Line number. Valid values are from 1 to 5. |
required |
text
|
str
|
The content to display. |
required |
Source code in src/aalec/display.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
rect
¶
Draw a rectangle frame on the display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
X coordinate of the upper left corner of the progressbar |
required |
y
|
int
|
Y coordinate of the upper left corner of the progressbar |
required |
width
|
int
|
Width of the progressbar in pixel. (x delta to the lower right corner.) |
required |
height
|
int
|
Height of the progressbar in pixel. (y delta to the lower right corner.) |
required |
color
|
int
|
Frame color ( |
required |
Source code in src/aalec/display.py
47 48 49 50 51 52 53 54 55 56 57 58 | |
test_display
¶
test_display() -> None
Test for the display class.
Source code in src/aalec/display.py
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 | |