Skip to content

Conversation

@mmoscony
Copy link
Contributor

A few bigger updates here but much of the code change is from running cargo format, actual changes include:

  • Read / Write Register Functions
  • Get / Set / Range MasterClockRate Functions
  • Write / Read Channel Setting Functions
  • Fix bug where cast to i8 breaks build for arm builds
  • Return a stream result field to inspect write and read status further than just number of samples

Copy link
Owner

@kevinmehall kevinmehall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This covers 3 out of the 4 open issues!

I think it'd be best to split the StreamResult changes into a standalone PR because that might require more discussion. It's also a breaking API change, which is fine, we can release a v0.5, but there may be other breaking changes that we want to include with that. The example utilities in bin/ will have to be updated for that API.

src/device.rs Outdated
))?;

Ok(len as usize)
// Is it better to return this StreamResult or just make the values public off of rx_stream
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #6 for prior discussion on this if you haven't already seen that thread. I'll have to revisit that before deciding if this is what we want.

// TODO: sensors

// TODO: registers
// Write a register
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For rustdoc:

Suggested change
// Write a register
/// Write a register

It would be better to add more details like on what this might be used for and what the arguments mean.

src/device.rs Outdated
Comment on lines 883 to 884
pub fn write_register<S: Into<Vec<u8>>>(&self, key: S, addr: u32, value: u32) -> Result<(), Error> {
let key = CString::new(key).expect("key must not contain null byte");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Device.h uses name instead of key; should probably be consistent with that, since users are probably going to have to go looking at the driver code to figure out what to pass here.

Comment on lines +1212 to +1213
SoapySDRDevice_setMasterClockRate(self.inner.ptr, clock_rate);
check_error(())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Device.h, this returns an error code or 0 for success, so I think this should be

Suggested change
SoapySDRDevice_setMasterClockRate(self.inner.ptr, clock_rate);
check_error(())
check_ret_error(SoapySDRDevice_setMasterClockRate(self.inner.ptr, clock_rate))

}
}

// Master clock rate
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a doc comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants