From 7d40e07dfb245aef15b0b4d30c4903ef4655a260 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 19 Jan 2021 11:18:21 +0100 Subject: [PATCH] doc/hubs: InventorHub and PrimeHub on same page Make it a bit more explicit that they are the same. --- doc/api/hubs/index.rst | 1 - doc/api/hubs/inventorhub.rst | 158 ----------------------------------- doc/api/hubs/primehub.rst | 19 +++-- doc/ide/hubs/index.rst | 1 - doc/ide/hubs/inventorhub.rst | 1 - pybricks/hubs.py | 2 +- 6 files changed, 14 insertions(+), 168 deletions(-) delete mode 100644 doc/api/hubs/inventorhub.rst delete mode 100644 doc/ide/hubs/inventorhub.rst diff --git a/doc/api/hubs/index.rst b/doc/api/hubs/index.rst index 6f1cfa1..90058cd 100644 --- a/doc/api/hubs/index.rst +++ b/doc/api/hubs/index.rst @@ -11,7 +11,6 @@ cityhub technichub primehub - inventorhub ev3brick .. class:: MoveHub diff --git a/doc/api/hubs/inventorhub.rst b/doc/api/hubs/inventorhub.rst deleted file mode 100644 index 1bcfd8e..0000000 --- a/doc/api/hubs/inventorhub.rst +++ /dev/null @@ -1,158 +0,0 @@ -MINDSTORMS Inventor Hub -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. figure:: ../../api/images/inventorhub.png - :height: 15 em - -This class is identical to the -:class:`PrimeHub ` class, except -for the name. - -.. autoclass:: pybricks.hubs.InventorHub - :no-members: - - .. rubric:: Using the hub status light - - .. figure:: ../../api/images/primehub_light_label.png - :width: 22 em - - .. automethod:: pybricks.hubs::InventorHub.light.on - - .. automethod:: pybricks.hubs::InventorHub.light.off - - .. automethod:: pybricks.hubs::InventorHub.light.blink - - .. automethod:: pybricks.hubs::InventorHub.light.animate - - .. rubric:: Using the light matrix display - - .. figure:: ../../api/images/primehub_display_label.png - :width: 22 em - - .. automethod:: pybricks.hubs::InventorHub.display.orientation - - .. automethod:: pybricks.hubs::InventorHub.display.off - - .. automethod:: pybricks.hubs::InventorHub.display.pixel - - .. automethod:: pybricks.hubs::InventorHub.display.image - - .. automethod:: pybricks.hubs::InventorHub.display.animate - - .. automethod:: pybricks.hubs::InventorHub.display.number - - .. automethod:: pybricks.hubs::InventorHub.display.char - - .. automethod:: pybricks.hubs::InventorHub.display.text - - .. rubric:: Using the buttons - - .. figure:: ../../api/images/primehub_buttons_label.png - :width: 22 em - - .. automethod:: pybricks.hubs::InventorHub.buttons.pressed - - .. rubric:: Using the IMU - - .. automethod:: pybricks.hubs::InventorHub.imu.acceleration - - .. automethod:: pybricks.hubs::InventorHub.imu.gyro - - .. rubric:: Using the speaker - - .. automethod:: pybricks.hubs::InventorHub.speaker.beep - - .. automethod:: pybricks.hubs::InventorHub.speaker.play_notes - - .. rubric:: Using the battery - - .. automethod:: pybricks.hubs::InventorHub.battery.voltage - - .. automethod:: pybricks.hubs::InventorHub.battery.current - -Status light examples ---------------------- - -Turning the light on and off -**************************** - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/light_off.py - -Changing brightness and using custom colors -******************************************* - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/light_hsv.py - -Making the light blink -********************** - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/light_blink.py - -Creating light animations -************************* - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/light_animate.py - -Matrix display examples ------------------------ - -Displaying images -***************** - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/display_image.py - -Displaying numbers -****************** - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/display_number.py - -Displaying text -*************** - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/display_text.py - -Displaying individual pixels -**************************** - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/display_pixel.py - -Changing the display orientation -******************************** - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/display_orientation.py - -Making your own images -********************** - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/display_matrix.py - -Combining images to make expressions -************************************ - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/display_expression.py - -Displaying animations -********************* - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/display_animate.py - -Button examples ---------------- - -Detecting button presses -************************ - -.. literalinclude:: - ../../../examples/pup/hub_inventorhub/button_main.py diff --git a/doc/api/hubs/primehub.rst b/doc/api/hubs/primehub.rst index 5b303ec..8ba0c42 100644 --- a/doc/api/hubs/primehub.rst +++ b/doc/api/hubs/primehub.rst @@ -1,12 +1,15 @@ -SPIKE Prime Hub -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Prime Hub / Inventor Hub +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. figure:: ../../api/images/primehub.png +.. figure:: ../../api/images/primeinventorhub.png :height: 15 em -This class is identical to the -:class:`PrimeHub ` class, except -for the name. +.. class:: InventorHub + + This class is the same as the ``PrimeHub`` class, shown below. Both classes + work on both hubs. + + These hubs are completely identical. They use the same Pybricks firmware. .. autoclass:: pybricks.hubs.PrimeHub :no-members: @@ -70,6 +73,10 @@ for the name. .. automethod:: pybricks.hubs::PrimeHub.battery.current +.. note:: The examples below use the ``PrimeHub`` class. The examples work fine + on both hubs because they are the identical. If you prefer, you can + change this to ``InventorHub``. + Status light examples --------------------- diff --git a/doc/ide/hubs/index.rst b/doc/ide/hubs/index.rst index ed36e33..1131d66 100644 --- a/doc/ide/hubs/index.rst +++ b/doc/ide/hubs/index.rst @@ -11,7 +11,6 @@ cityhub technichub primehub - inventorhub .. class:: MoveHub :noindex: diff --git a/doc/ide/hubs/inventorhub.rst b/doc/ide/hubs/inventorhub.rst deleted file mode 100644 index aa82c56..0000000 --- a/doc/ide/hubs/inventorhub.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../api/hubs/inventorhub.rst diff --git a/pybricks/hubs.py b/pybricks/hubs.py index a883501..813d1f6 100644 --- a/pybricks/hubs.py +++ b/pybricks/hubs.py @@ -73,7 +73,7 @@ class TechnicHub: class PrimeHub: - """LEGO® SPIKE Prime Hub.""" + """LEGO® SPIKE Prime Hub or LEGO® MINDSTORMS Inventor Hub.""" # These class attributes are here for auto-documentation only. # In reality, they are instance attributes created by __init__.