Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/adc dac io macros #180

Merged
merged 12 commits into from
Dec 2, 2020
Merged

Feature/adc dac io macros #180

merged 12 commits into from
Dec 2, 2020

Conversation

jordens
Copy link
Member

@jordens jordens commented Nov 26, 2020

I wanted to try macros.
This moves the ADC and DAC DMA setup into macros reducing code footprint. Hopefully no functional changes there.
I didn't test this on hardware and I may have missed differences between Adc0/Adc1 and Dac0/Dac1.

It removes the AdcInputs and DacOutputs structs and replaces them with tuples as they were just fan-outs/fan-ins.
It also does some minor tweaks in the process() ISR towards higher flexibility enforces some data patterns to help the compiler.

Differences missing:

@ryan-summers
Copy link
Member

ryan-summers commented Nov 27, 2020

  • .circular_buffer(true); for Dac1 only. Why is that? @ryan-summers

I believe this is a bug in the DAC outputs - these DMA streams should not be operating in circular mode. I believe it's not currently causing incorrect output because we schedule a new DMA transfer as soon as the last one completes, so the circular transfer configuration never gets a chance to generate incorrect data. However, this should be removed. I'll open an issue.

@jordens
Copy link
Member Author

jordens commented Nov 27, 2020

Then that's a copy-paste bug par excellence, found and fixed by "don't repeat yourself" ;)

src/adc.rs Outdated Show resolved Hide resolved
src/adc.rs Show resolved Hide resolved
src/adc.rs Outdated Show resolved Hide resolved
src/adc.rs Outdated Show resolved Hide resolved
src/dac.rs Show resolved Hide resolved
src/dac.rs Show resolved Hide resolved
src/main.rs Show resolved Hide resolved
…macros

* origin/master:
  more nightly clippy lints
  clippy lints
  gha: clippy-check
  build(deps): bump paste from 1.0.2 to 1.0.3
  build(deps): bump panic-semihosting from 0.5.4 to 0.5.6
Copy link
Member

@ryan-summers ryan-summers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor fix - other than that, a smoke test with a 1KHz test signal on the input is showing proper operation of both ADC/DAC pairs

src/main.rs Show resolved Hide resolved
* master:
  cargo: add docs for target cpu/features
  iir: more generic math helpers, use core::intrinsics
  cargo fmt [nfc]
  iir: vminnm/vmaxnm
  iir: fmt [nfc]
  iir: fix comment [nfc]
  cargo-config: cm7 features
  iir: copy_within is better than rotate_right
  processing: use faster unsafe truncate
@jordens
Copy link
Member Author

jordens commented Dec 2, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 2, 2020

Build succeeded:

@bors bors bot merged commit 051715e into master Dec 2, 2020
@bors bors bot deleted the feature/adc-dac-io-macros branch December 2, 2020 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DAC1 DMA stream operates in circular mode
2 participants