Skip to content

Commit d1ec3f9

Browse files
committed
Expose Mcpwm's unit and Operator's timer
1 parent b9b4460 commit d1ec3f9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/mcpwm.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl From<CounterMode> for mcpwm_counter_type_t {
187187
/// `rising_edge_delay` and `falling_edge_delay` is time as in number of clock cycles after the MCPWM modules group prescaler.
188188
///
189189
/// Note that the dead times are calculated from MCPWMXA's flanks unless explicitly stated otherwise
190-
#[derive(Copy, Clone, PartialEq, Debug)]
190+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
191191
pub enum DeadtimeConfig {
192192
// TODO: Figure out what all of those options do and give them nice descriptions
193193
/// MCPWM_BYPASS_RED
@@ -759,6 +759,10 @@ impl<U: Unit> Mcpwm<U> {
759759

760760
Ok(self)
761761
}
762+
763+
pub fn unit(&self) -> mcpwm_unit_t {
764+
U::unit()
765+
}
762766
}
763767

764768
// The hardware for ESP32 and ESP32-S3 can associate any operator(within the mcpwm module) with any
@@ -1027,4 +1031,8 @@ where
10271031
pub fn get_frequency(&self) -> Hertz {
10281032
Hertz::from(unsafe { esp_idf_sys::mcpwm_get_frequency(U::unit(), O::timer()) })
10291033
}
1034+
1035+
pub fn timer(&self) -> mcpwm_timer_t {
1036+
O::timer()
1037+
}
10301038
}

0 commit comments

Comments
 (0)