-
Notifications
You must be signed in to change notification settings - Fork 148
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
I2S driver #769
base: develop
Are you sure you want to change the base?
I2S driver #769
Conversation
d62117f
to
cb61d8e
Compare
2cdb666
to
17cd5e3
Compare
Co-authored-by: Raphael Lehmann <[email protected]>
and remove deprecated enablePll() function that are not using `enablePll` struct. Co-authored-by: Raphael Lehmann <[email protected]>
Co-authored-by: Raphael Lehmann <[email protected]>
17cd5e3
to
d31ea26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very awesome!
operator""_q_db(unsigned long long int value) | ||
{ | ||
return ma12070p::quarter_decibel(value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really worth the effort for /4 or *4? This may not be a terrible conversion at runtime with a single cycle shift, and probablt done at compile time anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented the quarter decibel data type mainly to make it convenient for the user to use decibels in the application code without having to look up the meaning of otherwise unitless parameters for setMasterVolume()
, etc...
src/modm/driver/dac/ma12070p.hpp
Outdated
os << "DcProtection "; | ||
os << ")"; | ||
return os; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember some issues with name resolution that required these to be in the modm namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had some pretty obscure bugs where calling the operator did not work from within the modm namespace when defined in the global scope.
I tested the example for the F407 discovery board successfully on hardware! ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -186,6 +186,7 @@ def build(env): | |||
properties["dmaType"] = dma["type"] | |||
properties["dmaSignals"] = signal_names | |||
properties["dmaController"] = controller | |||
properties["doubleBuffer"] = (dma["type"] in ["stm32-stream-channel"]) ## TODO: which other types support double buffer mode? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stm32-mux-stream
is the combination of the stm32-stream-channel
IP with the DMAMUX
peripheral. It also supports double-buffered mode.
properties["doubleBuffer"] = (dma["type"] in ["stm32-stream-channel"]) ## TODO: which other types support double buffer mode? | |
properties["doubleBuffer"] = (dma["type"] in ["stm32-stream-channel", "stm32-mux-stream"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll give it a try.
The DMA double buffer is currently not used anywhere with I2S, because that would make I2S more complicated or limit it to the devices with stm32-stream-channel
/stm32-mux-stream
DMA IP.
Works fine with the transfer complete interrupt, but maybe in the future someone can implement a mode with DMA double buffer and without interrupts.
/** | ||
* Interface for a I2S Master | ||
* | ||
* @author Marton Ledneczki | ||
* @ingroup modm_architecture_i2s | ||
*/ | ||
class I2sMaster : public ::modm::PeripheralDriver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we somehow include in the name that this is an output device only? This interface does not describe a generic I²S master which could also receive audio or operate in time-multiplexed half-duplex mode. The terms master / slave do not imply a certain audio transfer direction, they only describe which device generates the clock.
If someone wanted to also implement input in the future there would be a naming issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to not break compatibility when (later) implementing I2S full-duplex/input functionality I would like to keep the class name, but add ONLY OUTPUT FUNCTIONALITY CURRENTLY IMPLEMENTED to the description.
(Slave (=clock receiver) would probably need another interface, but master with input you would probably just add more function/parameters to the current interface.)
What do you think?
src/modm/driver/dac/ma12070p.hpp
Outdated
os << "DcProtection "; | ||
os << ")"; | ||
return os; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had some pretty obscure bugs where calling the operator did not work from within the modm namespace when defined in the global scope.
…late argument (struct)
Just curious, is this feature now completely off the table or is it somehow still in the loop? |
I have planned to get my open pull requests (also those marked as "stale") merged before the next release (2023q1 scheduled for 01.04.2023). Let's see if I can do that. The I2S driver here already works, as well as the I2C driver for the DAC CS43L22. In addition, the dual-buffering of the I2S driver is not yet solved optimally, a better solution should be found. But maybe not in this PR. |
Thanks for the info and your efforts |
Based on the great work #621 from @ledneczki.