#ifndef PLATFORM_H
#define PLATFORM_H
#include <Arduino.h>
#include <Audio.h>
#define PLATFORM_AUDIO_ADCDAC_CTRL 0x000E
class AudioCodecControl: public AudioControlSGTL5000 {
public:
inline void mutesDAC(bool _muteL, bool _muteR) __attribute__((always_inline))
{
uint16_t mute_bits = ((uint16_t)_muteL<<2) + ((uint16_t)_muteR<<3); // puts mute bits where they need to go in PLATFORM_AUDIO_ADCDAC_CTRL register
modify(PLATFORM_AUDIO_ADCDAC_CTRL, mute_bits, 0x000C); // modify performs write(read(reg)&(~0x000C))|mute_bits;
}
};
class Platform
{
AudioCodecControl sgtl5000_1; // Codec Control Class
public:
inline void mutesAudioChip(bool _muteL, bool _muteR) __attribute__((always_inline));
....................other stuff
void Platform::mutesAudioChip(bool _muteL, bool _muteR)
{
sgtl5000_1.mutesDAC(_muteL, _muteR);
}
extern Platform PC;
#endif /* PLATFORM_H */