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 | Description |
|---|---|---|
outputs |
[GpioOut; 4] |
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(DcSysTime) |
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 DcSysTime passed to SysTimeEq, see DcSysTime.
Example
Section titled “Example”use autd3_rs::commands::{GpioOut, SetGpioOut};use autd3_rs::geometry::{Autd3, Geometry};use autd3_rs::{Client, ClientConfig};use autd3_rs_link_nop::Nop;
let geometry = Geometry::new(vec![Autd3::default()]);let client = Client::open(&geometry, Nop, ClientConfig::default()).await?;
let mut builder = client.datagram_builder();builder.push(SetGpioOut { outputs: [ GpioOut::PatternBank, GpioOut::Thermo, GpioOut::PwmOut(0), GpioOut::Off, ],});let frames = builder.build()?;for frame in &frames { client.send_checked(frame).await?;}
client.close().await?;import asyncio
from autd3 import Client, ClientConfigfrom autd3.commands import GpioOut, SetGpioOutfrom autd3.geometry import Autd3, Geometryfrom autd3_link_nop import Nop
async def main() -> None: geometry = Geometry([Autd3([0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0])]) client = await Client.open(geometry, Nop(), ClientConfig())
builder = client.datagram_builder() builder.push( SetGpioOut( outputs=[ GpioOut.PatternBank, GpioOut.Thermo, GpioOut.PwmOut(0), GpioOut.Off, ] ) ) frames = builder.build() for frame in frames: await client.send_checked(frame)
await client.close()
asyncio.run(main())using System.Numerics;using System.Threading.Tasks;using AUTD3;using AUTD3.Link;using Nop = AUTD3.Link.Nop;
var geometry = new Geometry(new[] { new Autd3(Vector3.Zero) });var client = await Client.OpenAsync(geometry, new Nop(), new ClientConfig());
var builder = client.DatagramBuilder();builder.Push(new SetGpioOut(new[]{ GpioOut.PatternBank, GpioOut.Thermo, GpioOut.PwmOut(0), GpioOut.Off,}));var frames = builder.Build();foreach (var frame in frames){ await client.SendCheckedAsync(frame);}
await client.CloseAsync();