From 05139e0db136700be1b4fe2b552d37822b6a8b5b Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 May 2023 08:03:42 -0500 Subject: [PATCH] Added remote hardware pins plumbing --- meshtastic/deviceonly.options | 2 ++ meshtastic/deviceonly.proto | 21 ++++++++++++++++++ meshtastic/mesh.options | 2 ++ meshtastic/mesh.proto | 38 ++++++++++++++++++++++++++++++++ meshtastic/module_config.options | 2 ++ meshtastic/module_config.proto | 10 +++++++++ 6 files changed, 75 insertions(+) diff --git a/meshtastic/deviceonly.options b/meshtastic/deviceonly.options index fe51ce9..1612592 100644 --- a/meshtastic/deviceonly.options +++ b/meshtastic/deviceonly.options @@ -12,3 +12,5 @@ *OEMStore.oem_text max_size:40 *OEMStore.oem_icon_bits max_size:2048 *OEMStore.oem_aes_key max_size:32 + +*NodeRemoteHardwarePins.node_remote_hardware_pins max_count:12 \ No newline at end of file diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index 4528608..fb3924e 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -72,6 +72,11 @@ message DeviceState { * Might be null */ MeshPacket rx_waypoint = 12; + + /* + * The mesh's nodes with their available gpio pins for RemoteHardware module + */ + repeated NodeRemoteHardwarePins node_remote_hardware_pins = 13; } /* @@ -158,4 +163,20 @@ message OEMStore { * A Preset LocalModuleConfig to apply during factory reset */ LocalModuleConfig oem_local_module_config = 8; +} + +/* + * RemoteHardwarePins associated with a node + */ +message NodeRemoteHardwarePin { + + /* + * The node_num exposing the available gpio pin + */ + uint32 node_num = 1; + + /* + * The the available gpio pin for usage with RemoteHardware module + */ + RemoteHardwarePin pin = 2; } \ No newline at end of file diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index c28b91c..55a9012 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -54,3 +54,5 @@ *NeighborInfo.neighbors max_count:10 *DeviceMetadata.firmware_version max_size:18 + +*RemoteHardwarePin.name max_size:15 diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index eadc0a6..28b563d 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1469,3 +1469,41 @@ message Neighbor { */ HardwareModel hw_model = 9; } + +/* + * A GPIO pin definition for remote hardware module + */ +message RemoteHardwarePin { + /* + * GPIO Pin number (must match Arduino) + */ + uint32 gpio_pin = 1; + + /* + * Name for the GPIO pin (i.e. Front gate, mailbox, etc) + */ + string name = 2; + + /* + * Type of GPIO access available to consumers on the mesh + */ + RemoteHardwarePinType type = 3; +} + +enum RemoteHardwarePinType { + + /* + * Unset/unused (should never occur) + */ + UNSET = 0; + + /* + * GPIO pin can be read (if it is high / low) + */ + ANALOG_READ = 1; + + /* + * GPIO pin can be written to (high / low) + */ + ANALOG_WRITE = 2; +} diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index bcc8bd7..bae2bcd 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -14,3 +14,5 @@ *ExternalNotificationConfig.output_vibra int_size:8 *ExternalNotificationConfig.output_buzzer int_size:8 *ExternalNotificationConfig.nag_timeout int_size:16 + +*RemoteHardwareConfig:available_pins max_count:4 \ No newline at end of file diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 40a8ef6..2d12149 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -78,6 +78,16 @@ message ModuleConfig { * Whether the Module is enabled */ bool enabled = 1; + + /* + * Whether the Module allows consumers to read / write to pins not defined in available_pins + */ + bool allow_undefined_pin_access = 2; + + /* + * Exposes the available pins to the mesh for reading and writing + */ + repeated RemoteHardwarePin available_pins = 3: } /*