Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
c9b5f6a4e9 | |||
3422801850 | |||
8a81b3a721 |
16
src/lib.rs
16
src/lib.rs
|
@ -132,7 +132,7 @@ type ExtClkd = ExternallyClocked;
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
/// Clock modes for the MAX116XX devices
|
/// Clock modes for the MAX116XX devices
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
pub enum ClockMode {
|
pub enum ClockMode {
|
||||||
/// Internally timed, CNVST only needs to be pulsed for 40ns.
|
/// Internally timed, CNVST only needs to be pulsed for 40ns.
|
||||||
/// CNVST Configuration: CNVST active low
|
/// CNVST Configuration: CNVST active low
|
||||||
|
@ -148,7 +148,7 @@ pub enum ClockMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Voltage reference modes
|
/// Voltage reference modes
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
pub enum VoltageRefMode {
|
pub enum VoltageRefMode {
|
||||||
/// Auto-Shutdown is on, wake-up delay of 65 us
|
/// Auto-Shutdown is on, wake-up delay of 65 us
|
||||||
InternalRefWithWakeupDelay = 0b00,
|
InternalRefWithWakeupDelay = 0b00,
|
||||||
|
@ -167,7 +167,7 @@ pub enum AveragingConversions {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Specifies the number of returned result in single scan mode
|
/// Specifies the number of returned result in single scan mode
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
pub enum AveragingResults {
|
pub enum AveragingResults {
|
||||||
FourResults = 0b00,
|
FourResults = 0b00,
|
||||||
EightResults = 0b01,
|
EightResults = 0b01,
|
||||||
|
@ -175,7 +175,7 @@ pub enum AveragingResults {
|
||||||
SixteenResults = 0b11,
|
SixteenResults = 0b11,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
pub enum ScanMode {
|
pub enum ScanMode {
|
||||||
Scan0ToChannelN = 0b00,
|
Scan0ToChannelN = 0b00,
|
||||||
ScanChannelNToHighest = 0b01,
|
ScanChannelNToHighest = 0b01,
|
||||||
|
@ -837,12 +837,12 @@ where
|
||||||
if self.eoc.is_low().map_err(Error::Pin)? {
|
if self.eoc.is_low().map_err(Error::Pin)? {
|
||||||
// maximum length of reply is 32 for 16 channels
|
// maximum length of reply is 32 for 16 channels
|
||||||
let mut dummy_cmd: [u8; 32] = [0; 32];
|
let mut dummy_cmd: [u8; 32] = [0; 32];
|
||||||
let num_conv: usize;
|
let num_conv: usize =
|
||||||
if self.base.cfg.pending_scan_mode == Some(ScanMode::ScanChannelNRepeatedly) {
|
if self.base.cfg.pending_scan_mode == Some(ScanMode::ScanChannelNRepeatedly) {
|
||||||
num_conv = self.base.cfg.results_len as usize;
|
self.base.cfg.results_len as usize
|
||||||
} else {
|
} else {
|
||||||
num_conv = self.base.cfg.requested_conversions;
|
self.base.cfg.requested_conversions
|
||||||
}
|
};
|
||||||
self.base.cfg.pending_scan_mode = None;
|
self.base.cfg.pending_scan_mode = None;
|
||||||
self.base.cfg.requested_conversions = 0;
|
self.base.cfg.requested_conversions = 0;
|
||||||
self.base.cs.set_low().map_err(Error::Pin)?;
|
self.base.cs.set_low().map_err(Error::Pin)?;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user