MCUdude / SigmaDSP

A versatile Arduino library for interfacing with the ADAU1401, ADAU1701 and ADAU1702 audio DSPs
GNU Lesser General Public License v3.0
165 stars 33 forks source link

Question to safeload_write #26

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello,

I want to write some own function for controlling the blocks into the dsp,bBut can't test this at the moment, so I am asking here before. I don't understand correctly how to use the data block in safeload_write.

As example the mute-block. SigmaStudio says: grafik which of them is now the correct method?

  dsp.safeload_write(startMemoryAddress, 0x80 );
  dsp.safeload_write(startMemoryAddress, 0x00, 0x80, 0x00, 0x00 );
  dsp.safeload_write(startMemoryAddress, 0x00800000 );

Thanks and greet work with this library! fmvoxa

ghost commented 2 years ago

I see in the function for the mux, that there is the index (0-N) as a parameter, this isn't in hexadecimal. So it is also possible to use 0 or 1 for the mute example?

MCUdude commented 2 years ago

The screenshot from SigmaStudio isn't correct, because you haven't compiled the project. That's why the block is shown with address 0x0000. You also need to compile the project to find out how many addresses the block occupies.

Each address takes a 32-bit number. For a mute block with only one address, this is the correct way:

dsp.safeload_write(startMemoryAddress, 0x00800000); //Enable
dsp.safeload_write(startMemoryAddress, 0x00000000); //Disable
ghost commented 2 years ago

Thanks for the quick replay!

The screenshot from SigmaStudio isn't correct, because you haven't compiled the project.

It is compiled. In the SigmaStudio_parameter.h is the address 0 too. It is the first block behind the input-block.

MCUdude commented 2 years ago

Sorry, I assumed it wasn't compiled.

I'll assume you got it working? If you need more examples of how you can utilize safeload_write, have a look at SigmaDSP.cpp

ghost commented 2 years ago

Yeah, it is working!

Here is the function, for everyone who need it too:

void setMute(uint16_t startMemoryAddress, bool status)
{
  Serial.print("Mute: ");
  Serial.println(status ? "True" : "False");
  uint32_t mute = status ? 0x00000000 : 0x00800000;
  dsp.safeload_write(startMemoryAddress, mute);
}
MCUdude commented 2 years ago

Great, thanks for sharing!