Skip to content

Commit

Permalink
Fix some, far from all, warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
usbalbin committed Oct 13, 2022
1 parent 03a656e commit 2a10aaf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
9 changes: 0 additions & 9 deletions src/mcpwm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@ pub use self::{
timer_connection::TimerConnection,
};

// MCPWM clock source frequency for ESP32 and ESP32-s3
const MCPWM_CLOCK_SOURCE_FREQUENCY: u32 = 160_000_000;

// Max PWM timer prescaler
const MAX_PWM_TIMER_PRESCALE: u32 = 0x1_00;

// Max PWM timer period
const MAX_PWM_TIMER_PERIOD: u32 = 0x1_00_00;

/// The Motor Control Pulse Width Modulator peripheral
pub struct MCPWM<G: Group> {
pub timer0: TIMER<0, G>,
Expand Down
8 changes: 4 additions & 4 deletions src/mcpwm/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::ptr;

use esp_idf_sys::{
esp, mcpwm_del_timer, mcpwm_new_timer, mcpwm_timer_config_t, mcpwm_timer_enable,
mcpwm_timer_handle_t, EspError,
mcpwm_timer_handle_t,
};

use crate::mcpwm::Group;
Expand All @@ -14,7 +14,7 @@ use crate::units::Hertz;
use super::operator::NoOperator;
use super::timer_connection::TimerConnection;

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

/// Counter mode for operator's timer for generating PWM signal
// TODO: For UpDown, frequency is half of MCPWM frequency set
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CountMode {
/// Timer is frozen or paused
//#[cfg(not(esp_idf_version = "4.3"))]
Expand Down
4 changes: 3 additions & 1 deletion src/mcpwm/timer_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::mcpwm::Group;

use super::{
operator::{NoOperator, OperatorConfig, OptionalOperator, OPERATOR},
timer::{Timer, TIMER},
timer::Timer,
Operator,
};

Expand Down Expand Up @@ -114,8 +114,10 @@ impl<const N: u8, G: Group, O0: OptionalOperator<0, G>, O1: OptionalOperator<1,
}
}

// TODO: Should this be moved somewhere else?
pub struct NoPin;

// TODO: Should this be moved somewhere else?
pub trait OptionalOutputPin {}

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

0 comments on commit 2a10aaf

Please sign in to comment.