SetGpioOut
SetGpioOut is a command that sets the signals output to the device’s 4 GPIO output terminals.
SetGpioOut { outputs };SetGpioOut(outputs=outputs)new SetGpioOut(outputs);| Field | Type | Default | Description |
|---|---|---|---|
outputs |
[GpioOut; 4] |
all Off |
Outputs assigned to terminals 0..3 |
GpioOut
Section titled “GpioOut”Off |
Always Low (default) |
BaseSignal |
Reference signal of the ultrasound (40 kHz) |
Thermo |
Temperature sensor assertion |
ForceFan |
ForceFan state |
Sync |
Synchronization signal |
ModBank |
Active Modulation bank |
ModIdx(u16) |
High when Modulation is at the specified index |
PatternBank |
Active Pattern bank |
PatternIdx(u16) |
High when Pattern is at the specified index |
IsStmMode |
High when in Stm mode (size != 1) |
SysTimeEq(SysTime) |
High when the system time matches the specified value |
SyncDiff |
Synchronization error |
PwmOut(u8) |
PWM output of the specified transducer |
Direct(bool) |
Directly output the specified fixed value |
For the SysTime passed to SysTimeEq, see SysTime.
Example
Section titled “Example”use autd3_rs::commands::{Clear, GpioOut, SetGpioOut, Synchronize};use autd3_rs::geometry::{Autd3, Geometry};use autd3_rs::Client;use autd3_rs::udp::TransportOption;
let geometry = Geometry::new(vec![Autd3::default()]);let option = TransportOption::default();let mut client = Client::open(&geometry, &option).await?;client.send(Clear).await?;client.send(Synchronize).await?;
client.send(SetGpioOut { outputs: [ GpioOut::PatternBank, GpioOut::Thermo, GpioOut::PwmOut(0), GpioOut::Off, ],}).await?;import asyncio
from autd3 import Client, TransportOptionfrom autd3.commands import Clear, GpioOut, SetGpioOut, Synchronizefrom autd3.geometry import Autd3, Geometry
async def main() -> None: geometry = Geometry([Autd3()]) with await Client.open(geometry, TransportOption()) as client: await client.send(Clear()) await client.send(Synchronize())
await client.send( SetGpioOut( outputs=[ GpioOut.PatternBank, GpioOut.Thermo, GpioOut.PwmOut(0), GpioOut.Off, ] ) )
asyncio.run(main())using System.Threading.Tasks;using AUTD3;
var geometry = new Geometry(new[] { new Autd3() });using var client = await Client.OpenAsync(geometry, new TransportOption());await client.SendAsync(new Clear());await client.SendAsync(new Synchronize());
await client.SendAsync(new SetGpioOut(new[]{ GpioOut.PatternBank, GpioOut.Thermo, GpioOut.PwmOut(0), GpioOut.Off,}));