pub struct BidirDecoder {
pub cfg: OversamplingConfig,
pub preamble_tuning: PreambleTuningConfig,
/* private fields */
}Fields§
§cfg: OversamplingConfig§preamble_tuning: PreambleTuningConfigImplementations§
Source§impl BidirDecoder
impl BidirDecoder
Sourcepub const fn new(cfg: OversamplingConfig) -> Self
pub const fn new(cfg: OversamplingConfig) -> Self
Examples found in repository?
examples/local_telemetry_oversampling.rs (line 48)
38fn main() {
39 let cfg = OversamplingConfig {
40 sample_bit_index: 0,
41 oversampling: 4,
42 frame_bits: 21,
43 min_detected_bits: 18,
44 bit_tolerance: 2,
45 };
46 let samples = build_oversampled_samples(0, 8, &RUNS_5A55, cfg.oversampling as usize);
47
48 let decoder = BidirDecoder::new(cfg);
49 match decoder.decode_frame(&samples) {
50 Ok(TelemetryFrame::Erpm(erpm)) => {
51 println!(
52 "decoded eRPM period={}us mech_rpm(pole_pairs=14)={}",
53 erpm.period(),
54 erpm.mechanical_rpm(14)
55 );
56 }
57 Ok(other) => println!("decoded frame={other:?}"),
58 Err(err) => println!("decode error={err:?}"),
59 }
60}pub const fn with_preamble_tuning( cfg: OversamplingConfig, preamble_tuning: PreambleTuningConfig, ) -> Self
Sourcepub fn decode_frame(
&self,
samples: &[u16],
) -> Result<TelemetryFrame, TelemetryError>
pub fn decode_frame( &self, samples: &[u16], ) -> Result<TelemetryFrame, TelemetryError>
Examples found in repository?
examples/local_telemetry_oversampling.rs (line 49)
38fn main() {
39 let cfg = OversamplingConfig {
40 sample_bit_index: 0,
41 oversampling: 4,
42 frame_bits: 21,
43 min_detected_bits: 18,
44 bit_tolerance: 2,
45 };
46 let samples = build_oversampled_samples(0, 8, &RUNS_5A55, cfg.oversampling as usize);
47
48 let decoder = BidirDecoder::new(cfg);
49 match decoder.decode_frame(&samples) {
50 Ok(TelemetryFrame::Erpm(erpm)) => {
51 println!(
52 "decoded eRPM period={}us mech_rpm(pole_pairs=14)={}",
53 erpm.period(),
54 erpm.mechanical_rpm(14)
55 );
56 }
57 Ok(other) => println!("decoded frame={other:?}"),
58 Err(err) => println!("decode error={err:?}"),
59 }
60}pub fn decode_frame_with_hint( &self, samples: &[u16], hint: DecodeHint, ) -> Result<TelemetryFrame, TelemetryError>
pub fn decode_frame_tuned( &mut self, samples: &[u16], ) -> Result<TelemetryFrame, TelemetryError>
pub fn decode_frame_tuned_port_samples( &mut self, samples: &[u32], bit_mask: u32, ) -> Result<TelemetryFrame, TelemetryError>
pub fn decode_frame_tuned_port_samples_u16( &mut self, samples: &[u16], bit_mask: u16, ) -> Result<TelemetryFrame, TelemetryError>
pub const fn stream_hint(&self) -> DecodeHint
pub fn set_stream_hint(&mut self, hint: DecodeHint)
Auto Trait Implementations§
impl Forget for BidirDecoder
impl Freeze for BidirDecoder
impl Move for BidirDecoder
impl RefUnwindSafe for BidirDecoder
impl Send for BidirDecoder
impl Sync for BidirDecoder
impl Unpin for BidirDecoder
impl UnsafeUnpin for BidirDecoder
impl UnwindSafe for BidirDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more