mct8316a eeprom programming
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use crate::hardware::mct8316a::motor_startup::{EnableDisable, FullCurrentThreshold};
|
||||
use crate::hardware::mct8316a::motor_startup::FullCurrentThreshold;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ClosedLoop1 {
|
||||
@@ -76,7 +76,7 @@ pub enum ClosedLoopRate {
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum ClosedLoopDecelerationMode {
|
||||
DecelerationRate = 0x0,
|
||||
AccerlerationRate = 0x1,
|
||||
AccelerationRate = 0x1,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
@@ -144,7 +144,7 @@ pub struct ClosedLoop2 {
|
||||
pub motor_stop_brake_time: MotorStopBrakeTime,
|
||||
pub active_low_high_brake_threshold: DutyCycleThreshold,
|
||||
pub brake_pin_threshold: DutyCycleThreshold,
|
||||
pub avs_enable: EnableDisable,
|
||||
pub avs_enable: bool,
|
||||
pub cycle_current_limit: FullCurrentThreshold,
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ impl Default for ClosedLoop2 {
|
||||
motor_stop_brake_time: MotorStopBrakeTime::Milliseconds1,
|
||||
active_low_high_brake_threshold: DutyCycleThreshold::Immediate,
|
||||
brake_pin_threshold: DutyCycleThreshold::Immediate,
|
||||
avs_enable: EnableDisable::Disable,
|
||||
avs_enable: false,
|
||||
cycle_current_limit: FullCurrentThreshold::NotApplicable,
|
||||
}
|
||||
}
|
||||
@@ -259,11 +259,11 @@ pub struct ClosedLoop3 {
|
||||
pub integration_cycle_high_threshold: IntegrationCycleHighThreshold,
|
||||
pub integration_duty_cycle_low_threshold: IntegrationDutyCycleThreshold,
|
||||
pub integration_duty_cycle_high_threshold: IntegrationDutyCycleThreshold,
|
||||
pub bemf_threshold1: IntegrationBemfThreshold,
|
||||
pub bemf_threshold2: IntegrationBemfThreshold,
|
||||
pub bemf_threshold1: IntegrationBemfThreshold,
|
||||
pub commutation_method: CommutationMethod,
|
||||
pub degauss_window: DegaussWindow,
|
||||
pub degauss_enable: EnableDisable,
|
||||
pub degauss_enable: bool,
|
||||
}
|
||||
|
||||
impl Default for ClosedLoop3 {
|
||||
@@ -276,11 +276,11 @@ impl Default for ClosedLoop3 {
|
||||
integration_cycle_high_threshold: IntegrationCycleHighThreshold::Samples4,
|
||||
integration_duty_cycle_low_threshold: IntegrationDutyCycleThreshold::Percent12,
|
||||
integration_duty_cycle_high_threshold: IntegrationDutyCycleThreshold::Percent12,
|
||||
bemf_threshold1: IntegrationBemfThreshold::Value0,
|
||||
bemf_threshold2: IntegrationBemfThreshold::Value0,
|
||||
bemf_threshold1: IntegrationBemfThreshold::Value0,
|
||||
commutation_method: CommutationMethod::ZC,
|
||||
degauss_window: DegaussWindow::Degrees22_5,
|
||||
degauss_enable: EnableDisable::Disable,
|
||||
degauss_enable: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,26 +421,26 @@ pub enum DegaussWindow {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ClosedLoop4 {
|
||||
pub wcomp_blanking: EnableDisable,
|
||||
pub wcomp_blanking_enable: bool,
|
||||
pub fast_deceleration_duty_window: LowerPercentLimit,
|
||||
pub fast_deceleration_duty_threshold: UpperPercentLimit,
|
||||
pub dynamic_brake_current_lower_threshold: FullCurrentThreshold,
|
||||
pub dynamic_braking_current: EnableDisable,
|
||||
pub fast_deceleration: EnableDisable,
|
||||
pub fast_deceleration_current_theshold: FullCurrentThreshold,
|
||||
pub dynamic_braking_current_enable: bool,
|
||||
pub fast_deceleration_enable: bool,
|
||||
pub fast_deceleration_current_threshold: FullCurrentThreshold,
|
||||
pub fast_brake_delta: FastBrakeDelta,
|
||||
}
|
||||
|
||||
impl Default for ClosedLoop4 {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
wcomp_blanking: EnableDisable::Disable,
|
||||
wcomp_blanking_enable: false,
|
||||
fast_deceleration_duty_window: LowerPercentLimit::Percent0,
|
||||
fast_deceleration_duty_threshold: UpperPercentLimit::Percent100,
|
||||
dynamic_brake_current_lower_threshold: FullCurrentThreshold::NotApplicable,
|
||||
dynamic_braking_current: EnableDisable::Disable,
|
||||
fast_deceleration: EnableDisable::Disable,
|
||||
fast_deceleration_current_theshold: FullCurrentThreshold::NotApplicable,
|
||||
dynamic_braking_current_enable: false,
|
||||
fast_deceleration_enable: false,
|
||||
fast_deceleration_current_threshold: FullCurrentThreshold::NotApplicable,
|
||||
fast_brake_delta: FastBrakeDelta::Percent0_5,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user