diff --git a/docs/modules/rm2_wireless.md b/docs/modules/rm2_wireless.md index 0a8e931..0701290 100644 --- a/docs/modules/rm2_wireless.md +++ b/docs/modules/rm2_wireless.md @@ -13,27 +13,27 @@ This is the library reference for the [RM2 Wireless Module for Yukon](https://pi ## Getting Started -To start using a Wireless Module, you first need to import the class from `pimoroni_yukon.modules`. +To start using a RM2 Wireless Module, you first need to import the class from `pimoroni_yukon.modules`. ```python -from pimoroni_yukon.modules import WirelessModule +from pimoroni_yukon.modules import RM2WirelessModule ``` -Then create an instance of `WirelessModule`. This will also confirm that you have a wireless capable build flashed to your Yukon. +Then create an instance of `RM2WirelessModule`. This will also confirm that you have a wireless capable build flashed to your Yukon. ```python -module = WirelessModule() +module = RM2WirelessModule() ``` ## Initialising the Module -As with all Yukon modules, `WirelessModule` must be initialised before it can be used. This is achieved by first registering the module with the `Yukon` class, with the slot it is attached to. +As with all Yukon modules, `RM2WirelessModule` must be initialised before it can be used. This is achieved by first registering the module with the `Yukon` class, with the slot it is attached to. ```python from pimoroni_yukon import SLOT5 as SLOT # Only SLOT5 supports the RM2 Wireless Module at present -# Import and set up Yukon and WirelessModule instances +# Import and set up Yukon and RM2WirelessModule instances yukon.register_with_slot(module, SLOT) ``` @@ -44,7 +44,7 @@ Then `Yukon` can verify and initialise its modules. yukon.verify_and_initialise() ``` -This checks each slot on the board to see if the modules expected by your program are physically attached to the board. Only if they match will the `WirelessModule` be initialised. +This checks each slot on the board to see if the modules expected by your program are physically attached to the board. Only if they match will the `RM2WirelessModule` be initialised. The RM2 Wireless Module is now ready to use. It can be interacted with using Micropython's `network` libraries, see Raspberry Pi's [Pico W tutorial](https://projects.raspberrypi.org/en/projects/get-started-pico-w/2). @@ -71,6 +71,6 @@ NAME = "RM2 Wireless" is_module(adc1_level: int, adc2_level: int, slow1: bool, slow2: bool, slow3: bool) -> bool # Initialisation -WirelessModule() +RM2WirelessModule() initialise(slot: SLOT, adc1_func: Callable, adc2_func: Callable) -> None ``` diff --git a/examples/modules/rm2_wireless/cheerlights.py b/examples/modules/rm2_wireless/cheerlights.py index 41d9483..47ee95e 100644 --- a/examples/modules/rm2_wireless/cheerlights.py +++ b/examples/modules/rm2_wireless/cheerlights.py @@ -3,7 +3,7 @@ from pimoroni_yukon import Yukon from pimoroni_yukon import SLOT2 as STRIP_SLOT from pimoroni_yukon import SLOT5 as RM2_SLOT -from pimoroni_yukon.modules import LEDStripModule, WirelessModule +from pimoroni_yukon.modules import LEDStripModule, RM2WirelessModule """ @@ -41,13 +41,13 @@ STRIP_SM, LEDS_PER_STRIP, BRIGHTNESS) -wireless = WirelessModule() # Create a WirelessModule object +wireless = RM2WirelessModule() # Create a RM2WirelessModule object # Wrap the code in a try block, to catch any exceptions (including KeyboardInterrupt) try: yukon.register_with_slot(leds, STRIP_SLOT) # Register the LEDStripModule object with the slot - yukon.register_with_slot(wireless, RM2_SLOT) # Register the WirelessModule object with the slot + yukon.register_with_slot(wireless, RM2_SLOT) # Register the RM2WirelessModule object with the slot yukon.verify_and_initialise() # Verify that the modules are attached to Yukon, and initialise them wlan = network.WLAN(network.STA_IF) # Create a new network object for interacting with WiFi diff --git a/examples/modules/rm2_wireless/detect_module.py b/examples/modules/rm2_wireless/detect_module.py index 0ef71b3..967ec2d 100644 --- a/examples/modules/rm2_wireless/detect_module.py +++ b/examples/modules/rm2_wireless/detect_module.py @@ -1,6 +1,6 @@ from pimoroni_yukon import Yukon from pimoroni_yukon import SLOT5 as SLOT -from pimoroni_yukon.modules import WirelessModule +from pimoroni_yukon.modules import RM2WirelessModule """ A boilerplate example showing how to detect if the RM2 Wireless Module @@ -8,13 +8,13 @@ """ # Variables -yukon = Yukon() # Create a new Yukon object, with a lower voltage limit set -module = WirelessModule() # Create a WirelessModule object +yukon = Yukon() # Create a new Yukon object, with a lower voltage limit set +module = RM2WirelessModule() # Create a RM2WirelessModule object # Wrap the code in a try block, to catch any exceptions (including KeyboardInterrupt) try: - yukon.register_with_slot(module, SLOT) # Register the WirelessModule object with the slot - yukon.verify_and_initialise() # Verify that a WirelessModule is attached to Yukon, and initialise it + yukon.register_with_slot(module, SLOT) # Register the RM2WirelessModule object with the slot + yukon.verify_and_initialise() # Verify that a RM2WirelessModule is attached to Yukon, and initialise it # Do wireless things here diff --git a/examples/modules/rm2_wireless/wifi_scan.py b/examples/modules/rm2_wireless/wifi_scan.py index f820fa8..26208bf 100644 --- a/examples/modules/rm2_wireless/wifi_scan.py +++ b/examples/modules/rm2_wireless/wifi_scan.py @@ -2,7 +2,7 @@ import binascii from pimoroni_yukon import Yukon from pimoroni_yukon import SLOT5 as SLOT -from pimoroni_yukon.modules import WirelessModule +from pimoroni_yukon.modules import RM2WirelessModule """ Periodically scan for available WiFi networks using a RM2 Wireless Module connected to Slot 5, @@ -12,17 +12,17 @@ """ # Constants -SCAN_INTERVAL = 5.0 # The time to sleep between each network scan +SCAN_INTERVAL = 5.0 # The time to sleep between each network scan # Variables -yukon = Yukon() # Create a new Yukon object, with a lower voltage limit set -module = WirelessModule() # Create a WirelessModule object +yukon = Yukon() # Create a new Yukon object, with a lower voltage limit set +module = RM2WirelessModule() # Create a RM2WirelessModule object # Wrap the code in a try block, to catch any exceptions (including KeyboardInterrupt) try: - yukon.register_with_slot(module, SLOT) # Register the WirelessModule object with the slot - yukon.verify_and_initialise() # Verify that a WirelessModule is attached to Yukon, and initialise it + yukon.register_with_slot(module, SLOT) # Register the RM2WirelessModule object with the slot + yukon.verify_and_initialise() # Verify that a RM2WirelessModule is attached to Yukon, and initialise it wlan = network.WLAN(network.STA_IF) # Create a new network object for interacting with WiFi wlan.active(True) # Turn on WLAN communications diff --git a/lib/pimoroni_yukon/modules/__init__.py b/lib/pimoroni_yukon/modules/__init__.py index fd2b8d8..5f6308e 100644 --- a/lib/pimoroni_yukon/modules/__init__.py +++ b/lib/pimoroni_yukon/modules/__init__.py @@ -11,8 +11,8 @@ from .proto import ProtoPotModule from .quad_servo_direct import QuadServoDirectModule from .quad_servo_reg import QuadServoRegModule +from .rm2_wireless import RM2WirelessModule from .serial_servo import SerialServoModule -from .rm2_wireless import WirelessModule KNOWN_MODULES = ( @@ -25,5 +25,5 @@ ProtoPotModule, QuadServoDirectModule, QuadServoRegModule, - SerialServoModule, - WirelessModule) + RM2WirelessModule, + SerialServoModule) diff --git a/lib/pimoroni_yukon/modules/rm2_wireless.py b/lib/pimoroni_yukon/modules/rm2_wireless.py index f504047..dea6ec1 100644 --- a/lib/pimoroni_yukon/modules/rm2_wireless.py +++ b/lib/pimoroni_yukon/modules/rm2_wireless.py @@ -5,7 +5,7 @@ from .common import YukonModule, ADC_LOW, ADC_FLOAT, IO_LOW, IO_HIGH -class WirelessModule(YukonModule): +class RM2WirelessModule(YukonModule): NAME = "RM2 Wireless" # | ADC1 | ADC2 | SLOW1 | SLOW2 | SLOW3 | Module | Condition (if any) |