Updating AD9959 api
This commit is contained in:
parent
beecbe3efc
commit
ade06cbcb8
@ -303,7 +303,8 @@ const APP: () = {
|
|||||||
io_update,
|
io_update,
|
||||||
asm_delay,
|
asm_delay,
|
||||||
ad9959::Mode::FourBitSerial,
|
ad9959::Mode::FourBitSerial,
|
||||||
100_000_000).unwrap()
|
100_000_000,
|
||||||
|
5).unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
let io_expander = {
|
let io_expander = {
|
||||||
|
@ -183,21 +183,22 @@ where
|
|||||||
1_u8.wrapping_shl(5)).map_err(|_| Error::I2c)?;
|
1_u8.wrapping_shl(5)).map_err(|_| Error::I2c)?;
|
||||||
devices.mcp23017.all_pin_mode(mcp23017::PinMode::OUTPUT).map_err(|_| Error::I2c)?;
|
devices.mcp23017.all_pin_mode(mcp23017::PinMode::OUTPUT).map_err(|_| Error::I2c)?;
|
||||||
|
|
||||||
devices.select_onboard_clock()?;
|
// Select the on-board clock with a 5x prescaler (500MHz).
|
||||||
|
devices.select_onboard_clock(5u8)?;
|
||||||
|
|
||||||
Ok(devices)
|
Ok(devices)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn select_external_clock(&mut self, frequency: u32) -> Result<(), Error>{
|
pub fn select_external_clock(&mut self, frequency: u32, prescaler: u8) -> Result<(), Error>{
|
||||||
self.mcp23017.digital_write(EXT_CLK_SEL_PIN, true).map_err(|_| Error::I2c)?;
|
self.mcp23017.digital_write(EXT_CLK_SEL_PIN, true).map_err(|_| Error::I2c)?;
|
||||||
self.ad9959.set_clock_frequency(frequency).map_err(|_| Error::DDS)?;
|
self.ad9959.configure_system_clock(frequency, prescaler).map_err(|_| Error::DDS)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn select_onboard_clock(&mut self) -> Result<(), Error> {
|
pub fn select_onboard_clock(&mut self, prescaler: u8) -> Result<(), Error> {
|
||||||
self.mcp23017.digital_write(EXT_CLK_SEL_PIN, false).map_err(|_| Error::I2c)?;
|
self.mcp23017.digital_write(EXT_CLK_SEL_PIN, false).map_err(|_| Error::I2c)?;
|
||||||
self.ad9959.set_clock_frequency(100_000_000).map_err(|_| Error::DDS)?;
|
self.ad9959.configure_system_clock(100_000_000, prescaler).map_err(|_| Error::DDS)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user