Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

esp32/DAC: Add cosine generator capability#5514

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
tschmid wants to merge2 commits intomicropython:master
base:master
Choose a base branch
Loading
fromtschmid:dac_cosine_gen

Conversation

tschmid
Copy link

@tschmidtschmid commentedJan 10, 2020
edited
Loading

The ESP32's DAC has the capability to generate constant waveforms. This
commit extends the machine.DAC interface of the ESP32 port to expose
this feature.

TODO:

  • Move detailed DAC function description to docs/library/esp32.rst and update
  • Movertc_clk_div to esp library
  • tone tone type
  • KW args for constructor

The ESP32's DAC has the capability to generate constant waveforms. Thiscommit extends the machine.DAC interface of the ESP32 port to exposethis feature.
Decided to split the call into two such that the RTC clock dividercan be left alone, in case another peripheral is using and settingit already.
Copy link
Contributor

@tvetve left a comment

Choose a reason for hiding this comment

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

Cool! I'm looking forward to using this, I also appreciate that you wrote docs! :-)

The main issue I see is that the driver doesn't follow the model of the others I've seen WRT initialization. In general, I see an init method that takes a slew of KW args to set all the features and a constructor that accepts the same set of KW args (usually all handled in one init_helper function). I would prefer new drivers to follow this model, but I don't really know what the general strategy is.

Unit tests?

# frequency steps for the CW generator, (7, 1) -> ~15 Hz


ESP32 specific DAC class method reference:
Copy link
Contributor

Choose a reason for hiding this comment

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

This doc is just the quick reference. You should place the detailed docs into docs/library/esp32.rst - IMHO

Copy link
Author

Choose a reason for hiding this comment

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

Hmm, I mirrored what the ADC does? Should that be moved too?

``clk_8m_div`` is the divider and must be between 0 and 7.

.. Warning::
Be cautious in changing this value as it might affect other peripherals that use the 8 MHz RTC clock!
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this method be in a different class if it affects the system globally? E.g.ESP32.rtc_clk_div? I know it's more work, but it would be awful to have 2-3 peripherals that each have anrtc_clk_div method and that conflict with one another because they really adjust the same thing.

Copy link
Author

Choose a reason for hiding this comment

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

Agree. Will move that over and make a note about it in the reference for the frequency set function

SET_PERI_REG_MASK(SENS_SAR_DAC_CTRL1_REG, SENS_SW_TONE_EN);
switch(self->dac_id) {
case DAC_CHANNEL_1:
// Enable / connect tone tone generator on / to this channel
Copy link
Contributor

Choose a reason for hiding this comment

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

"tone tone"

tschmid reacted with thumbs up emoji

ESP32 specific DAC class method reference:

.. method:: DAC.cosine_enable()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you decide to break cosine_enable/disable out into their own methods as opposed to simply providing acosine=True/False keyword parameter to themake_new constructor or actually to an init method? This really also applies to thefrequency_step method. Unless these get called while the DAC is operating, they would be simpler just as KW args in the constructor/init IMHO.

Copy link
Author

Choose a reason for hiding this comment

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

Will have to do both as you can enable/disable this feature during run-time.

@projectgus
Copy link
Contributor

This is an automated heads-up that we've just merged a Pull Request
that removes the STATIC macro from MicroPython's C API.

See#13763

A search suggests this PR might apply the STATIC macro to some C code. If it
does, then next time you rebase the PR (or merge from master) then you should
please replace all theSTATIC keywords withstatic.

Although this is an automated message, feel free to @-reply to me directly if
you have any questions about this.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tvetvetve left review comments

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@tschmid@projectgus@tve@dpgeorge

[8]ページ先頭

©2009-2025 Movatter.jp