mirror of https://github.com/m-labs/artiq.git
si5324: chip does not ack RST_REG write
This commit is contained in:
parent
ca4d5ae73e
commit
0d2f89db53
|
@ -112,6 +112,20 @@ fn write(reg: u8, val: u8) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(si5324_soft_reset)]
|
||||||
|
fn write_no_ack_value(reg: u8, val: u8) -> Result<()> {
|
||||||
|
i2c::start(BUSNO).unwrap();
|
||||||
|
if !i2c::write(BUSNO, (ADDRESS << 1)).unwrap() {
|
||||||
|
return Err("Si5324 failed to ack write address")
|
||||||
|
}
|
||||||
|
if !i2c::write(BUSNO, reg).unwrap() {
|
||||||
|
return Err("Si5324 failed to ack register")
|
||||||
|
}
|
||||||
|
i2c::write(BUSNO, val).unwrap();
|
||||||
|
i2c::stop(BUSNO).unwrap();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn read(reg: u8) -> Result<u8> {
|
fn read(reg: u8) -> Result<u8> {
|
||||||
i2c::start(BUSNO).unwrap();
|
i2c::start(BUSNO).unwrap();
|
||||||
if !i2c::write(BUSNO, (ADDRESS << 1)).unwrap() {
|
if !i2c::write(BUSNO, (ADDRESS << 1)).unwrap() {
|
||||||
|
@ -135,7 +149,7 @@ fn ident() -> Result<u16> {
|
||||||
|
|
||||||
#[cfg(si5324_soft_reset)]
|
#[cfg(si5324_soft_reset)]
|
||||||
fn soft_reset() -> Result<()> {
|
fn soft_reset() -> Result<()> {
|
||||||
write(136, read(136)? | 0x80)?;
|
write_no_ack_value(136, read(136)? | 0x80)?;
|
||||||
clock::spin_us(10_000);
|
clock::spin_us(10_000);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue