ad7172: setup_channel() fixes
This commit is contained in:
parent
957f92d177
commit
07dcc608bc
@ -46,13 +46,14 @@ impl<SPI: Transfer<u8>, NSS: OutputPin> Adc<SPI, NSS> {
|
||||
) -> Result<(), AdcError<SPI::Error>> {
|
||||
self.update_reg(®s::SetupCon { index }, |data| {
|
||||
data.set_bi_unipolar(false);
|
||||
data.set_refbuf_pos(true);
|
||||
data.set_refbuf_neg(true);
|
||||
data.set_ainbuf_pos(true);
|
||||
data.set_ainbuf_neg(true);
|
||||
// TODO: which RefSource?
|
||||
data.set_ref_sel(RefSource::Internal);
|
||||
})?;
|
||||
self.update_reg(®s::FiltCon { index }, |data| {
|
||||
// 10 Hz data rate
|
||||
data.set_odr(0b10011);
|
||||
})?;
|
||||
// let mut offset = <regs::Offset as regs::Register>::Data::empty();
|
||||
// offset.set_offset(0);
|
||||
// self.write_reg(®s::Offset { index }, &mut offset);
|
||||
self.update_reg(®s::Channel { index }, |data| {
|
||||
data.set_setup(index);
|
||||
data.set_enabled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user