~aleteoryx/muditaos

8f8a1b3ca16fdbe09a6bd8a500d62850992d99a1 — Maciej Gibowicz 4 years ago 0089b90
[EGD-6499] Fix audio initialization

Now the peripherals and the audio clocks will be turned on
only when the user is using the audio, which will save energy.
M module-audio/board/rt1051/RT1051AudioCodec.cpp => module-audio/board/rt1051/RT1051AudioCodec.cpp +13 -0
@@ 27,6 27,7 @@ namespace audio
    RT1051AudioCodec::~RT1051AudioCodec()
    {
        Stop();
        DeinitBsp();
    }

    CodecParamsMAX98090::InputPath RT1051AudioCodec::getCodecInputPath(const AudioDevice::Format &format)


@@ 71,6 72,8 @@ namespace audio
            return AudioDevice::RetCode::Failure;
        }

        InitBsp();

        saiInFormat.bitWidth      = format.bitWidth;
        saiInFormat.sampleRate_Hz = format.sampleRate_Hz;



@@ 186,6 189,16 @@ namespace audio
        return true;
    }

    void RT1051AudioCodec::InitBsp()
    {
        bsp::audioInit();
    }

    void RT1051AudioCodec::DeinitBsp()
    {
        bsp::audioDeinit();
    }

    void RT1051AudioCodec::InStart()
    {
        sai_transfer_format_t sai_format;

M module-audio/board/rt1051/RT1051AudioCodec.hpp => module-audio/board/rt1051/RT1051AudioCodec.hpp +2 -0
@@ 78,6 78,8 @@ namespace audio
        static AT_NONCACHEABLE_SECTION_INIT(sai_edma_handle_t txHandle);
        static AT_NONCACHEABLE_SECTION_INIT(sai_edma_handle_t rxHandle);

        void InitBsp();
        void DeinitBsp();
        void OutStart();
        void InStart();
        void OutStop();

M module-bsp/board/rt1051/common/board.cpp => module-bsp/board/rt1051/common/board.cpp +0 -3
@@ 194,9 194,6 @@ namespace bsp
        // Set internal DCDC to DCM mode. Switching between DCM and CCM mode will be done automatically.
        DCDC_BootIntoDCM(DCDC);

        // init audio
        audioInit();

        PrintSystemClocks();
        clearAndPrintBootReason();
    }