diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-04-27 16:45:10 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-04-27 16:45:10 -0700 |
| commit | 755d404edf00ab99bb8497d2e4a36ba18dd17a69 (patch) | |
| tree | a705a06789c0d9b182633ff669380e241b1acc59 /shared-bindings | |
| parent | f13de32208716387ca822fd25625325162b5c2f1 (diff) | |
| parent | faa50df05fa11c3903934419a2ad7d7063cf23c7 (diff) | |
Merge remote-tracking branch 'adafruit/master' into lower_power
Diffstat (limited to 'shared-bindings')
| -rw-r--r-- | shared-bindings/displayio/FourWire.c | 1 | ||||
| -rw-r--r-- | shared-bindings/displayio/I2CDisplay.c | 1 | ||||
| -rw-r--r-- | shared-bindings/displayio/ParallelBus.c | 1 | ||||
| -rw-r--r-- | shared-bindings/ulab/__init__.rst | 32 |
4 files changed, 35 insertions, 0 deletions
diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 1cd51b2e2..6ad162411 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -84,6 +84,7 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ mp_obj_t spi = args[ARG_spi_bus].u_obj; displayio_fourwire_obj_t* self = &allocate_display_bus_or_raise()->fourwire_bus; + self->base.type = &displayio_fourwire_type; uint8_t polarity = args[ARG_polarity].u_int; if (polarity != 0 && polarity != 1) { diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index dd3333f6d..963e8377c 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -73,6 +73,7 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t mp_obj_t i2c = args[ARG_i2c_bus].u_obj; displayio_i2cdisplay_obj_t* self = &allocate_display_bus_or_raise()->i2cdisplay_bus; + self->base.type = &displayio_i2cdisplay_type; common_hal_displayio_i2cdisplay_construct(self, MP_OBJ_TO_PTR(i2c), args[ARG_device_address].u_int, reset); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index 4d9ffb0a1..bdafdaef6 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -84,6 +84,7 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t mcu_pin_obj_t *reset = validate_obj_is_free_pin(args[ARG_reset].u_obj); displayio_parallelbus_obj_t* self = &allocate_display_bus_or_raise()->parallel_bus; + self->base.type = &displayio_parallelbus_type; common_hal_displayio_parallelbus_construct(self, data0, command, chip_select, write, read, reset); return self; diff --git a/shared-bindings/ulab/__init__.rst b/shared-bindings/ulab/__init__.rst index c9f2617ff..d2ff7eb80 100644 --- a/shared-bindings/ulab/__init__.rst +++ b/shared-bindings/ulab/__init__.rst @@ -191,6 +191,38 @@ Basic Array defining functions Return a new 1-D array with ``num`` elements ranging from ``start`` to ``stop`` linearly. +:mod:`ulab.compare` --- Comparison functions +============================================ + +.. module::ulab.compare + +.. method:: clip(x1, x2, x3) + + Constrain the values from ``x1`` to be between ``x2`` and ``x3``. + ``x2`` is assumed to be less than or equal to ``x3``. + + Arguments may be ulab arrays or numbers. All array arguments + must be the same size. If the inputs are all scalars, a 1-element + array is returned. + + Shorthand for ``ulab.maximum(x2, ulab.minimum(x1, x3))`` + +.. method:: maximum(x1, x2) + + Compute the element by element maximum of the arguments. + + Arguments may be ulab arrays or numbers. All array arguments + must be the same size. If the inputs are both scalars, a number is + returned + +.. method:: minimum(x1, x2) + + Compute the element by element minimum of the arguments. + + Arguments may be ulab arrays or numbers. All array arguments + must be the same size. If the inputs are both scalars, a number is + returned + :mod:`ulab.vector` --- Element-by-element functions =================================================== |
