summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2019-07-31 16:32:54 -0500
committerJeff Epler <jepler@gmail.com>2019-07-31 16:32:54 -0500
commitb0f7c7bc4cbecdef9c52e81b734dc7c4aa6d0421 (patch)
tree18c3f1b6e87bd3d0934d98c764be3b903606e4f1 /shared-bindings
parent3b3a7bbd064c5722946f09d5a7bfa90d7eee9b52 (diff)
parent366fdcce18e148a6828b7a7074e1e4198fca3595 (diff)
Merge remote-tracking branch 'origin/master' into nrf-pwm-audio
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/bleio/Peripheral.c2
-rw-r--r--shared-bindings/displayio/Display.c16
-rw-r--r--shared-bindings/displayio/Display.h5
-rw-r--r--shared-bindings/index.rst63
-rw-r--r--shared-bindings/support_matrix.rst16
5 files changed, 38 insertions, 64 deletions
diff --git a/shared-bindings/bleio/Peripheral.c b/shared-bindings/bleio/Peripheral.c
index 1302c9652..570896d27 100644
--- a/shared-bindings/bleio/Peripheral.c
+++ b/shared-bindings/bleio/Peripheral.c
@@ -72,7 +72,7 @@ static const char default_name[] = "CIRCUITPY";
//| serv = bleio.Service(bleio.UUID(0x180f), [chara])
//|
//| # Create a peripheral and start it up.
-//| periph = bleio.Peripheral([service])
+//| periph = bleio.Peripheral([serv])
//| adv = ServerAdvertisement(periph)
//| periph.start_advertising(adv.advertising_data_bytes, adv.scan_response_bytes)
//|
diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c
index 361a37ece..9cb4d6e74 100644
--- a/shared-bindings/displayio/Display.c
+++ b/shared-bindings/displayio/Display.c
@@ -51,7 +51,7 @@
//| Most people should not use this class directly. Use a specific display driver instead that will
//| contain the initialization sequence at minimum.
//|
-//| .. class:: Display(display_bus, init_sequence, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, set_column_command=0x2a, set_row_command=0x2b, write_ram_command=0x2c, set_vertical_scroll=0, backlight_pin=None, brightness_command=None, brightness=1.0, auto_brightness=False, single_byte_bounds=False, data_as_commands=False)
+//| .. class:: Display(display_bus, init_sequence, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, bytes_per_cell=1, reverse_pixels_in_byte=False, set_column_command=0x2a, set_row_command=0x2b, write_ram_command=0x2c, set_vertical_scroll=0, backlight_pin=None, brightness_command=None, brightness=1.0, auto_brightness=False, single_byte_bounds=False, data_as_commands=False)
//|
//| Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//|
@@ -90,6 +90,8 @@
//| support 18 bit but 16 is easier to transmit. The last bit is extrapolated.)
//| :param bool grayscale: True if the display only shows a single color.
//| :param bool pixels_in_byte_share_row: True when pixels are less than a byte and a byte includes pixels from the same row of the display. When False, pixels share a column.
+//| :param int bytes_per_cell: Number of bytes per addressable memory location when color_depth < 8. When greater than one, bytes share a row or column according to pixels_in_byte_share_row.
+//| :param bool reverse_pixels_in_byte: Reverses the pixel order within each byte when color_depth < 8. Does not apply across multiple bytes even if there is more than one byte per cell (bytes_per_cell.)
//| :param int set_column_command: Command used to set the start and end columns to update
//| :param int set_row_command: Command used so set the start and end rows to update
//| :param int write_ram_command: Command used to write pixels values into the update region. Ignored if data_as_commands is set.
@@ -102,7 +104,7 @@
//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this.
//|
STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands };
+ enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_bytes_per_cell, ARG_reverse_pixels_in_byte, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ },
@@ -114,6 +116,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
{ MP_QSTR_color_depth, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 16} },
{ MP_QSTR_grayscale, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
{ MP_QSTR_pixels_in_byte_share_row, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
+ { MP_QSTR_bytes_per_cell, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} },
+ { MP_QSTR_reverse_pixels_in_byte, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
{ MP_QSTR_set_column_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2a} },
{ MP_QSTR_set_row_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2b} },
{ MP_QSTR_write_ram_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2c} },
@@ -163,7 +167,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
common_hal_displayio_display_construct(
self,
display_bus, args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation,
- args[ARG_color_depth].u_int, args[ARG_grayscale].u_bool, args[ARG_pixels_in_byte_share_row].u_bool,
+ args[ARG_color_depth].u_int, args[ARG_grayscale].u_bool,
+ args[ARG_pixels_in_byte_share_row].u_bool, args[ARG_bytes_per_cell].u_bool, args[ARG_reverse_pixels_in_byte].u_bool,
args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int,
args[ARG_write_ram_command].u_int,
args[ARG_set_vertical_scroll].u_int,
@@ -199,7 +204,10 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in)
group = MP_OBJ_TO_PTR(native_group(group_in));
}
- common_hal_displayio_display_show(self, group);
+ bool ok = common_hal_displayio_display_show(self, group);
+ if (!ok) {
+ mp_raise_ValueError(translate("Group already used"));
+ }
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show);
diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h
index e765e6f25..a8938bbcd 100644
--- a/shared-bindings/displayio/Display.h
+++ b/shared-bindings/displayio/Display.h
@@ -40,7 +40,8 @@ extern const mp_obj_type_t displayio_display_type;
void common_hal_displayio_display_construct(displayio_display_obj_t* self,
mp_obj_t bus, uint16_t width, uint16_t height,
- int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row,
+ int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale,
+ bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte,
uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command,
mp_float_t brightness, bool auto_brightness,
@@ -48,7 +49,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* self);
-void common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group);
+bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group);
void common_hal_displayio_display_refresh_soon(displayio_display_obj_t* self);
diff --git a/shared-bindings/index.rst b/shared-bindings/index.rst
index 7152f506e..cbffdb614 100644
--- a/shared-bindings/index.rst
+++ b/shared-bindings/index.rst
@@ -1,11 +1,11 @@
Core Modules
========================================
-These core modules are intended on being consistent across ports. Currently
-they are only implemented in the SAMD21 and ESP8266 ports. A module may not exist
-in a port if no underlying hardware support is present or if flash space is
-limited. For example, a microcontroller without analog features will not have
-`analogio`.
+These core modules are intended on being consistent across ports and boards.
+A module may not exist on a port/board if no underlying hardware support is
+present or if flash space is limited. For example, a microcontroller without
+analog features will not have `analogio`. See the `support_matrix` page for
+a list of modules supported on each board.
Modules
---------
@@ -14,57 +14,6 @@ Modules
:glob:
:maxdepth: 3
+ support_matrix
*/__init__
help
-
-.. _module-support-matrix:
-
-Support Matrix
----------------
-NOTE 1: **All Supported** means the following ports are supported: SAMD21, SAMD21 Express,
-SAMD51, SAMD51 Express, and ESP8266.
-
-NOTE 2: **SAMD** and/or **SAMD Express** without additional numbers, means both SAMD21 & SAMD51 versions
-are supported.
-
-NOTE 3: The `pIRkey SAMD21 board <https://www.adafruit.com/product/3364>`_ is specialized and may not
-have modules as listed below.
-
-================= ==============================
-Module Supported Ports
-================= ==============================
-`analogio` **All Supported**
-`audiobusio` **SAMD/SAMD Express**
-`audiocore` **All with audioio, audiobusio or audiopwmio**
-`audioio` **SAMD Express**
-`audiopwmio` **nRF**
-`binascii` **ESP8266**
-`bitbangio` **SAMD Express, ESP8266**
-`board` **All Supported**
-`bleio` **nRF**
-`busio` **All Supported**
-`digitalio` **All Supported**
-`frequencyio` **SAMD51**
-`gamepad` **SAMD Express, nRF**
-`hashlib` **ESP8266**
-`i2cslave` **SAMD Express**
-`math` **All Supported**
-`microcontroller` **All Supported**
-`multiterminal` **ESP8266**
-`neopixel_write` **All Supported**
-`nvm` **SAMD Express**
-`os` **All Supported**
-`pulseio` **SAMD/SAMD Express**
-`ps2io` **SAMD/SAMD Express**
-`random` **All Supported**
-`rotaryio` **SAMD51, SAMD Express**
-`storage` **All Supported**
-`struct` **All Supported**
-`supervisor` **SAMD/SAMD Express**
-`time` **All Supported**
-`touchio` **SAMD/SAMD Express**
-`uheap` **Debug (All)**
-`usb_hid` **SAMD/SAMD Express**
-`_pixelbuf` **SAMD Express**
-`_stage` **SAMD/SAMD Express**
-================= ==============================
diff --git a/shared-bindings/support_matrix.rst b/shared-bindings/support_matrix.rst
new file mode 100644
index 000000000..124f3a810
--- /dev/null
+++ b/shared-bindings/support_matrix.rst
@@ -0,0 +1,16 @@
+.. _module-support-matrix:
+
+Support Matrix
+===============
+
+The following table lists the available built-in modules for each CircuitPython
+capable board.
+
+.. csv-table::
+ :header-rows: 1
+ :widths: 7, 50
+
+ "Board", "Modules Available"
+ {% for key, value in support_matrix|dictsort -%}
+ "{{ key }}", "{{ '`' ~ value|join("`, `") ~ '`' }}"
+ {% endfor -%}