Skip to content

Commit a5a5121

Browse files
committed
docs: pyb class split + ml audit, display/csi/sensor description expansion
- Split pyb.ADCAll, pyb.PinAF and pyb.TimerChannel into their own pages and toctree entries; tighten the host-class descriptions. - Audit every pyb class (ADC, CAN, DAC, ExtInt, Flash, I2C, LED, Pin, Servo, SPI, Timer, UART, USB_HID, USB_VCP) for OpenMV-correct pin maps, per-board availability, reformatted examples and shorter line lengths. - Cross-check ml library docs against scripts/libraries/ml/: keyword-only Model(postprocess=...), draw_predictions gains the missing scores= arg and "point" format value, mediapipe return shapes corrected, darknet/ mediapipe _NO_DETECTION empty-tuple noted, remove dead ml.utils.mod. - Expand descriptions and add runnable examples for csi, sensor, fir, tof, imu, omv and the display module + every display class (SPIDisplay, RGBDisplay, DSIDisplay, TVDisplay, DisplayData, PWMBacklight); scope RGBDisplay's display_on/HDMI note to the Pure Thermal specifically. - Move the senml example under the initial module description. - Misc: drop default-channel-8 claim on TVDisplay, fix PWMBacklight pin type, smaller fixes on bmi270/dht/ds18x20/espflash/neopixel/ssd1306/ pca9674a/gt911/romfs/onewire/index/alif/mimxrt.
1 parent 1448fd8 commit a5a5121

52 files changed

Lines changed: 1800 additions & 726 deletions

Some content is hidden

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

docs/library/bmi270.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Classes
4646

4747
``cs``
4848
Reserved for SPI mode. Must be left as ``None``; SPI is not
49-
currently implemented.
49+
currently implemented and supplying a non-I2C bus raises
50+
``ValueError``.
5051

5152
``address``
5253
7-bit I2C address of the device. Defaults to ``0x68``; some boards

docs/library/dht.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
:synopsis: DHT11 and DHT22 temperature/humidity sensor driver
66

77
The :mod:`dht` module provides drivers for the DHT11 and DHT22 (also known
8-
as AM2302) low-cost temperature and humidity sensors. The single-wire
9-
protocol is implemented in C by the underlying port (``machine.dht_readinto``,
10-
``esp.dht_readinto`` or ``pyb.dht_readinto`` depending on platform).
8+
as AM2302) low-cost temperature and humidity sensors.
119

1210
Example::
1311

1412
from machine import Pin
1513
from dht import DHT22
1614

17-
d = DHT22(Pin("P4"))
15+
d = DHT22(Pin("P7"))
1816
d.measure()
1917
print(d.temperature(), d.humidity())
2018

docs/library/ds18x20.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Example::
1515
from onewire import OneWire
1616
from ds18x20 import DS18X20
1717

18-
ds = DS18X20(OneWire(Pin("P5")))
18+
ds = DS18X20(OneWire(Pin("P7")))
1919
roms = ds.scan()
2020

2121
ds.convert_temp()

docs/library/espflash.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ The driver toggles ``RESET`` and ``GPIO0`` to put the ESP32 into download mode,
1515
then issues SLIP-framed commands to read the flash size, configure the SPI
1616
interface, write the firmware image and verify it via an MD5 digest.
1717

18-
Example::
18+
Example for the Arduino Nano RP2040 Connect (the only OpenMV-supported
19+
board where ``espflash`` is currently frozen). The NINA-W102's reset and
20+
boot-strap pins are RP2040 ``GPIO 3`` and ``GPIO 2`` respectively, and
21+
the NINA's ``UART0`` is wired to RP2040 ``UART1`` (``TX = GPIO 8``,
22+
``RX = GPIO 9``)::
1923

2024
from machine import Pin, UART
2125
from espflash import ESPFlash
2226

23-
reset = Pin("ESP_RESET", Pin.OUT)
24-
gpio0 = Pin("ESP_GPIO0", Pin.OUT)
27+
reset = Pin(3, Pin.OUT) # NINA RESET
28+
gpio0 = Pin(2, Pin.OUT) # NINA GPIO0
2529
uart = UART(1, 115200, timeout=1000)
2630

2731
esp = ESPFlash(reset, gpio0, uart)

docs/library/index.rst

Lines changed: 86 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -211,29 +211,35 @@ on each board. All the modules in *Common*, *Frozen Python helpers*, and
211211
*Networking helpers* (above) are available on every camera board unless
212212
otherwise noted.
213213

214-
.. rubric:: OPENMV_N6 (STM32N6)
214+
.. rubric:: OpenMV N6
215215

216-
OpenMV N6 (STM32N6 --- STMicroelectronics' first NPU-equipped MCU):
216+
STM32N657 (Cortex-M55 @ 800 MHz) with a 1 GHz on-chip NPU rated at
217+
600 GOPS INT8. Pairs the NPU with the PAG7936 1 MP global-shutter
218+
sensor.
217219

218220
* :mod:`pyb` --- functions related to the board
219221
* :mod:`stm` --- functionality specific to STM32 MCUs
220222
* :mod:`ssd1306` --- OLED driver
221223
* :mod:`tb6612` --- TB6612 motor driver
222224

223-
.. rubric:: OPENMV_AE3 (Alif Ensemble E3)
225+
.. rubric:: OpenMV AE3
224226

225-
OpenMV AE3 (Alif Ensemble E3 MCU):
227+
Alif Ensemble E3 dual-core SoC: Cortex-M55 @ 400 MHz (HP) plus
228+
Cortex-M55 @ 160 MHz (HE), with two on-chip NPUs (400 MHz / 204 GOPS HP
229+
NPU + 160 MHz / 46 GOPS HE NPU).
226230

227231
* :mod:`alif` --- Alif Ensemble SoC functions
228232
* :mod:`lsm6dsox` --- LSM6DSOX 6-axis IMU
229233
* :mod:`romfs` --- ROMFS helper utilities
230234
* :mod:`pca9674a` --- PCA9674A I2C expander driver
231235

232-
.. rubric:: OPENMV_RT1060 (i.MX RT1060)
236+
.. rubric:: OpenMV Cam RT1062
233237

234-
OpenMV RT1060:
238+
Low-power machine-vision board around the NXP i.MX RT1062
239+
(Cortex-M7 @ 600 MHz). Combines USB-C high-speed networking, Wi-Fi /
240+
Bluetooth and 10/100 Ethernet.
235241

236-
* :mod:`mimxrt` --- functionality specific to NXP i.MXRT
242+
* :mod:`mimxrt` --- functionality specific to NXP i.MX RT
237243
* :mod:`dht` --- DHT11 and DHT22 temperature/humidity sensors
238244
* :mod:`onewire` --- 1-Wire bus protocol
239245
* :mod:`ds18x20` --- DS18x20 temperature sensor driver
@@ -242,9 +248,11 @@ OpenMV RT1060:
242248
* :mod:`tb6612` --- TB6612 motor driver
243249
* :mod:`pca9674a` --- PCA9674A I2C expander driver
244250

245-
.. rubric:: OPENMVPT (Pure Thermal, STM32H7 + DVI/HDMI)
251+
.. rubric:: OpenMV Pure Thermal
246252

247-
OpenMV Pure Thermal:
253+
Full-system thermal imaging board around the STM32H743
254+
(Cortex-M7 @ 480 MHz) with 64 MB external SDRAM, 32 MB QSPI flash, a
255+
hardware JPEG codec and DVI/HDMI output.
248256

249257
* :mod:`pyb` --- functions related to the board
250258
* :mod:`stm` --- functionality specific to STM32 MCUs
@@ -257,9 +265,10 @@ OpenMV Pure Thermal:
257265
* :mod:`ssd1306` --- OLED driver
258266
* :mod:`tb6612` --- TB6612 motor driver
259267

260-
.. rubric:: OPENMV2 / OPENMV3 / OPENMV4 / OPENMV4P (STM32)
268+
.. rubric:: OpenMV Cam H7 Plus
261269

262-
Legacy STM32-based OpenMV camera boards:
270+
STM32H743 (Cortex-M7 @ 480 MHz) with 32 MB external SDRAM, 32 MB QSPI
271+
flash, a hardware JPEG codec and the OV5640 5MP camera module.
263272

264273
* :mod:`pyb` --- functions related to the board
265274
* :mod:`stm` --- functionality specific to STM32 MCUs
@@ -270,35 +279,52 @@ Legacy STM32-based OpenMV camera boards:
270279
* :mod:`ssd1306` --- OLED driver
271280
* :mod:`tb6612` --- TB6612 motor driver
272281

273-
.. rubric:: ARDUINO_GIGA (STM32H7 + touchscreen)
282+
.. rubric:: OpenMV Cam H7
274283

275-
Arduino Giga R1 WiFi:
284+
STM32H743 (Cortex-M7 @ 480 MHz) with 1 MB internal SRAM, 2 MB internal
285+
flash and a hardware JPEG codec.
276286

277287
* :mod:`pyb` --- functions related to the board
278288
* :mod:`stm` --- functionality specific to STM32 MCUs
279289
* :mod:`dht` --- DHT11 and DHT22 temperature/humidity sensors
280290
* :mod:`onewire` --- 1-Wire bus protocol
291+
* :mod:`ds18x20` --- DS18x20 temperature sensor driver
281292
* :mod:`neopixel` --- control of WS2812 / NeoPixel LEDs
282-
* :mod:`gt911` --- GT911 5-point capacitive touch controller
283-
* :mod:`ft5x06` --- capacitive touchscreen driver
293+
* :mod:`ssd1306` --- OLED driver
294+
* :mod:`tb6612` --- TB6612 motor driver
284295

285-
.. rubric:: ARDUINO_PORTENTA_H7 (STM32H7)
296+
.. rubric:: OpenMV Cam M7
286297

287-
Arduino Portenta H7:
298+
STM32F765 (Cortex-M7 @ 216 MHz) with 512 KB internal SRAM and 2 MB
299+
internal flash. Bundled with the OV7725 sensor.
288300

289301
* :mod:`pyb` --- functions related to the board
290302
* :mod:`stm` --- functionality specific to STM32 MCUs
291303
* :mod:`dht` --- DHT11 and DHT22 temperature/humidity sensors
304+
* :mod:`onewire` --- 1-Wire bus protocol
292305
* :mod:`ds18x20` --- DS18x20 temperature sensor driver
306+
* :mod:`neopixel` --- control of WS2812 / NeoPixel LEDs
307+
* :mod:`ssd1306` --- OLED driver
308+
* :mod:`tb6612` --- TB6612 motor driver
309+
310+
.. rubric:: OpenMV Cam M4
311+
312+
STM32F427 (Cortex-M4 @ 180 MHz) with 256 KB internal SRAM and 1 MB
313+
internal flash. Bundled with the OV7725 sensor.
314+
315+
* :mod:`pyb` --- functions related to the board
316+
* :mod:`stm` --- functionality specific to STM32 MCUs
317+
* :mod:`dht` --- DHT11 and DHT22 temperature/humidity sensors
293318
* :mod:`onewire` --- 1-Wire bus protocol
319+
* :mod:`ds18x20` --- DS18x20 temperature sensor driver
294320
* :mod:`neopixel` --- control of WS2812 / NeoPixel LEDs
295-
* :mod:`lora` --- LoRa modem driver
296321
* :mod:`ssd1306` --- OLED driver
297322
* :mod:`tb6612` --- TB6612 motor driver
298323

299-
.. rubric:: ARDUINO_NICLA_VISION (STM32H7)
324+
.. rubric:: Arduino Nicla Vision
300325

301-
Arduino Nicla Vision:
326+
22.86 × 22.86 mm machine-vision board around the STM32H747AII6
327+
dual-core SoC: Cortex-M7 @ 400 MHz plus Cortex-M4 @ 200 MHz.
302328

303329
* :mod:`pyb` --- functions related to the board
304330
* :mod:`stm` --- functionality specific to STM32 MCUs
@@ -308,33 +334,40 @@ Arduino Nicla Vision:
308334
* :mod:`onewire` --- 1-Wire bus protocol
309335
* :mod:`neopixel` --- control of WS2812 / NeoPixel LEDs
310336

311-
.. rubric:: ARDUINO_NANO_33_BLE_SENSE (Nordic nRF52840)
337+
.. rubric:: Arduino Portenta H7
312338

313-
Arduino Nano 33 BLE Sense --- board-specific :doc:`imu <imu>` wrapper
314-
that selects between the LSM9DS1 (Rev 1) and BMI270 + BMM150 (Rev 2)
315-
sensor sets, plus:
339+
66 × 25 mm industrial dev board around the STM32H747XI dual-core SoC:
340+
Cortex-M7 @ 400 MHz plus Cortex-M4 @ 200 MHz.
316341

317-
* :mod:`ubluepy` --- Bluetooth LE peripheral and central API on the
318-
Nordic SoftDevice
319-
* :mod:`bmi270` --- BMI270 6-axis IMU
320-
* :mod:`bmm150` --- BMM150 3-axis magnetometer
321-
* :mod:`lsm9ds1` --- LSM9DS1 9-axis IMU
322-
* :mod:`hts221` --- HTS221 humidity/temperature sensor
323-
* :mod:`lps22h` --- LPS22HB/HH pressure sensor
324-
* :mod:`hs3003` --- HS3003 humidity/temperature sensor
325-
* :mod:`apds9960` --- proximity, gesture, and color sensor driver
342+
* :mod:`pyb` --- functions related to the board
343+
* :mod:`stm` --- functionality specific to STM32 MCUs
326344
* :mod:`dht` --- DHT11 and DHT22 temperature/humidity sensors
327-
* :mod:`onewire` --- 1-Wire bus protocol
328345
* :mod:`ds18x20` --- DS18x20 temperature sensor driver
346+
* :mod:`onewire` --- 1-Wire bus protocol
329347
* :mod:`neopixel` --- control of WS2812 / NeoPixel LEDs
348+
* :mod:`lora` --- LoRa modem driver
349+
* :mod:`ssd1306` --- OLED driver
350+
* :mod:`tb6612` --- TB6612 motor driver
330351

331-
.. rubric:: ARDUINO_NANO_RP2040_CONNECT / RPI_PICO (RP2)
352+
.. rubric:: Arduino Giga R1 WiFi
353+
354+
101 × 53 mm Mega-form-factor board around the STM32H747XI dual-core
355+
SoC: Cortex-M7 @ 480 MHz plus Cortex-M4 @ 240 MHz, with an on-board
356+
800x480 touchscreen.
357+
358+
* :mod:`pyb` --- functions related to the board
359+
* :mod:`stm` --- functionality specific to STM32 MCUs
360+
* :mod:`dht` --- DHT11 and DHT22 temperature/humidity sensors
361+
* :mod:`onewire` --- 1-Wire bus protocol
362+
* :mod:`neopixel` --- control of WS2812 / NeoPixel LEDs
363+
* :mod:`gt911` --- GT911 5-point capacitive touch controller
364+
* :mod:`ft5x06` --- capacitive touchscreen driver
332365

333-
RP2040-based boards. The Arduino Nano RP2040 Connect adds a few extra
334-
companion-chip drivers; the Raspberry Pi Pico ships only with the core
335-
upstream drivers.
366+
.. rubric:: Arduino Nano RP2040 Connect
336367

337-
Arduino Nano RP2040 Connect:
368+
RP2040-based Nano-form-factor board with the U-blox NINA-W102
369+
Wi-Fi/Bluetooth module. *No longer actively supported; the last OpenMV
370+
firmware release for this board is retained for archival use.*
338371

339372
* :mod:`espflash` --- ESP32 ROM bootloader firmware flasher
340373
* :mod:`lsm6dsox` --- LSM6DSOX 6-axis IMU
@@ -343,8 +376,21 @@ Arduino Nano RP2040 Connect:
343376
* :mod:`ds18x20` --- DS18x20 temperature sensor driver
344377
* :mod:`neopixel` --- control of WS2812 / NeoPixel LEDs
345378

346-
Raspberry Pi Pico:
379+
.. rubric:: Arduino Nano 33 BLE Sense
380+
381+
Nordic nRF52840 Nano-form-factor board with the on-board Arduino
382+
sensor suite. *No longer actively supported; the last OpenMV firmware
383+
release for this board is retained for archival use.*
347384

385+
* :mod:`ubluepy` --- Bluetooth LE peripheral and central API on the
386+
Nordic SoftDevice
387+
* :mod:`bmi270` --- BMI270 6-axis IMU
388+
* :mod:`bmm150` --- BMM150 3-axis magnetometer
389+
* :mod:`lsm9ds1` --- LSM9DS1 9-axis IMU
390+
* :mod:`hts221` --- HTS221 humidity/temperature sensor
391+
* :mod:`lps22h` --- LPS22HB/HH pressure sensor
392+
* :mod:`hs3003` --- HS3003 humidity/temperature sensor
393+
* :mod:`apds9960` --- proximity, gesture, and color sensor driver
348394
* :mod:`dht` --- DHT11 and DHT22 temperature/humidity sensors
349395
* :mod:`onewire` --- 1-Wire bus protocol
350396
* :mod:`ds18x20` --- DS18x20 temperature sensor driver

docs/library/mimxrt.rst

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,68 @@ Classes
1212

1313
.. class:: Flash()
1414

15-
Gets the singleton object for accessing the SPI flash memory. This class
16-
gives access to the on-board SPI flash memory.
15+
Get the singleton object that exposes the user-storage region of the
16+
on-board QSPI flash as a :class:`vfs.AbstractBlockDev`-compatible block
17+
device. Block numbers are relative to the start of that region, not
18+
the physical start of flash.
1719

1820
In most cases, to store persistent data on the device, you'll want to
19-
use a higher-level abstraction, for example the filesystem via Python's
20-
standard file API, but this interface is useful to :ref:`customise the
21-
filesystem configuration <filesystem>` or implement a low-level storage
22-
system for your application.
21+
use a higher-level abstraction -- for example the filesystem via
22+
Python's standard file API. This interface is useful to
23+
:ref:`customise the filesystem configuration <filesystem>` or
24+
implement a low-level storage system for your application.
25+
26+
The object also implements the buffer protocol, allowing read-only
27+
memory-mapped access to the entire flash storage region via the QSPI
28+
XIP base. This makes a zero-copy view of the region available without
29+
issuing any flash reads::
30+
31+
flash = mimxrt.Flash()
32+
view = memoryview(flash)
33+
magic = bytes(view[:4]) # read the first 4 bytes directly from XIP
34+
35+
The block size used by the underlying flash sectors can be queried at
36+
runtime with :meth:`ioctl(5, 0) <ioctl>`.
2337

2438
.. method:: readblocks(block_num: int, buf: bytearray) -> None
2539
readblocks(block_num: int, buf: bytearray, offset: int) -> None
26-
writeblocks(block_num: int, buf: bytes) -> None
40+
41+
Read bytes from the flash into ``buf``. Two overloads expose the
42+
simple and extended interfaces:
43+
44+
**Simple form** (``readblocks(block_num, buf)``): reads whole
45+
blocks starting at block index ``block_num``. ``len(buf)`` must be
46+
a multiple of the flash block size.
47+
48+
**Extended form** (``readblocks(block_num, buf, offset)``): reads
49+
``len(buf)`` bytes -- not necessarily a whole number of blocks --
50+
starting at byte ``offset`` within block ``block_num``.
51+
``len(buf)`` has no alignment constraint.
52+
53+
.. method:: writeblocks(block_num: int, buf: bytes) -> None
2754
writeblocks(block_num: int, buf: bytes, offset: int) -> None
28-
ioctl(cmd: int, arg: int) -> Optional[int]
2955

30-
These methods implement the simple and extended
31-
:ref:`block protocol <block-device-interface>` defined by
32-
:class:`vfs.AbstractBlockDev`.
56+
Write bytes from ``buf`` to the flash. Two overloads expose the
57+
simple and extended interfaces:
58+
59+
**Simple form** (``writeblocks(block_num, buf)``): writes whole
60+
blocks starting at block index ``block_num``. ``len(buf)`` must be
61+
a multiple of the flash block size. Each affected block is erased
62+
automatically before being written.
63+
64+
**Extended form** (``writeblocks(block_num, buf, offset)``):
65+
writes ``len(buf)`` bytes -- not necessarily a whole number of
66+
blocks -- starting at byte ``offset`` within block ``block_num``.
67+
``len(buf)`` has no alignment constraint, and **no implicit erase
68+
is performed** -- the caller must ensure the affected blocks have
69+
been erased via a prior :meth:`ioctl(6, block_num) <ioctl>` call.
70+
71+
Raises ``OSError`` if the underlying flash erase or write
72+
operation fails.
73+
74+
.. method:: ioctl(cmd: int, arg: int) -> Optional[int]
3375

34-
The block size can be queried by calling ``ioctl(5, 0)``. Block numbers
35-
are relative to the start of the user flash storage area, not the physical
36-
start of flash memory.
76+
Standard :class:`vfs.AbstractBlockDev` ioctl entry point. See
77+
:meth:`vfs.AbstractBlockDev.ioctl` for the full list of ``cmd``
78+
values. ``cmd=5`` returns the flash block size in bytes; ``cmd=6``
79+
erases the block with index ``arg``.

docs/library/neopixel.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
This module provides a driver for WS2812 / NeoPixel LED strips. The driver
88
relies on `machine.bitstream()` to generate the precisely timed signal the LEDs
99
expect, so it works on any port whose ``machine`` module implements
10-
``bitstream``. It is included by default on the current OpenMV Cams and on
11-
the supported Arduino boards.
10+
``bitstream``.
1211

1312
The application sets pixel data via item assignment or `NeoPixel.fill()` and
1413
then calls `NeoPixel.write()` to update the strip. Each pixel is exposed as an
@@ -20,8 +19,8 @@ Example::
2019
import machine
2120
import neopixel
2221

23-
# 32 LED strip connected to pin P8.
24-
n = neopixel.NeoPixel(machine.Pin("P8"), 32)
22+
# 32 LED strip connected to pin P7.
23+
n = neopixel.NeoPixel(machine.Pin("P7"), 32)
2524

2625
# Draw a red gradient.
2726
for i in range(32):

0 commit comments

Comments
 (0)