Skip to content

Commit ea9675e

Browse files
committed
Methods update
1 parent 2c098c3 commit ea9675e

File tree

1 file changed

+13
-9
lines changed
  • content/hardware/02.uno/boards/uno-q/tutorials/01.user-manual

1 file changed

+13
-9
lines changed

content/hardware/02.uno/boards/uno-q/tutorials/01.user-manual/content.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -816,20 +816,24 @@ journalctl -u arduino-router -f
816816

817817
#### Core Components
818818

819-
`BridgeClass`
820-
- Main class managing RPC clients and servers. Provides methods to:
821-
- Initialize the bridge (`begin()`)
822-
- Call remote procedures (`call()`)
823-
- Notify without waiting for a response (`notify()`)
824-
- Expose local functions for remote execution (`provide()`, `provide_safe()`)
825-
- Process incoming requests (`update()`)
819+
`BridgeClass` The main class managing RPC clients and servers.
820+
- `begin()`: Initializes the bridge and the internal serial transport.
821+
- `call(method, args...)`: Invokes a function on the Linux side and waits for a result.
822+
- `notify(method, args...)`: Invokes a function on the Linux side without waiting for a response (fire-and-forget).
823+
- `provide(name, function)`: Exposes a local MCU function to Linux. Note: The function executes in the high-priority background RPC thread. Keep these functions short and thread-safe.
824+
- `provide_safe(name, function)`: Exposes a local MCU function, but ensures it executes within the main `loop()` context. Use this if your function interacts with standard Arduino APIs (like `digitalWrite` or `Serial`) to avoid concurrency crashes.
825+
- `update()`: Process incoming requests.
826826

827+
`RpcCall`
828+
- Helper class representing an asynchronous RPC. If its `.result` method is invoked, it waits for the response, extracts the return value, and propagates error codes if needed.
827829

828-
`RpcResult`
829-
- Helper class representing the result of a remote call. It waits for the response, extracts the return value, and propagates error codes if needed.
830+
`Monitor`
831+
- The library includes a pre-defined Monitor object. This allows the Linux side to send text streams to the MCU (acting like a virtual Serial Monitor) via the RPC method mon/write.
830832

831833
**Threading and Safety**
832834
- The bridge uses Zephyr mutexes (`k_mutex`) to guarantee safe concurrent access when reading/writing over the transport. Updates are handled by a background thread that continuously polls for requests.
835+
- **Incoming Updates**: Handled by a dedicated background thread (`updateEntryPoint`) that continuously polls for requests.
836+
- **Safe Execution**: The provide_safe mechanism hooks into the main loop (`__loopHook`) to execute user callbacks safely when the processor is idle.
833837

834838
#### Usage Example
835839

0 commit comments

Comments
 (0)