Skip to content

Commit 2a10aaf

Browse files
committed
Fix some, far from all, warnings
1 parent 03a656e commit 2a10aaf

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

src/mcpwm/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@ pub use self::{
6363
timer_connection::TimerConnection,
6464
};
6565

66-
// MCPWM clock source frequency for ESP32 and ESP32-s3
67-
const MCPWM_CLOCK_SOURCE_FREQUENCY: u32 = 160_000_000;
68-
69-
// Max PWM timer prescaler
70-
const MAX_PWM_TIMER_PRESCALE: u32 = 0x1_00;
71-
72-
// Max PWM timer period
73-
const MAX_PWM_TIMER_PERIOD: u32 = 0x1_00_00;
74-
7566
/// The Motor Control Pulse Width Modulator peripheral
7667
pub struct MCPWM<G: Group> {
7768
pub timer0: TIMER<0, G>,

src/mcpwm/timer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::ptr;
44

55
use esp_idf_sys::{
66
esp, mcpwm_del_timer, mcpwm_new_timer, mcpwm_timer_config_t, mcpwm_timer_enable,
7-
mcpwm_timer_handle_t, EspError,
7+
mcpwm_timer_handle_t,
88
};
99

1010
use crate::mcpwm::Group;
@@ -14,7 +14,7 @@ use crate::units::Hertz;
1414
use super::operator::NoOperator;
1515
use super::timer_connection::TimerConnection;
1616

17-
#[derive(Clone, Copy, Debug, PartialEq)]
17+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
1818
pub struct TimerConfig {
1919
frequency: Hertz,
2020
//resolution: Hertz,
@@ -92,7 +92,7 @@ impl<const N: u8, G: Group> Timer<N, G> {
9292
};
9393
let mut handle: mcpwm_timer_handle_t = ptr::null_mut();
9494
unsafe {
95-
esp!(mcpwm_new_timer(&cfg, &mut handle));
95+
esp!(mcpwm_new_timer(&cfg, &mut handle)).unwrap();
9696
}
9797
// TODO: note that this has to be called before mcpwm_timer_enable
9898
// mcpwm_timer_register_event_callbacks()
@@ -173,7 +173,7 @@ impl<const N: u8, G: Group> Drop for Timer<N, G> {
173173

174174
/// Counter mode for operator's timer for generating PWM signal
175175
// TODO: For UpDown, frequency is half of MCPWM frequency set
176-
#[derive(Clone, Copy, Debug, PartialEq)]
176+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
177177
pub enum CountMode {
178178
/// Timer is frozen or paused
179179
//#[cfg(not(esp_idf_version = "4.3"))]

src/mcpwm/timer_connection.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::mcpwm::Group;
22

33
use super::{
44
operator::{NoOperator, OperatorConfig, OptionalOperator, OPERATOR},
5-
timer::{Timer, TIMER},
5+
timer::Timer,
66
Operator,
77
};
88

@@ -114,8 +114,10 @@ impl<const N: u8, G: Group, O0: OptionalOperator<0, G>, O1: OptionalOperator<1,
114114
}
115115
}
116116

117+
// TODO: Should this be moved somewhere else?
117118
pub struct NoPin;
118119

120+
// TODO: Should this be moved somewhere else?
119121
pub trait OptionalOutputPin {}
120122

121123
impl<P: crate::gpio::OutputPin> OptionalOutputPin for P {}

0 commit comments

Comments
 (0)