use bitflags::bitflags;
#[cfg(feature = "serde")]
use super::SerializeUbxPacketFields;
#[cfg(feature = "serde")]
use crate::serde::ser::SerializeMap;
use crate::{
error::ParserError, ubx_checksum, ubx_packets::packets::ScaleBack, MemWriter, MemWriterError,
UbxPacketCreator, UbxPacketMeta,
};
use ublox_derive::{ubx_extend_bitflags, ubx_packet_recv_send};
#[ubx_packet_recv_send]
#[ubx(
class = 0x06,
id = 0x82,
fixed_payload_len = 32,
flags = "default_for_builder"
)]
struct CfgEsfWt {
version: u8,
#[ubx(map_type = CfgEsfWtFlags1)]
flags1: u8,
#[ubx(map_type = CfgEsfWtFlags2)]
flags2: u8,
reserved1: u8,
#[ubx(map_type = f64, scale = 1e-6)]
wt_factor: u32,
#[ubx(map_type = f64, scale = 1e-6)]
wt_quant_error: u32,
wt_count_max: u32,
wt_latency: u16,
wt_frequency: u8,
#[ubx(map_type = CfgEsfWtFlags3)]
flags3: u8,
speed_dead_band: u16,
reserved2: [u8; 10],
}
#[ubx_extend_bitflags]
#[ubx(from, into_raw, rest_reserved)]
bitflags! {
#[derive(Default, Debug)]
pub struct CfgEsfWtFlags1 : u8 {
const COMBINED_TICKS = 0x01;
const USE_WHEEL_TICK_SPEED = 0x10;
const DIR_PIN_POLARITY = 0x20;
const USE_WT_PIN = 0x40;
}
}
#[ubx_extend_bitflags]
#[ubx(from, into_raw, rest_reserved)]
bitflags! {
#[derive(Default, Debug)]
pub struct CfgEsfWtFlags2 : u8 {
const AUTO_WT_COUNT_MAX_OFF = 0x01;
const AUTO_DIR_PIN_POL_OFF = 0x02;
const AUTO_SOFTWARE_WT_OFF = 0x04;
const AUTO_USE_WT_SPEED_OFF = 0x08;
}
}
#[ubx_extend_bitflags]
#[ubx(from, into_raw, rest_reserved)]
bitflags! {
#[derive(Default, Debug)]
pub struct CfgEsfWtFlags3 : u8 {
const CNT_BOTH_EDGES = 0x01;
}
}