mirror of
https://github.com/hubaldv/bioz-firmware-rs.git
synced 2026-03-10 03:00:31 +00:00
Added 4 lead-option for single frequency measurement.
This commit is contained in:
@@ -71,6 +71,7 @@ impl SwitchConfig {
|
||||
#[allow(dead_code)]
|
||||
#[derive(Default)]
|
||||
pub struct DspConfig {
|
||||
pub gnpgain: Option<GNPGAIN>,
|
||||
muxseln: Option<MUXSELN>,
|
||||
muxselp: Option<MUXSELP>,
|
||||
ctiacon: Option<CTIACON>,
|
||||
@@ -87,6 +88,11 @@ pub struct DspConfig {
|
||||
}
|
||||
|
||||
impl DspConfig {
|
||||
pub fn gnpgain(&mut self, gnpgain: GNPGAIN) -> &mut Self {
|
||||
self.gnpgain = Some(gnpgain);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn adc_mux_n(&mut self, muxseln: MUXSELN) -> &mut Self {
|
||||
self.muxseln = Some(muxseln);
|
||||
self
|
||||
@@ -592,6 +598,9 @@ impl AD5940 {
|
||||
// ADCCON
|
||||
let mut current = self.read_reg(Register::ADCCON).await?;
|
||||
|
||||
if let Some(gnpgain) = config.gnpgain {
|
||||
current = GNPGAIN::apply(current, gnpgain as u32);
|
||||
}
|
||||
if let Some(muxseln) = config.muxseln {
|
||||
current = MUXSELN::apply(current, muxseln as u32);
|
||||
}
|
||||
@@ -855,6 +864,8 @@ pub enum Register {
|
||||
OSCCON = 0x0000_0A10, // Oscillator Control Register
|
||||
SEQTIMEOUT = 0x0000_2068, // Sequencer Timeout Counter Register
|
||||
SEQCRC = 0x0000_2060, // Sequencer CRC Value Register
|
||||
DFTREAL = 0x0000_2078, // DFT Result, Real Device Register
|
||||
DFTIMAG = 0x0000_207C, // DFT Result, Imaginary Device Register
|
||||
DATAFIFOTHRES = 0x0000_21E0, // Data FIFO Threshold Register
|
||||
SYNCEXTDEVICE = 0x0000_2054, // Sync External Device Register
|
||||
GP0CON = 0x0000_0000, // GPIO Port 0 Configuration Register
|
||||
|
||||
Reference in New Issue
Block a user