Skip to content

Commit

Permalink
Merge pull request #117 from kwagyeman/kwabena/docs_update_11_19_2023
Browse files Browse the repository at this point in the history
kwabena/docs_update_11_29_2023
  • Loading branch information
iabdalkader authored Dec 1, 2023
2 parents 16b40d3 + fc74c81 commit 93c6af9
Show file tree
Hide file tree
Showing 16 changed files with 863 additions and 421 deletions.
31 changes: 20 additions & 11 deletions docs/library/network.WINC.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ Constructors
argument is passed. Otherwise, query current state if no argument is
provided. Most other methods require active interface.

.. method:: connect(ssid, [key=None, [security=WPA_PSK]])
.. method:: connect(ssid, [key=None, [security=WPA_PSK, [channel=1]]])

Connect to a wifi network with ssid ``ssid`` using key ``key`` with
security ``security``.
security ``security`` and channel ``channel``.

After connecting to the network use the :mod:`usocket` module to open TCP/UDP
ports to send and receive data.
Expand Down Expand Up @@ -141,11 +141,12 @@ Constructors

Returns a list containing:

* [0]: Channel Number (int)
* [1]: RSSI - received signal strength indicator (int)
* [2]: Authorization Type (see constants)
* [3]: MAC Address String (XX:XX:XX:XX:XX:XX) (BSSID)
* [4]: Set Service Identifier String (SSID)
* [0]: Set Service Identifier String (SSID)
* [1]: MAC Address String (XX:XX:XX:XX:XX:XX) (BSSID)
* [2]: Channel Number (int)
* [3]: RSSI - received signal strength indicator (int)
* [4]: Authorization Type (see constants)
* [5]: 1 (int)

You don't need to be connected to call this.

Expand Down Expand Up @@ -183,14 +184,14 @@ Constructors

For connecting to an open wifi network.

.. data:: WEP

For connecting to a WEP based password protected network.

.. data:: WPA_PSK

For connecting to a WPA/PSK based password protected network.

.. data:: 802_1X

Network is secured with WPA/WPA2 Enterprise.

.. data:: MODE_STA

Start in station mode (i.e. connect to a network).
Expand All @@ -199,6 +200,14 @@ Constructors

Start in access point mode (i.e. become the network).

.. data:: MODE_P2P

Start in wifi-direct mode.

.. data:: MODE_BSP

Init BSP.

.. data:: MODE_FIRMWARE

Setup in firmware update mode.
33 changes: 33 additions & 0 deletions docs/library/omv.display.DACBacklight.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.. currentmodule:: display
.. _display.DACBacklight:

class DACBacklight -- DAC Backlight
===================================

The `DACBacklight` class is used to control a screen backlight.

Constructors
------------

.. class:: display.DACBacklight(channel, [bits=8])

Creates a backlight object to initialize the display backlight. This class should be passed as
the ``backlight`` argument to any display object constructor which can use a backlight controller.

``channel`` specifies the DAC channel to use. This can be the GPIO pin also. For STM32 based
OpenMV Cams this is ``P5``.

``bits`` specifies the resolution of the DAC. The default value of 8-bits should be good enough.

Methods
-------

.. method:: DACBacklight.deinit()

Deinitializes the backlight controller.

.. method:: DACBacklight.backlight([value])

Sets the backlight strength from 0-100. Note that a linear voltage on the backlight output
will not necessary result in a linear brightness change on the screen. Typically there's
a small region where the screen brightness will change drastically.
36 changes: 36 additions & 0 deletions docs/library/omv.display.PWMBacklight.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.. currentmodule:: display
.. _display.PWMBacklight:

class PWMBacklight -- PWM Backlight
===================================

The `PWMBacklight` class is used to control a screen backlight.

Constructors
------------

.. class:: display.PWMBacklight(pin, [timer=3, [channel=3, [frequency=200]]])

Creates a backlight object to initialize the display backlight. This class should be passed as
the ``backlight`` argument to any display object constructor which can use a backlight controller.

``pin`` specifies the Pin to use.

``timer`` specifies the Timer number to use.

``channel`` specifies the Timer channel to use.

``frequency`` specifies the PWM frequency.

Methods
-------

.. method:: PWMBacklight.deinit()

Deinitializes the backlight controller.

.. method:: PWMBacklight.backlight([value])

Sets the backlight strength from 0-100. Note that a linear pwm duty cycle on the backlight output
will not necessary result in a linear brightness change on the screen. Typically there's
a small region where the screen brightness will change drastically.
49 changes: 28 additions & 21 deletions docs/library/omv.display.dsidisplay.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Example usage for driving the 800x480 MIPI LCD::
Constructors
------------

.. class:: display.DSIDisplay([framesize=display.FWVGA, [refresh=60, [portrait=False, [channel=0, [controller]]]]])
.. class:: display.DSIDisplay([framesize=display.FWVGA, [refresh=60, [portrait=False, [channel=0, [controller, [backlight]]]]]])

``framesize`` One of the standard supported resolutions.

``refresh`` Sets the LCD refresh rate in hertz. This controls the SPI LCD shield clock.
``refresh`` Sets the screen refresh rate in hertz. This controls the DSI LCD clock.

``portrait`` Swap the framesize width and height.

Expand All @@ -37,6 +37,9 @@ Constructors
``controller`` Pass the controller chip class here to initialize it along with the display. E.g.
`display.ST7701()` which is a standard display controller for MIPI DSI displays.

``backlight`` specify a backlight controller module to use. By default the backlight will be
controlled via a GPIO pin.

Methods
-------

Expand All @@ -56,16 +59,20 @@ Methods

Returns the refresh rate.

.. method:: DSIDisplay.write(image, [x=0, [y=0, [x_scale=1.0, [y_scale=1.0, [roi=None, [rgb_channel=-1, [alpha=256, [color_palette=None, [alpha_palette=None, [hint=0, [x_size=None, [y_size=None]]]]]]]]]]]])
.. method:: DSIDisplay.write(image, [x=0, [y=0, [x_scale=1.0, [y_scale=1.0, [roi=None, [rgb_channel=-1, [alpha=256, [color_palette=None, [alpha_palette=None]]]]]]]]]])

Displays an ``image`` whose top-left corner starts at location x, y.

Displays an ``image`` whose top-left corner starts at location x, y. You may either pass x, y
separately, as a tuple (x, y), or neither.
You may also pass a path instead of an image object for this method to automatically load the image
from disk and draw it in one step. E.g. ``write("test.jpg")``.

``x_scale`` controls how much the displayed image is scaled by in the x direction (float). If this
value is negative the image will be flipped horizontally.
value is negative the image will be flipped horizontally. Note that if ``y_scale`` is not specified
then it will match ``x_scale`` to maintain the aspect ratio.

``y_scale`` controls how much the displayed image is scaled by in the y direction (float). If this
value is negative the image will be flipped vertically.
value is negative the image will be flipped vertically. Note that if ``x_scale`` is not specified
then it will match ``x_scale`` to maintain the aspect ratio.

``roi`` is the region-of-interest rectangle tuple (x, y, w, h) of the image to display. This
allows you to extract just the pixels in the ROI to scale.
Expand All @@ -77,7 +84,7 @@ Methods
``alpha`` controls how opaque the image is. A value of 256 displays an opaque image while a
value lower than 256 produces a black transparent image. 0 results in a perfectly black image.

``color_palette`` if not ``-1`` can be `sensor.PALETTE_RAINBOW`, `sensor.PALETTE_IRONBOW`, or
``color_palette`` if not ``-1`` can be `image.PALETTE_RAINBOW`, `image.PALETTE_IRONBOW`, or
a 256 pixel in total RGB565 image to use as a color lookup table on the grayscale value of
whatever the input image is. This is applied after ``rgb_channel`` extraction if used.

Expand All @@ -92,19 +99,18 @@ Methods
* `image.AREA`: Use area scaling when downscaling versus the default of nearest neighbor.
* `image.BILINEAR`: Use bilinear scaling versus the default of nearest neighbor scaling.
* `image.BICUBIC`: Use bicubic scaling versus the default of nearest neighbor scaling.
* `image.CENTER`: Center the image image being displayed on (x, y).
* `image.CENTER`: Center the image being drawn on the display. This is applied after scaling.
* `image.HMIRROR`: Horizontally mirror the image.
* `image.VFLIP`: Vertically flip the image.
* `image.TRANSPOSE`: Transpose the image (swap x/y).
* `image.EXTRACT_RGB_CHANNEL_FIRST`: Do rgb_channel extraction before scaling.
* `image.APPLY_COLOR_PALETTE_FIRST`: Apply color palette before scaling.

``x_size`` may be passed if ``x_scale`` is not passed to specify the size of the image to display
and ``x_scale`` will automatically be determined passed on the input image size. If neither
``y_scale`` or ``y_size`` are specified then ``y_scale`` internally will be set to be equal to
``x_size`` to maintain the aspect-ratio.

``y_size`` may be passed if ``y_scale`` is not passed to specify the size of the image to display
and ``y_scale`` will automatically be determined passed on the input image size. If neither
``x_scale`` or ``x_size`` are specified then ``x_scale`` internally will be set to be equal to
``y_size`` to maintain the aspect-ratio.
* `image.SCALE_ASPECT_KEEP`: Scale the image being drawn to fit inside the display.
* `image.SCALE_ASPECT_EXPAND`: Scale the image being drawn to fill the display (results in cropping)
* `image.SCALE_ASPECT_IGNORE`: Scale the image being drawn to fill the display (results in stretching).
* `image.ROTATE_90`: Rotate the image by 90 degrees (this is just VFLIP | TRANSPOSE).
* `image.ROTATE_180`: Rotate the image by 180 degrees (this is just HMIRROR | VFLIP).
* `image.ROTATE_270`: Rotate the image by 270 degrees (this is just HMIRROR | TRANSPOSE).

.. method:: DSIDisplay.clear([display_off=False])

Expand All @@ -116,9 +122,10 @@ Methods

.. method:: DSIDisplay.backlight([value])

Sets the lcd backlight dimming value. 0 (off) to 255 (on).
Sets the lcd backlight dimming value. 0 (off) to 100 (on).

This controls a PWM signal to a standard backlight dimming circuit.
Note that unless you pass `DACBacklight` or `PWMBacklight` the backlight will be controlled
as a GPIO pin and will only go from 0 (off) to !0 (on).

Pass no arguments to get the state of the backlight value.

Expand Down
49 changes: 28 additions & 21 deletions docs/library/omv.display.rgbdisplay.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ Example usage for driving the 800x480 24-bit Parallel LCD::
Constructors
------------

.. class:: display.RGBDisplay([framesize=display.FWVGA, [refresh=60, [display_on=True, [portrait=False, [controller]]]]])
.. class:: display.RGBDisplay([framesize=display.FWVGA, [refresh=60, [display_on=True, [portrait=False, [controller, [backlight]]]]]])

``framesize`` One of the standard supported resolutions.

``refresh`` Sets the LCD refresh rate in hertz. This controls the SPI LCD shield clock.
``refresh`` Sets the screen refresh rate in hertz. This controls the RGB LCD clock.

``display_on`` Enables the display. Pass `False` here when the 24-bit parallel LCD output is
shared by multiple devices like the TFP410 chip for driving HDMI displays to keep the display
Expand All @@ -38,6 +38,9 @@ Constructors

``controller`` Pass the controller chip class here to initialize it along with the display.

``backlight`` specify a backlight controller module to use. By default the backlight will be
controlled via a GPIO pin.

Methods
-------

Expand All @@ -57,16 +60,20 @@ Methods

Returns the refresh rate.

.. method:: RGBDisplay.write(image, [x=0, [y=0, [x_scale=1.0, [y_scale=1.0, [roi=None, [rgb_channel=-1, [alpha=256, [color_palette=None, [alpha_palette=None, [hint=0, [x_size=None, [y_size=None]]]]]]]]]]]])
.. method:: RGBDisplay.write(image, [x=0, [y=0, [x_scale=1.0, [y_scale=1.0, [roi=None, [rgb_channel=-1, [alpha=256, [color_palette=None, [alpha_palette=None, [hint=0]]]]]]]]]])

Displays an ``image`` whose top-left corner starts at location x, y.

Displays an ``image`` whose top-left corner starts at location x, y. You may either pass x, y
separately, as a tuple (x, y), or neither.
You may also pass a path instead of an image object for this method to automatically load the image
from disk and draw it in one step. E.g. ``write("test.jpg")``.

``x_scale`` controls how much the displayed image is scaled by in the x direction (float). If this
value is negative the image will be flipped horizontally.
value is negative the image will be flipped horizontally. Note that if ``y_scale`` is not specified
then it will match ``x_scale`` to maintain the aspect ratio.

``y_scale`` controls how much the displayed image is scaled by in the y direction (float). If this
value is negative the image will be flipped vertically.
value is negative the image will be flipped vertically. Note that if ``x_scale`` is not specified
then it will match ``x_scale`` to maintain the aspect ratio.

``roi`` is the region-of-interest rectangle tuple (x, y, w, h) of the image to display. This
allows you to extract just the pixels in the ROI to scale.
Expand All @@ -78,7 +85,7 @@ Methods
``alpha`` controls how opaque the image is. A value of 256 displays an opaque image while a
value lower than 256 produces a black transparent image. 0 results in a perfectly black image.

``color_palette`` if not ``-1`` can be `sensor.PALETTE_RAINBOW`, `sensor.PALETTE_IRONBOW`, or
``color_palette`` if not ``-1`` can be `image.PALETTE_RAINBOW`, `image.PALETTE_IRONBOW`, or
a 256 pixel in total RGB565 image to use as a color lookup table on the grayscale value of
whatever the input image is. This is applied after ``rgb_channel`` extraction if used.

Expand All @@ -93,19 +100,18 @@ Methods
* `image.AREA`: Use area scaling when downscaling versus the default of nearest neighbor.
* `image.BILINEAR`: Use bilinear scaling versus the default of nearest neighbor scaling.
* `image.BICUBIC`: Use bicubic scaling versus the default of nearest neighbor scaling.
* `image.CENTER`: Center the image image being displayed on (x, y).
* `image.CENTER`: Center the image being drawn on the display. This is applied after scaling.
* `image.HMIRROR`: Horizontally mirror the image.
* `image.VFLIP`: Vertically flip the image.
* `image.TRANSPOSE`: Transpose the image (swap x/y).
* `image.EXTRACT_RGB_CHANNEL_FIRST`: Do rgb_channel extraction before scaling.
* `image.APPLY_COLOR_PALETTE_FIRST`: Apply color palette before scaling.

``x_size`` may be passed if ``x_scale`` is not passed to specify the size of the image to display
and ``x_scale`` will automatically be determined passed on the input image size. If neither
``y_scale`` or ``y_size`` are specified then ``y_scale`` internally will be set to be equal to
``x_size`` to maintain the aspect-ratio.

``y_size`` may be passed if ``y_scale`` is not passed to specify the size of the image to display
and ``y_scale`` will automatically be determined passed on the input image size. If neither
``x_scale`` or ``x_size`` are specified then ``x_scale`` internally will be set to be equal to
``y_size`` to maintain the aspect-ratio.
* `image.SCALE_ASPECT_KEEP`: Scale the image being drawn to fit inside the display.
* `image.SCALE_ASPECT_EXPAND`: Scale the image being drawn to fill the display (results in cropping)
* `image.SCALE_ASPECT_IGNORE`: Scale the image being drawn to fill the display (results in stretching).
* `image.ROTATE_90`: Rotate the image by 90 degrees (this is just VFLIP | TRANSPOSE).
* `image.ROTATE_180`: Rotate the image by 180 degrees (this is just HMIRROR | VFLIP).
* `image.ROTATE_270`: Rotate the image by 270 degrees (this is just HMIRROR | TRANSPOSE).

.. method:: RGBDisplay.clear([display_off=False])

Expand All @@ -117,8 +123,9 @@ Methods

.. method:: RGBDisplay.backlight([value])

Sets the lcd backlight dimming value. 0 (off) to 255 (on).
Sets the lcd backlight dimming value. 0 (off) to 100 (on).

This controls a PWM signal to a standard backlight dimming circuit.
Note that unless you pass `DACBacklight` or `PWMBacklight` the backlight will be controlled
as a GPIO pin and will only go from 0 (off) to !0 (on).

Pass no arguments to get the state of the backlight value.
2 changes: 2 additions & 0 deletions docs/library/omv.display.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Classes
omv.display.dsidisplay.rst
omv.display.displaydata.rst
omv.display.ST7701.rst
omv.display.DACBacklight.rst
omv.display.PWMBacklight.rst

Constants
---------
Expand Down
Loading

0 comments on commit 93c6af9

Please sign in to comment.