Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion docs/library/errno.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@
|see_cpython_module| :mod:`python:errno`.

This module provides access to symbolic error codes for `OSError` exception.
Some codes are not available on the smallest CircuitPython builds, such as SAMD21, for space reasons.
Most SAMD21 boards, including all SAMD21 boards without external flash, do not include :mod:`errno`.
A few other small builds also do not include it.
To check a particular board, see the :ref:`module-support-matrix`.

The available codes depend on the build:

* Most builds provide ``EACCES``, ``EADDRINUSE``, ``EAGAIN``, ``EALREADY``, ``EBADF``,
``EBUSY``, ``ECONNABORTED``, ``ECONNREFUSED``, ``ECONNRESET``, ``EEXIST``,
``EHOSTUNREACH``, ``EINPROGRESS``, ``EINVAL``, ``EIO``, ``EISDIR``, ``ENOBUFS``,
``ENODEV``, ``ENOENT``, ``ENOMEM``, ``ENOSPC``, ``ENOTCONN``, ``EOPNOTSUPP``,
``EPERM``, ``EROFS``, and ``ETIMEDOUT``.
* SAMD21 builds that include :mod:`errno` provide only ``EACCES``, ``EAGAIN``, ``EEXIST``,
``EINVAL``, ``EIO``, ``EISDIR``, ``ENODEV``, ``ENOENT``, ``ENOMEM``, and ``EPERM``.

``dir(errno)`` lists the codes available on a particular board.

Constants
---------
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
#define MICROPY_PY_COLLECTIONS_DEQUE (0)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
// docs/library/errno.rst lists these names. Update it if this list changes.
#define MICROPY_PY_ERRNO_LIST \
X(EPERM) \
X(ENOENT) \
Expand Down
1 change: 1 addition & 0 deletions py/moderrno.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
// specific port's needs. If it's not defined then we provide a default.
#ifndef MICROPY_PY_ERRNO_LIST
// CIRCUITPY-CHANGE: add ENOSPC and EROFS, because they are in mp_common_errno_to_str().
// CIRCUITPY-CHANGE: docs/library/errno.rst lists these names. Update it if this list changes.
#define MICROPY_PY_ERRNO_LIST \
X(EPERM) \
X(ENOENT) \
Expand Down
3 changes: 1 addition & 2 deletions shared-bindings/alarm/touch/TouchAlarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
//| :param microcontroller.Pin pin: The pin to monitor. On some ports, the choice of pin
//| may be limited due to hardware restrictions, particularly for deep-sleep alarms.
//|
//| **Limitations:** Not available on SAMD, Nordic, or RP2040.
//| On Espressif, only available on ESP32, ESP32-S2, ESP32-S3, and ESP32-P4.
//| **Limitations:** Available only on Espressif ESP32, ESP32-S2, ESP32-S3, and ESP32-P4.
//| """
//| ...
//|
Expand Down
5 changes: 3 additions & 2 deletions shared-bindings/analogio/AnalogOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
//| class AnalogOut:
//| """Output analog values (a specific voltage).
//|
//| **Limitations:** Not available on Nordic, RP2040, Spresense, as there is no on-chip DAC.
//| On Espressif, available only on ESP32 and ESP32-S2; other chips do not have a DAC.
//| **Limitations:** Available only on chips with an on-chip DAC:
//| SAMD21, SAMD51, ESP32, ESP32-S2, STM32F405, STM32F407, and EFR32MG24.
//| On Zephyr-based boards, available only if the board defines a DAC.
//| On ESP32-S2 boards, GPIO18 (DAC2) is often connected to a pull-up resistor, which causes
//| `unexpected output values in the lower part of the output range
//| <https://github.com/adafruit/circuitpython/issues/7871>`_.
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/audiobusio/PDMIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
//| to allow microphone to turn on. Most require only 0.01s; some require 0.1s. Longer is safer.
//| Must be in range 0.0-1.0 seconds.
//|
//| **Limitations:** On SAMD and RP2040, supports only 8 or 16 bit mono input, with 64x oversampling.
//| **Limitations:** On SAMD and RP2xxx, supports only 8 or 16 bit mono input, with 64x oversampling.
//| On nRF52840, supports only 16 bit mono input at 16 kHz; oversampling is fixed at 64x. Not provided
//| on nRF52833 for space reasons. On Espressif, only available on ESP32, ESP32-S3, and ESP32-P4.
//|
Expand Down
14 changes: 14 additions & 0 deletions shared-bindings/busio/I2C.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ static void check_lock(busio_i2c_obj_t *self) {
//| def probe(self, address: int) -> bool:
//| """Check if a device at the specified address responds.
//|
//| **Limitations:** On Zephyr-based nRF boards, `probe()` does not work reliably
//| at 400 kHz. Use 100 kHz.
//| See `#11604 <https://github.com/adafruit/circuitpython/issues/11604>`_.
//|
//| :param int address: 7-bit device address
//| :return: ``True`` if a device at ``address`` responds; ``False`` otherwise
//| :rtype: bool"""
Expand All @@ -134,6 +138,10 @@ MP_DEFINE_CONST_FUN_OBJ_2(busio_i2c_probe_obj, busio_i2c_probe);
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a
//| list of those that respond.
//|
//| **Limitations:** On Zephyr-based nRF boards, `scan()` does not work reliably
//| at 400 kHz. Use 100 kHz.
//| See `#11604 <https://github.com/adafruit/circuitpython/issues/11604>`_.
//|
//| :return: List of device ids on the I2C bus
//| :rtype: list"""
//| ...
Expand All @@ -157,6 +165,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_scan_obj, busio_i2c_scan);
//| def try_lock(self) -> bool:
//| """Attempts to grab the I2C lock. Returns True on success.
//|
//| .. warning:: Ideally, release the lock with `unlock()` as soon as you are done with the bus.
//| Use :class:`~adafruit_bus_device.I2CDevice`, which holds the lock only
//| during each transaction.
//| On Espressif boards, holding the lock for a long time while using WiFi
//| can starve the WiFi and USB tasks, and the board may hang or restart in safe mode.
//|
//| :return: True when lock has been grabbed
//| :rtype: bool"""
//| ...
Expand Down
6 changes: 6 additions & 0 deletions shared-bindings/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_configure_obj, 1, busio_spi_configure);
//| def try_lock(self) -> bool:
//| """Attempts to grab the SPI lock. Returns True on success.
//|
//| .. warning:: Ideally, release the lock with `unlock()` as soon as you are done with the bus.
//| Use :class:`~adafruit_bus_device.SPIDevice`, which holds the lock only
//| during each transaction.
//| On Espressif boards, holding the lock for a long time while using WiFi
//| can starve the WiFi and USB tasks, and the board may hang or restart in safe mode.
//|
//| :return: True when lock has been grabbed
//| :rtype: bool"""
//| ...
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/busio/UART.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
//| *New in CircuitPython 4.0:* ``timeout`` has incompatibly changed units from milliseconds to seconds.
//| The new upper limit on ``timeout`` is meant to catch mistaken use of milliseconds.
//|
//| **Limitations:** RS485 is not supported on SAMD, Nordic, Spresense, or STM.
//| On i.MX and Raspberry Pi RP2040, RS485 support is implemented in software:
//| **Limitations:** RS485 is available only on Espressif, i.MX, and Raspberry Pi RP2xxx.
//| On i.MX and RP2xxx, RS485 support is implemented in software:
//| The timing for the ``rs485_dir`` pin signal is done on a best-effort basis, and may not meet
//| RS485 specifications intermittently.
//| """
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/countio/Counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
//| pin_counter.reset()
//| print(pin_counter.count)
//|
//| **Limitations:** On RP2040, `Counter` uses the PWM peripheral, and
//| **Limitations:** On RP2xxx, `Counter` uses the PWM peripheral, and
//| is limited to using PWM channel B pins due to hardware restrictions.
//| See the pin assignments for your board to see which pins can be used.
//| """
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/countio/Edge.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MAKE_ENUM_VALUE(countio_edge_type, edge, RISE_AND_FALL, EDGE_RISE_AND_FALL);
//| RISE_AND_FALL: Edge
//| """Count the rising and falling edges.
//|
//| **Limitations:** ``RISE_AND_FALL`` is not available to RP2040 due to hardware limitations.
//| **Limitations:** ``RISE_AND_FALL`` is not available on RP2xxx due to hardware limitations.
//| """
//|
//|
Expand Down
3 changes: 2 additions & 1 deletion shared-bindings/microcontroller/Processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ MP_PROPERTY_GETTER(mcu_processor_reset_reason_obj,
//|
//| Is `None` if the temperature is not available.
//|
//| **Limitations:** Not available on ESP32 or ESP32-S3. On small SAMD21 builds without external flash,
//| **Limitations:** Not available on ESP32, MAX32, Spresense, STM chips other than STM32F4,
//| or Zephyr-based boards. On small SAMD21 builds without external flash,
//| the reported temperature has reduced accuracy and precision, to save code space.
//| """
static mp_obj_t mcu_processor_get_temperature(mp_obj_t self) {
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/rtc/RTC.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MP_PROPERTY_GETSET(rtc_rtc_datetime_obj,
//|
//| A positive value speeds up the clock and a negative value slows it down.
//|
//| **Limitations:** Calibration not supported on SAMD, Nordic, RP2040, Spresense, and STM.
//| **Limitations:** Calibration is supported only on SAMD. On other ports, setting it raises `NotImplementedError`.
//|
//| Range and value is hardware specific, but one step is often approximately 1 ppm::
//|
Expand Down
12 changes: 7 additions & 5 deletions shared-bindings/wifi/Radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ MP_PROPERTY_GETSET(wifi_radio_hostname_obj,
//| """MAC address for the station. When the address is altered after interface is connected
//| the changes would only be reflected once the interface reconnects.
//|
//| **Limitations:** Not settable on RP2040 CYW43 boards, such as Pi Pico W.
//| **Limitations:** Settable on Espressif.
//| Not settable on Raspberry Pi RP2xxx CYW43 boards, such as Pico W and Pico 2 W.
//| """


Expand Down Expand Up @@ -232,7 +233,8 @@ MP_PROPERTY_GETSET(wifi_radio_power_management_obj,
//| """MAC address for the AP. When the address is altered after interface is started
//| the changes would only be reflected once the interface restarts.
//|
//| **Limitations:** Not settable on RP2040 CYW43 boards, such as Pi Pico W.
//| **Limitations:** Settable on Espressif.
//| Not settable on Raspberry Pi RP2xxx CYW43 boards, such as Pico W and Pico 2 W.
//| """
//|
static mp_obj_t wifi_radio_get_mac_address_ap(mp_obj_t self_in) {
Expand Down Expand Up @@ -277,7 +279,7 @@ MP_PROPERTY_GETTER(wifi_radio_mac_address_ap_obj,
//|
//| .. note::
//|
//| In the raspberrypi port (RP2040 CYW43), ``start_channel`` and ``stop_channel`` are ignored.
//| In the raspberrypi port (RP2xxx CYW43), ``start_channel`` and ``stop_channel`` are ignored.
//| """
//| ...
//|
Expand Down Expand Up @@ -378,7 +380,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station);
//|
//| .. note::
//|
//| In the raspberrypi port (RP2040 CYW43), ``max_connections`` is ignored
//| In the raspberrypi port (RP2xxx CYW43), ``max_connections`` is ignored
//| and only 2.4 GHz channels (1-13) are accepted.
//| """
//| ...
Expand Down Expand Up @@ -635,7 +637,7 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj,
//|
//| .. note::
//|
//| In the raspberrypi port (RP2040 CYW43), the access point needs to be started before the IP v4 address can be set.
//| In the raspberrypi port (RP2xxx CYW43), the access point needs to be started before the IP v4 address can be set.
//| """
//| ...
//|
Expand Down
Loading