-
Notifications
You must be signed in to change notification settings - Fork 191
Add initial DatanoiseTV PicoADK Board Support #169
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
base: master
Are you sure you want to change the base?
Changes from 7 commits
577ed48
ec58a32
415f446
3c4dcb5
a4d963c
8d93779
f733579
eb3d457
49ee101
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,6 +242,14 @@ static void startAudio() { | |
i2s.setBCLK(BCLK_PIN); | ||
i2s.setDATA(DOUT_PIN); | ||
i2s.setBitsPerSample(AUDIO_BITS); | ||
|
||
#if (ARDUINO_DATANOISETV_PICOADK) | ||
// Soft mute and de-emphasis for audio codec | ||
pinMode(25, OUTPUT); | ||
digitalWrite(25, HIGH); | ||
pinMode(23, OUTPUT); | ||
digitalWrite(23, LOW); | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not think it is desirable that the details of every board created are in Mozzi. Architectures yes, but if we start to "pre-config" every board that goes out this is a never ending story. Especially as what is done here can easily be done in the sketch. |
||
|
||
#if (AUDIO_BITS > 16) | ||
i2s.setBuffers(BUFFERS, (size_t) (BUFFER_SIZE/BUFFERS), 0); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,10 @@ | |
#define CACHED_FUNCTION_ATTR | ||
#endif | ||
|
||
#if IS_RP2040() | ||
#define AUDIO_RATE_PLATFORM_DEFAULT 32768 | ||
#endif | ||
|
||
Comment on lines
+49
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not think this is needed as the RP2040 is not AVR so the test on line 35 will be false and the AUDIO_RATE was already at 32768. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you checked this? |
||
#if IS_STM32() | ||
// This is a little silly, but with Arduino 1.8.13, including this header inside MozziGuts.cpp does not work (fails to detect the proper include path). | ||
// Putting it here, instead, seem to work. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ extern STM32ADC adc; | |
#include <esp8266_peri.h> | ||
#endif | ||
|
||
#if IS_RP2040() | ||
#include "hardware/structs/rosc.h" | ||
#endif | ||
|
||
// moved these out of xorshift96() so xorshift96() can be reseeded manually | ||
static unsigned long x=132456789, y=362436069, z=521288629; | ||
// static unsigned long x= analogRead(A0)+123456789; | ||
|
@@ -144,6 +148,16 @@ void randSeed() { | |
x = RANDOM_REG32; | ||
y = random (0xFFFFFFFF) ^ RANDOM_REG32; | ||
z = random (0xFFFFFFFF) ^ RANDOM_REG32; | ||
#elif IS_RP2040() | ||
uint32_t rand_seed; | ||
for (int i = 0; i < 32; i++) | ||
{ | ||
bool randomBit = rosc_hw->randombit; | ||
rand_seed = rand_seed | (randomBit << i); | ||
} | ||
x = random (rand_seed); | ||
y = random (rand_seed); | ||
z = random (rand_seed); | ||
#else | ||
Comment on lines
+151
to
161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haven't tested but look good to me. |
||
#warning Automatic random seeding not implemented on this platform | ||
#endif | ||
|
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 erasing the config for all cases? When is this test going true? I would be against putting these pins at the default values of the arduino-pico library, with no easy change if that is the case. I think that (alongside the comment on the support of
ARDUINO_DATANOISETV_PICOADK
) this kind of config should be given by the board designer and not be hardcoded in Mozzi.