Skip to content
This is the development version of the documentation. It may change before the next release. See 0.6.x for the latest release.

SetPulseWidthTable

SetPulseWidthTable is a command that sets the conversion table from intensity (0–255) to the PWM pulse width.

SetPulseWidthTable { table: &table };
Field Type Description
table &[u16; PWE_TABLE_SIZE] Pulse width per intensity index (0–255) (256 elements)

SetPulseWidthTable::default_table() returns the default arcsin-shaped table. This is a table that makes the output sound pressure (theoretically) linear with respect to intensity.

use autd3_rs::commands::SetPulseWidthTable;
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 table = SetPulseWidthTable::default_table();
let mut builder = client.datagram_builder();
builder.push(SetPulseWidthTable { table: &table });
let frames = builder.build()?;
for frame in &frames {
client.send_checked(frame).await?;
}
client.close().await?;