Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit dbae77d

Browse files
committed
Update branch with latest dev
2 parents f9c06fb + e24cb75 commit dbae77d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1743
-354
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ In Device Simulator Express, you can use keyboard to interact with the device:
117117

118118
To use Device Simulator Express, install the extension from the marketplace and reload VS Code.
119119

120+
To access many of the commands, you need to open the command palette. This can be done with `CTRL + SHIFT + P` for Windows and Linux / `CMD + SHIFT + P` for Mac. It can also be accessed from the toolbar by going to `View -> Command Palette`.
121+
120122
### I. Take a look at the "Device Simulator Express: Getting Started" Command.
121123
1. Type in `"Device Simulator Express: Getting Started"` in the command palette (`CTRL + SHIFT + P` / `CMD + SHIFT + P` to open the command palette).
122124
2. Choose the the device you want to play with from the dropdown.
Binary file not shown.

src/base_circuitpython/base_cp_constants.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class CLUE_STATE:
3131
CPX = "CPX"
3232
CLUE = "CLUE"
3333
PIXELS = "pixels"
34+
SHAKE = "shake"
3435

3536
CLUE_PIN = "D18"
3637

@@ -55,6 +56,12 @@ class CLUE_STATE:
5556
CLUE_STATE.PRESSURE,
5657
CLUE_STATE.PROXIMITY,
5758
CLUE_STATE.GESTURE,
59+
CLUE_STATE.GYRO_X,
60+
CLUE_STATE.GYRO_Y,
61+
CLUE_STATE.GYRO_Z,
62+
CLUE_STATE.MAGNET_X,
63+
CLUE_STATE.MAGNET_Y,
64+
CLUE_STATE.MAGNET_Z,
5865
]
5966
)
6067

src/base_circuitpython/board.py

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,114 @@ def show(self, group=None):
1515
self.active_group = group
1616

1717
if group == None:
18-
self.terminal.draw()
18+
self.terminal._Terminal__draw()
1919
return
2020

2121
# if the group has no attribute called
2222
# "draw", then it is liable for updating itself
2323
# when it calls show
24-
if hasattr(group, "draw"):
25-
group.draw()
24+
if hasattr(group, "_Group__draw"):
25+
group._Group__draw()
2626

2727

2828
DISPLAY = Display()
2929

30-
# deafult pin,
30+
# default pin for neopixel,
3131
# shows that this could
3232
# refer to the CPX
3333
# or CLUE neopixel pin
3434
NEOPIXEL = "D00"
35+
36+
# ETC PINS WITHIN THE CLUE THAT MAY BE REFERENCED
37+
# found by runing print(dir(board)) on clue
38+
A0 = 0
39+
A1 = 0
40+
A2 = 0
41+
A3 = 0
42+
A4 = 0
43+
A5 = 0
44+
A6 = 0
45+
A7 = 0
46+
47+
ACCELEROMETER_GYRO_INTERRUPT = 0
48+
49+
BUTTON_A = 0
50+
BUTTON_B = 0
51+
52+
D0 = 0
53+
D1 = 0
54+
D2 = 0
55+
D3 = 0
56+
D4 = 0
57+
D5 = 0
58+
D6 = 0
59+
D7 = 0
60+
D8 = 0
61+
D9 = 0
62+
D10 = 0
63+
D11 = 0
64+
D12 = 0
65+
D13 = 0
66+
D14 = 0
67+
D15 = 0
68+
D16 = 0
69+
D17 = 0
70+
D18 = 0
71+
D19 = 0
72+
D20 = 0
73+
74+
I2C = 0
75+
76+
L = 0
77+
78+
MICROPHONE_CLOCK = 0
79+
MICROPHONE_DATA = 0
80+
81+
MISO = 0
82+
MOSI = 0
83+
84+
P0 = 0
85+
P1 = 0
86+
P2 = 0
87+
P3 = 0
88+
P4 = 0
89+
P5 = 0
90+
P6 = 0
91+
P7 = 0
92+
P8 = 0
93+
P9 = 0
94+
P10 = 0
95+
P11 = 0
96+
P12 = 0
97+
P13 = 0
98+
P14 = 0
99+
P15 = 0
100+
P16 = 0
101+
P17 = 0
102+
P18 = 0
103+
P19 = 0
104+
P20 = 0
105+
106+
PROXIMITY_LIGHT_INTERRUPT = 0
107+
108+
RX = 0
109+
SCK = 0
110+
SCL = 0
111+
SDA = 0
112+
113+
SPEAKER = 0
114+
115+
SPI = 0
116+
117+
TFT_BACKLIGHT = 0
118+
TFT_CS = 0
119+
TFT_DC = 0
120+
TFT_MOSI = 0
121+
TFT_RESET = 0
122+
TFT_SCK = 0
123+
124+
TX = 0
125+
126+
UART = 0
127+
128+
WHITE_LEDS = 0

src/base_circuitpython/displayio/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# https://circuitpython.readthedocs.io/en/5.0.x/shared-bindings/displayio/__init__.html
55

66
from .bitmap import Bitmap
7-
from .color_type import ColorType
87
from .group import Group
98
from .palette import Palette
109

src/base_circuitpython/displayio/bitmap.py

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,63 @@
1212

1313

1414
class Bitmap:
15+
"""
16+
.. currentmodule:: displayio
17+
18+
`Bitmap` -- Stores values in a 2D array
19+
==========================================================================
20+
21+
Stores values of a certain size in a 2D array
22+
23+
.. class:: Bitmap(width, height, value_count)
24+
25+
Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to
26+
index into a corresponding palette. This enables differently colored sprites to share the
27+
underlying Bitmap. value_count is used to minimize the memory used to store the Bitmap.
28+
29+
:param int width: The number of values wide
30+
:param int height: The number of values high
31+
:param int value_count: The number of possible pixel values.
32+
33+
"""
34+
1535
def __init__(self, width, height, value_count=255):
1636
self.__width = width
1737
self.__height = height
1838
self.values = bytearray(width * height)
1939

2040
@property
2141
def width(self):
42+
"""
43+
.. attribute:: width
44+
45+
Width of the bitmap. (read only)
46+
47+
"""
2248
return self.__width
2349

2450
@property
2551
def height(self):
52+
"""
53+
.. attribute:: height
54+
55+
Height of the bitmap. (read only)
56+
57+
"""
2658
return self.__height
2759

2860
def __setitem__(self, index, value):
61+
"""
62+
.. method:: __setitem__(index, value)
63+
64+
Sets the value at the given index. The index can either be an x,y tuple or an int equal
65+
to ``y * width + x``.
66+
67+
This allows you to::
68+
69+
bitmap[0,1] = 3
70+
71+
"""
2972
if isinstance(index, tuple):
3073
if index[0] >= self.width or index[1] >= self.height:
3174
raise IndexError(CONSTANTS.PIXEL_OUT_OF_BOUNDS)
@@ -38,6 +81,17 @@ def __setitem__(self, index, value):
3881
raise IndexError(CONSTANTS.PIXEL_OUT_OF_BOUNDS)
3982

4083
def __getitem__(self, index):
84+
"""
85+
.. method:: __getitem__(index)
86+
87+
Returns the value at the given index. The index can either be an x,y tuple or an int equal
88+
to ``y * width + x``.
89+
90+
This allows you to::
91+
92+
print(bitmap[0,1])
93+
94+
"""
4195

4296
if isinstance(index, tuple):
4397
if index[0] >= self.width or index[1] >= self.height:
@@ -49,6 +103,3 @@ def __getitem__(self, index):
49103
return self.values[index]
50104
except IndexError:
51105
raise IndexError(CONSTANTS.PIXEL_OUT_OF_BOUNDS)
52-
53-
def __len__(self):
54-
return self.width * self.height
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Datatype for the items within a palette
2-
class ColorType:
2+
class _ColorType:
33
def __init__(self, rgb888):
44
self.rgb888 = rgb888
55
self.transparent = False
66

77
def __eq__(self, other):
88
return (
9-
isinstance(other, ColorType)
9+
isinstance(other, _ColorType)
1010
and self.rgb888 == other.rgb888
1111
and self.transparent == other.transparent
1212
)

0 commit comments

Comments
 (0)