diff --git a/tools/parse_files.py b/tools/parse_files.py
index 471c787..43833b6 100644
--- a/tools/parse_files.py
+++ b/tools/parse_files.py
@@ -201,7 +201,7 @@ def __repr__(self):
def create_device_module(self, dest_path):
"""Create lib.device.py file containing device-specific values."""
# reformat device constants into plain 'snake case'
- new_dict = {}
+ new_dict = {'name': self.name}
for key, val in self.constants.items():
key = key.removeprefix('_MH_').lower()
@@ -226,6 +226,17 @@ def create_device_module(self, dest_path):
file_str = f'''\
"""
This is an automatically generated module that contains the MH configuration for this specific device.
+`Device.vals` contains a dictionary of constants for this device.
+`Device.feats` contains a tuple of features that this device has, with the final value being the device name.
+
+Usage examples:
+```
+width = Device.display_width
+height = Device.display_height
+
+if 'touchscreen' in Device:
+ get_touch()
+```
"""
class Device:
diff --git a/wiki/Device.md b/wiki/Device.md
new file mode 100644
index 0000000..3bd0681
--- /dev/null
+++ b/wiki/Device.md
@@ -0,0 +1,26 @@
+## lib.device.Device
+
+`device` is an automatically generated module containing the `Device` class. This class provides access to device-specific constants (as set in the `device/DEVICENAME/definition.yml` file, and is designed to assist in building multi-platform apps.
+
+The class has two main attributes:
+`Device.vals` contains a dictionary of constants for this device.
+`Device.feats` contains a tuple of features that this device has.
+
+Usage examples:
+``` Py
+from lib.device import Device
+
+# acess device constants
+width = Device.display_width
+height = Device.display_height
+name = Device.name
+
+# Check for device features
+if 'touchscreen' in Device:
+ get_touch()
+
+if `keyboard` in Device or 'CARDPUTER' in device:
+ keyboard_stuff()
+```
+
+> Note: `Device` is a singleton and can't be called or re-initialized after importing.
diff --git a/wiki/Home.md b/wiki/Home.md
index cb6b881..9611bfb 100644
--- a/wiki/Home.md
+++ b/wiki/Home.md
@@ -1,14 +1,14 @@
### Welcome to the MicroHydra wiki!
-*This wiki is community-editable! If you'd like to help clarify or expand its contents, just fork this repo, make your changes to [/wiki](https://github.com/echo-lalia/Cardputer-MicroHydra/tree/main/wiki), and submit a pull request :)*
+*This wiki is community-editable! If you'd like to help clarify or expand its contents, just fork this repo, make your changes to [/wiki](https://github.com/echo-lalia/MicroHydra/tree/main/wiki), and submit a pull request :)*
## Multiplatform support
-MicroHydra uses a few different ideas in order to output code for multiple devices. You can learn about this [here](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/multi-platform)
+MicroHydra uses a few different ideas in order to output code for multiple devices. You can learn about this [here](https://github.com/echo-lalia/MicroHydra/wiki/multi-platform)
## Making Apps
-For a basic overview of how MicroHydra apps work, see the [App Format](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/App-Format) section.
+For a basic overview of how MicroHydra apps work, see the [App Format](https://github.com/echo-lalia/MicroHydra/wiki/App-Format) section.
@@ -31,20 +31,21 @@ MicroHydra includes a built-in library, intended to help you easily make apps. C
│ └── terminal
│
├── $lib$
-│ ├── [audio](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/Playing-Sound)
-│ ├── [display](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/Display)
-│ │ ├── [palette](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/Palette)
-│ │ └── [namedpalette](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/Palette#libdisplaynamedpalettenamedpalette)
+│ ├── [audio](https://github.com/echo-lalia/MicroHydra/wiki/Playing-Sound)
+│ ├── [display](https://github.com/echo-lalia/MicroHydra/wiki/Display)
+│ │ ├── [palette](https://github.com/echo-lalia/MicroHydra/wiki/Palette)
+│ │ └── [namedpalette](https://github.com/echo-lalia/MicroHydra/wiki/Palette#libdisplaynamedpalettenamedpalette)
│ │
│ ├── $hydra$
-│ │ ├── [beeper](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/Playing-Sound#beeper)
-│ │ ├── [color](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/color)
-│ │ ├── [config](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/Accessing-config-files)
-│ │ ├── [menu](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/HydraMenu)
-│ │ └── [popup](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/popup)
+│ │ ├── [beeper](https://github.com/echo-lalia/MicroHydra/wiki/Playing-Sound#beeper)
+│ │ ├── [color](https://github.com/echo-lalia/MicroHydra/wiki/color)
+│ │ ├── [config](https://github.com/echo-lalia/MicroHydra/wiki/Accessing-config-files)
+│ │ ├── [menu](https://github.com/echo-lalia/MicroHydra/wiki/HydraMenu)
+│ │ └── [popup](https://github.com/echo-lalia/MicroHydra/wiki/popup)
│ │
-│ ├── [userinput](https://github.com/echo-lalia/Cardputer-MicroHydra/wiki/userinput)
+│ ├── [userinput](https://github.com/echo-lalia/MicroHydra/wiki/userinput)
│ ├── battlevel
+│ ├── [device](https://github.com/echo-lalia/MicroHydra/wiki/Device)
│ ├── kanji
│ └── sdcard
│