-
Notifications
You must be signed in to change notification settings - Fork 4
Check if dac is present and add parameters for sample rate and bit depth #20
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
Conversation
This deals with most of what #18 was trying to do (but better) except for supporting I2SOut objects on different pins. Would it make sense to allow, optionally, the I2SOut object to be passed in? |
Sorry for stepping on your toes a little bit. 😆
What if we did a check like: if "I2S_BCLK" in dir(board):
self._audio = ... If the pin(s) isn't available, it'll just set The user code would look something like: peripherals = adafruit_fruitjam.peripherals.Peripherals()
peripherals.audio = I2SOut(...)
peripherals.play_file(...) |
As for the DAC, I could see us adding in an argument for the |
I had noticed an application that used a different I2C bus to communicate with the TLV320 breakout board which is why I considered passing the DAC object. I'm not really even sure it wasn't just an alternate name for the board.I2C but it got me thinking that it was possible someone might wire up a different bus. If we passed in the I2C object to be used though, then a different bus could be used. In addition, if there was an alternate DAC being used (the ES8311 also uses I2C 0x18 so it would be incorrectly identified as the TLV320) an invalid I2C bus or one that wasn't connected could be passed in to disable the TLV320 allowing it to be handled outside the library. EDIT: 😁 I guess that's essentially your setter approach though.... |
This version of the library seems to be causing the boot animation (or perhaps more broadly initializing adafruit_fruitjam.peripherals.Peripherals?) to get stuck when it runs on a Fruit Jam device (tested on 10.0.beta-3). I've started tracing to figure out where it is getting stalled but not managed to find the bottom of the rabbit hole yet. It seems like the DAC init never completes when using this version of the library edited to add a few print statements to check where it's at:
|
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 think it's missing an i2c unlock.
@RetiredWizard I've got the setters going and have the i2c bus parameter to disable initialization. I think that takes care of it, but for anything deeper, I may need a direct use-case with desired code examples, because it's starting to get over my head. |
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.
For what it's worth, here are some notes on my read through. If I have time later tonight, I'll try and get the updates from this PR installed locally so I can do better testing.
Thanks for the review, @RetiredWizard & @FoamyGuy! I think I've got this ready to go now, but please let me know if there are any additional changes that need to be made. |
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.
Thank you!
This looks good to me. Tested successfully with the boot animation on Fruit Jam.
Updating https://github.com/adafruit/Adafruit_CircuitPython_CharLCD to 3.5.4 from 3.5.3: > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#83 from squaregoldfish/main Updating https://github.com/adafruit/Adafruit_CircuitPython_VEML7700 to 2.1.5 from 2.1.4: > Merge pull request adafruit/Adafruit_CircuitPython_VEML7700#37 from anecdata/main Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 7.3.0 from 7.2.4: > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#186 from wizhannah/W6300 Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_MIDI to 1.0.20 from 1.0.19: > Merge pull request adafruit/Adafruit_CircuitPython_BLE_MIDI#15 from spridget/patch-2 Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout to 3.1.1 from 3.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_Layout#105 from shubham0x13/main Updating https://github.com/adafruit/Adafruit_CircuitPython_FruitJam to 1.4.0 from 1.2.0: > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#21 from relic-se/optional-buttons > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#20 from relic-se/dac-settings > Merge pull request adafruit/Adafruit_CircuitPython_FruitJam#15 from FoamyGuy/play_mp3_file
This update works to make the implementation of the DAC consistent with other implementations and to allow more control over its configuration. The following changes have been applied:
Peripherals.play_file
) andPeripherals.dac
andPeripherals.audio
returnNone
.AddedPeripherals.dac_present
property.DAC and audio output availability are tested by checking against
None
.sample_rate
andbit_depth
to constructor arguments.dac
andaudio
properties.i2c
constructor argument (set toFalse
to disable dac & audio initialization).