diff --git a/meshtastic/deviceonly.options b/meshtastic/deviceonly.options index fe51ce9..a4588a5 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 + +*DeviceState.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..b533321 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -11,6 +11,7 @@ option swift_prefix = ""; import "meshtastic/channel.proto"; import "meshtastic/localonly.proto"; import "meshtastic/mesh.proto"; +import "meshtastic/module_config.proto"; /* * This message is never sent over the wire, but it is used for serializing DB @@ -72,6 +73,11 @@ message DeviceState { * Might be null */ MeshPacket rx_waypoint = 12; + + /* + * The mesh's nodes with their available gpio pins for RemoteHardware module + */ + repeated NodeRemoteHardwarePin node_remote_hardware_pins = 13; } /* @@ -158,4 +164,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..35e4dc6 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -53,4 +53,4 @@ *NeighborInfo.neighbors max_count:10 -*DeviceMetadata.firmware_version max_size:18 +*DeviceMetadata.firmware_version max_size:18 \ No newline at end of file diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index eadc0a6..750c7d1 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1468,4 +1468,9 @@ message Neighbor { * Device hardware model */ HardwareModel hw_model = 9; + + /* + * Has Remote Hardware enabled + */ + bool hasRemoteHardware = 10; } diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index bcc8bd7..dcf6e89 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -14,3 +14,7 @@ *ExternalNotificationConfig.output_vibra int_size:8 *ExternalNotificationConfig.output_buzzer int_size:8 *ExternalNotificationConfig.nag_timeout int_size:16 + +*RemoteHardwareConfig:available_pins max_count:4 +*RemoteHardwarePin.name max_size:15 +*RemoteHardwarePin.gpio_pin int_size:8 \ No newline at end of file diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 40a8ef6..91eb4c6 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; } /* @@ -558,3 +568,40 @@ message ModuleConfig { } } + +/* + * 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 + */ + UNKNOWN = 0; + + /* + * GPIO pin can be read (if it is high / low) + */ + DIGITAL_READ = 1; + + /* + * GPIO pin can be written to (high / low) + */ + DIGITAL_WRITE = 2; +}