diff options
| author | Mathis Deroo <[email protected]> | 2025-12-08 13:56:31 -0800 |
|---|---|---|
| committer | Mathis Deroo <[email protected]> | 2025-12-09 10:52:10 -0800 |
| commit | ff068148fcbc7ea148454cffa81921cc0e0da3e9 (patch) | |
| tree | 0a974dcb1bc8588de7107b763e6068228d479028 /embassy-mcxa | |
| parent | e39040afc7ee4080a1d3559d0b7d578420301726 (diff) | |
Modify ConvCommandConfig struct
Signed-off-by: Mathis Deroo <[email protected]>
Diffstat (limited to 'embassy-mcxa')
| -rw-r--r-- | embassy-mcxa/src/adc.rs | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/embassy-mcxa/src/adc.rs b/embassy-mcxa/src/adc.rs index 94d945c88..8852fd737 100644 --- a/embassy-mcxa/src/adc.rs +++ b/embassy-mcxa/src/adc.rs | |||
| @@ -99,17 +99,16 @@ impl Default for LpadcConfig { | |||
| 99 | /// Defines the parameters for a single ADC conversion operation. | 99 | /// Defines the parameters for a single ADC conversion operation. |
| 100 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 100 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 101 | pub struct ConvCommandConfig { | 101 | pub struct ConvCommandConfig { |
| 102 | pub sample_channel_mode: u8, | 102 | pub channel_number: Adch, |
| 103 | pub channel_number: u8, | 103 | pub chained_next_command_number: Next, |
| 104 | pub chained_next_command_number: u8, | ||
| 105 | pub enable_auto_channel_increment: bool, | 104 | pub enable_auto_channel_increment: bool, |
| 106 | pub loop_count: u8, | 105 | pub loop_count: u8, |
| 107 | pub hardware_average_mode: u8, | 106 | pub hardware_average_mode: Avgs, |
| 108 | pub sample_time_mode: u8, | 107 | pub sample_time_mode: Sts, |
| 109 | pub hardware_compare_mode: u8, | 108 | pub hardware_compare_mode: Cmpen, |
| 110 | pub hardware_compare_value_high: u32, | 109 | pub hardware_compare_value_high: u32, |
| 111 | pub hardware_compare_value_low: u32, | 110 | pub hardware_compare_value_low: u32, |
| 112 | pub conversion_resolution_mode: u8, | 111 | pub conversion_resolution_mode: Mode, |
| 113 | pub enable_wait_trigger: bool, | 112 | pub enable_wait_trigger: bool, |
| 114 | } | 113 | } |
| 115 | 114 | ||
| @@ -359,17 +358,16 @@ impl<'a, I: Instance> Adc<'a, I> { | |||
| 359 | /// Default conversion command configuration | 358 | /// Default conversion command configuration |
| 360 | pub fn get_default_conv_command_config(&self) -> ConvCommandConfig { | 359 | pub fn get_default_conv_command_config(&self) -> ConvCommandConfig { |
| 361 | ConvCommandConfig { | 360 | ConvCommandConfig { |
| 362 | sample_channel_mode: Ctype::SingleEndedASideChannel as u8, | 361 | channel_number: Adch::SelectCh0, |
| 363 | channel_number: Adch::SelectCh0 as u8, | 362 | chained_next_command_number: Next::NoNextCmdTerminateOnFinish, |
| 364 | chained_next_command_number: Next::NoNextCmdTerminateOnFinish as u8, | ||
| 365 | enable_auto_channel_increment: false, | 363 | enable_auto_channel_increment: false, |
| 366 | loop_count: 0, | 364 | loop_count: 0, |
| 367 | hardware_average_mode: Avgs::NoAverage as u8, | 365 | hardware_average_mode: Avgs::NoAverage, |
| 368 | sample_time_mode: Sts::Sample3p5 as u8, | 366 | sample_time_mode: Sts::Sample3p5, |
| 369 | hardware_compare_mode: Cmpen::DisabledAlwaysStoreResult as u8, | 367 | hardware_compare_mode: Cmpen::DisabledAlwaysStoreResult, |
| 370 | hardware_compare_value_high: 0, | 368 | hardware_compare_value_high: 0, |
| 371 | hardware_compare_value_low: 0, | 369 | hardware_compare_value_low: 0, |
| 372 | conversion_resolution_mode: Mode::Data12Bits as u8, | 370 | conversion_resolution_mode: Mode::Data12Bits, |
| 373 | enable_wait_trigger: false, | 371 | enable_wait_trigger: false, |
| 374 | } | 372 | } |
| 375 | } | 373 | } |
| @@ -390,21 +388,21 @@ impl<'a, I: Instance> Adc<'a, I> { | |||
| 390 | paste! { | 388 | paste! { |
| 391 | adc.[<cmdl $idx>]().write(|w| unsafe { | 389 | adc.[<cmdl $idx>]().write(|w| unsafe { |
| 392 | w.adch() | 390 | w.adch() |
| 393 | .bits(config.channel_number) | 391 | .bits(config.channel_number.into()) |
| 394 | .mode() | 392 | .mode() |
| 395 | .bit(config.conversion_resolution_mode != 0) | 393 | .bit(config.conversion_resolution_mode.into()) |
| 396 | }); | 394 | }); |
| 397 | adc.[<cmdh $idx>]().write(|w| unsafe { | 395 | adc.[<cmdh $idx>]().write(|w| unsafe { |
| 398 | w.next() | 396 | w.next() |
| 399 | .bits(config.chained_next_command_number) | 397 | .bits(config.chained_next_command_number.into()) |
| 400 | .loop_() | 398 | .loop_() |
| 401 | .bits(config.loop_count) | 399 | .bits(config.loop_count) |
| 402 | .avgs() | 400 | .avgs() |
| 403 | .bits(config.hardware_average_mode) | 401 | .bits(config.hardware_average_mode.into()) |
| 404 | .sts() | 402 | .sts() |
| 405 | .bits(config.sample_time_mode) | 403 | .bits(config.sample_time_mode.into()) |
| 406 | .cmpen() | 404 | .cmpen() |
| 407 | .bits(config.hardware_compare_mode) | 405 | .bits(config.hardware_compare_mode.into()) |
| 408 | .wait_trig() | 406 | .wait_trig() |
| 409 | .bit(config.enable_wait_trigger) | 407 | .bit(config.enable_wait_trigger) |
| 410 | .lwi() | 408 | .lwi() |
