|
19 | 19 |
|
20 | 20 | import board
|
21 | 21 | import busio
|
22 |
| -import adafruit_ov5640 |
| 22 | +import displayio |
23 | 23 | import microcontroller
|
24 | 24 |
|
| 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 | + |
25 | 40 | try:
|
26 | 41 | with open("/boot_out.txt", "a") as f:
|
27 | 42 | pass
|
|
31 | 46 | "A 'read-only filesystem' error occurs if you did not correctly install"
|
32 | 47 | "\nov5640_jpeg_kaluga1_3_boot.py as CIRCUITPY/boot.py and reset the"
|
33 | 48 | '\nboard while holding the "mode" button'
|
| 49 | + "" |
| 50 | + "This message is also shown after the board takes a picture and auto-restarts" |
34 | 51 | )
|
35 | 52 | raise SystemExit
|
36 | 53 |
|
|
42 | 59 | vsync=board.CAMERA_VSYNC,
|
43 | 60 | href=board.CAMERA_HREF,
|
44 | 61 | mclk=board.CAMERA_XCLK,
|
45 |
| - size=adafruit_ov5640.OV5640_SIZE_SXGA, |
| 62 | + size=adafruit_ov5640.OV5640_SIZE_QSXGA, |
46 | 63 | )
|
47 | 64 |
|
48 | 65 | cam.colorspace = adafruit_ov5640.OV5640_COLOR_JPEG
|
|
53 | 70 |
|
54 | 71 | print(f"Captured {len(jpeg)} bytes of jpeg data")
|
55 | 72 | try:
|
56 |
| - print("Writing to internal storage (this is SLOW)") |
| 73 | + print(end="Writing to internal storage (this is SLOW)") |
57 | 74 | 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() |
59 | 79 | print("Wrote to CIRCUITPY/cam.jpg")
|
60 | 80 | print("Resetting so computer sees new content of CIRCUITPY")
|
61 | 81 | time.sleep(0.5)
|
|
0 commit comments