Skip to content

Commit cbb5d2f

Browse files
committed
improve demo some more
1 parent 4ff3feb commit cbb5d2f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

examples/ov5640_jpeg_kaluga1_3.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,24 @@
1919

2020
import board
2121
import busio
22-
import adafruit_ov5640
22+
import displayio
2323
import microcontroller
2424

25+
import adafruit_ili9341
26+
import adafruit_ov5640
27+
28+
# Release any resources currently in use for the displays
29+
displayio.release_displays()
30+
spi = busio.SPI(MOSI=board.LCD_MOSI, clock=board.LCD_CLK)
31+
display_bus = displayio.FourWire(
32+
spi,
33+
command=board.LCD_D_C,
34+
chip_select=board.LCD_CS,
35+
reset=board.LCD_RST,
36+
baudrate=80_000_000,
37+
)
38+
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240, rotation=90)
39+
2540
try:
2641
with open("/boot_out.txt", "a") as f:
2742
pass
@@ -31,6 +46,8 @@
3146
"A 'read-only filesystem' error occurs if you did not correctly install"
3247
"\nov5640_jpeg_kaluga1_3_boot.py as CIRCUITPY/boot.py and reset the"
3348
'\nboard while holding the "mode" button'
49+
""
50+
"This message is also shown after the board takes a picture and auto-restarts"
3451
)
3552
raise SystemExit
3653

@@ -42,7 +59,7 @@
4259
vsync=board.CAMERA_VSYNC,
4360
href=board.CAMERA_HREF,
4461
mclk=board.CAMERA_XCLK,
45-
size=adafruit_ov5640.OV5640_SIZE_SXGA,
62+
size=adafruit_ov5640.OV5640_SIZE_QSXGA,
4663
)
4764

4865
cam.colorspace = adafruit_ov5640.OV5640_COLOR_JPEG
@@ -53,9 +70,12 @@
5370

5471
print(f"Captured {len(jpeg)} bytes of jpeg data")
5572
try:
56-
print("Writing to internal storage (this is SLOW)")
73+
print(end="Writing to internal storage (this is SLOW)")
5774
with open("/cam.jpg", "wb") as f:
58-
f.write(jpeg)
75+
for i in range(0, len(jpeg), 4096):
76+
print(end=".")
77+
f.write(jpeg[i : i + 4096])
78+
print()
5979
print("Wrote to CIRCUITPY/cam.jpg")
6080
print("Resetting so computer sees new content of CIRCUITPY")
6181
time.sleep(0.5)

examples/ov5640_jpeg_kaluga1_3_boot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
a = analogio.AnalogIn(board.IO6)
2020
a_voltage = a.value * a.reference_voltage / 65535 # pylint: disable=no-member
21+
print("measured voltage", a_voltage)
2122
if abs(a_voltage - V_MODE) < 0.05: # If mode IS pressed...
2223
print("storage writable by CircuitPython")
2324
storage.remount("/", readonly=False)

0 commit comments

Comments
 (0)