Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/el3702-oversampling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct EL3702 {

impl EL3702 {
// Make sure this is the same value as the array lengths in the struct definition
const OVERSAMPLE_MUL: u8 = 25;
const OVERSAMPLE_MUL: u16 = 25;
}

fn main() -> Result<(), Error> {
Expand Down
4 changes: 2 additions & 2 deletions src/subdevice/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ where
.find_map(|(pdo_id, mul)| if *pdo_id == pdo { Some(*mul) } else { None })
.unwrap_or(1);

let pdo_bit_len = pdo_bit_len * u16::from(oversampling);
let pdo_bit_len = pdo_bit_len * oversampling;

fmt::trace!(
"----> CoE: {:#06x} oversampling: {}, this PDO bit len {}",
Expand Down Expand Up @@ -530,7 +530,7 @@ where
})
.unwrap_or(1);

let len = pdo.bit_len * u16::from(oversampling);
let len = pdo.bit_len * oversampling;

fmt::trace!(
"EEPROM: {:#06x} oversampling: {}, this PDO bit len {}",
Expand Down
5 changes: 3 additions & 2 deletions src/subdevice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ pub struct SubDevice {
/// DC config.
pub(crate) dc_sync: DcSync,

pub(crate) oversampling_config: &'static [(u16, u8)],
/// Oversampling config, a list of tuples of `(PDO, oversampling multipler)`.
pub(crate) oversampling_config: &'static [(u16, u16)],
}

// Only required for tests, also doesn't make much sense - consumers of EtherCrab should be
Expand Down Expand Up @@ -249,7 +250,7 @@ impl SubDevice {
///
/// This is a temporary(ish) solution to configure oversampling until a better one is found to
/// configure SubDevices from ESI files, etc.
pub fn set_oversampling(&mut self, oversampling_config: &'static [(u16, u8)]) {
pub fn set_oversampling(&mut self, oversampling_config: &'static [(u16, u16)]) {
self.oversampling_config = oversampling_config
}

Expand Down
2 changes: 1 addition & 1 deletion src/subdevice_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ where
.await?;

let flags = if let DcSync::Sync01 { sync1_period } = subdevice.dc_sync() {
let sync1_period = u64::from(u32::try_from(sync1_period.as_nanos())?);
let sync1_period = u64::try_from(sync1_period.as_nanos())?;

subdevice
.write(RegisterAddress::DcSync1CycleTime)
Expand Down