Arduino library for WTV020-SD-16P audio module

First of all big thanks and kudos to Diego J. Arevalo for putting together the library. It was a great starting point to play with WTV020-SD-16P audio module.

However there are two thing incorrect in this cpp code:

  1. at the end of each loop in "sendCommand" there is 2ms delay after each bit is sent. This 2ms stop bit should be sent after entire message is sent
  2. the timing does not account for digitalWrite taking about 5us so there are at least 15us added to each clock pulse.

Because of this problems the "sendCommand" takes over 50ms to execute. It was not acceptable in for my solution where I needed to do precise timings on each sound clip (fishing boat sound for RC model). I have corrected both issues and the "sendCommand" now takes absolute minimum required for transmitting 16 bits. I have also added "setVolume" function and fix "unmute" function to restore the volume level from before "mute".

Anyway, here is the entire library attached (including updated example and three sample ad4 files used in the example).

@ the-rebel-agent - feel free to update it in your first post in this thread if you wish.

Ryszard.

Wtv020sd16p.zip (1.1 MB)