Minor Modification from Original Library
Fork of AUDIO_DISCO_F746NG by
AUDIO_DISCO_F746NG.cpp@1:0b1ed1d2140d, 2016-08-23 (annotated)
- Committer:
- stefanofasciani
- Date:
- Tue Aug 23 06:12:59 2016 +0000
- Revision:
- 1:0b1ed1d2140d
- Parent:
- 0:6f035eff38e4
First Commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adustm | 0:6f035eff38e4 | 1 | /* Copyright (c) 2010-2016 mbed.org, MIT License |
adustm | 0:6f035eff38e4 | 2 | * |
adustm | 0:6f035eff38e4 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
adustm | 0:6f035eff38e4 | 4 | * and associated documentation files (the "Software"), to deal in the Software without |
adustm | 0:6f035eff38e4 | 5 | * restriction, including without limitation the rights to use, copy, modify, merge, publish, |
adustm | 0:6f035eff38e4 | 6 | * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the |
adustm | 0:6f035eff38e4 | 7 | * Software is furnished to do so, subject to the following conditions: |
adustm | 0:6f035eff38e4 | 8 | * |
adustm | 0:6f035eff38e4 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
adustm | 0:6f035eff38e4 | 10 | * substantial portions of the Software. |
adustm | 0:6f035eff38e4 | 11 | * |
adustm | 0:6f035eff38e4 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
adustm | 0:6f035eff38e4 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
adustm | 0:6f035eff38e4 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
adustm | 0:6f035eff38e4 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
adustm | 0:6f035eff38e4 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
adustm | 0:6f035eff38e4 | 17 | */ |
adustm | 0:6f035eff38e4 | 18 | |
adustm | 0:6f035eff38e4 | 19 | #include "AUDIO_DISCO_F746NG.h" |
adustm | 0:6f035eff38e4 | 20 | |
adustm | 0:6f035eff38e4 | 21 | // Constructor |
adustm | 0:6f035eff38e4 | 22 | AUDIO_DISCO_F746NG::AUDIO_DISCO_F746NG() |
adustm | 0:6f035eff38e4 | 23 | { |
stefanofasciani | 1:0b1ed1d2140d | 24 | //volume is 0 to 100 (80 is 0db); |
stefanofasciani | 1:0b1ed1d2140d | 25 | BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_HEADPHONE, 80, I2S_AUDIOFREQ_48K); |
adustm | 0:6f035eff38e4 | 26 | } |
adustm | 0:6f035eff38e4 | 27 | |
adustm | 0:6f035eff38e4 | 28 | // Destructor |
adustm | 0:6f035eff38e4 | 29 | AUDIO_DISCO_F746NG::~AUDIO_DISCO_F746NG() |
adustm | 0:6f035eff38e4 | 30 | { |
adustm | 0:6f035eff38e4 | 31 | |
adustm | 0:6f035eff38e4 | 32 | } |
adustm | 0:6f035eff38e4 | 33 | |
adustm | 0:6f035eff38e4 | 34 | //================================================================================================================= |
adustm | 0:6f035eff38e4 | 35 | // Public methods |
adustm | 0:6f035eff38e4 | 36 | //================================================================================================================= |
adustm | 0:6f035eff38e4 | 37 | |
adustm | 0:6f035eff38e4 | 38 | uint8_t AUDIO_DISCO_F746NG::OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq) |
adustm | 0:6f035eff38e4 | 39 | { |
adustm | 0:6f035eff38e4 | 40 | return BSP_AUDIO_OUT_Init(OutputDevice, Volume, AudioFreq); |
adustm | 0:6f035eff38e4 | 41 | } |
adustm | 0:6f035eff38e4 | 42 | |
adustm | 0:6f035eff38e4 | 43 | uint8_t AUDIO_DISCO_F746NG::OUT_Play(uint16_t* pBuffer, uint32_t Size) |
adustm | 0:6f035eff38e4 | 44 | { |
adustm | 0:6f035eff38e4 | 45 | return BSP_AUDIO_OUT_Play(pBuffer, Size); |
adustm | 0:6f035eff38e4 | 46 | } |
adustm | 0:6f035eff38e4 | 47 | |
adustm | 0:6f035eff38e4 | 48 | void AUDIO_DISCO_F746NG::OUT_ChangeBuffer(uint16_t *pData, uint16_t Size) |
adustm | 0:6f035eff38e4 | 49 | { |
adustm | 0:6f035eff38e4 | 50 | BSP_AUDIO_OUT_ChangeBuffer(pData, Size); |
adustm | 0:6f035eff38e4 | 51 | } |
adustm | 0:6f035eff38e4 | 52 | |
adustm | 0:6f035eff38e4 | 53 | uint8_t AUDIO_DISCO_F746NG::OUT_Pause(void) |
adustm | 0:6f035eff38e4 | 54 | { |
adustm | 0:6f035eff38e4 | 55 | return BSP_AUDIO_OUT_Pause(); |
adustm | 0:6f035eff38e4 | 56 | } |
adustm | 0:6f035eff38e4 | 57 | |
adustm | 0:6f035eff38e4 | 58 | uint8_t AUDIO_DISCO_F746NG::OUT_Resume(void) |
adustm | 0:6f035eff38e4 | 59 | { |
adustm | 0:6f035eff38e4 | 60 | return BSP_AUDIO_OUT_Resume(); |
adustm | 0:6f035eff38e4 | 61 | } |
adustm | 0:6f035eff38e4 | 62 | |
adustm | 0:6f035eff38e4 | 63 | uint8_t AUDIO_DISCO_F746NG::OUT_Stop(uint32_t Option) |
adustm | 0:6f035eff38e4 | 64 | { |
adustm | 0:6f035eff38e4 | 65 | return BSP_AUDIO_OUT_Stop(Option); |
adustm | 0:6f035eff38e4 | 66 | } |
adustm | 0:6f035eff38e4 | 67 | |
adustm | 0:6f035eff38e4 | 68 | uint8_t AUDIO_DISCO_F746NG::OUT_SetVolume(uint8_t Volume) |
adustm | 0:6f035eff38e4 | 69 | { |
adustm | 0:6f035eff38e4 | 70 | return BSP_AUDIO_OUT_SetVolume(Volume); |
adustm | 0:6f035eff38e4 | 71 | } |
adustm | 0:6f035eff38e4 | 72 | |
adustm | 0:6f035eff38e4 | 73 | uint8_t AUDIO_DISCO_F746NG::OUT_SetMute(uint32_t Cmd) |
adustm | 0:6f035eff38e4 | 74 | { |
adustm | 0:6f035eff38e4 | 75 | return BSP_AUDIO_OUT_SetMute(Cmd); |
adustm | 0:6f035eff38e4 | 76 | } |
adustm | 0:6f035eff38e4 | 77 | |
adustm | 0:6f035eff38e4 | 78 | uint8_t AUDIO_DISCO_F746NG::OUT_SetOutputMode(uint8_t Output) |
adustm | 0:6f035eff38e4 | 79 | { |
adustm | 0:6f035eff38e4 | 80 | return BSP_AUDIO_OUT_SetOutputMode(Output); |
adustm | 0:6f035eff38e4 | 81 | } |
adustm | 0:6f035eff38e4 | 82 | |
adustm | 0:6f035eff38e4 | 83 | void AUDIO_DISCO_F746NG::OUT_SetFrequency(uint32_t AudioFreq) |
adustm | 0:6f035eff38e4 | 84 | { |
adustm | 0:6f035eff38e4 | 85 | BSP_AUDIO_OUT_SetFrequency(AudioFreq); |
adustm | 0:6f035eff38e4 | 86 | } |
adustm | 0:6f035eff38e4 | 87 | |
adustm | 0:6f035eff38e4 | 88 | void AUDIO_DISCO_F746NG::OUT_SetAudioFrameSlot(uint32_t AudioFrameSlot) |
adustm | 0:6f035eff38e4 | 89 | { |
adustm | 0:6f035eff38e4 | 90 | BSP_AUDIO_OUT_SetAudioFrameSlot(AudioFrameSlot); |
adustm | 0:6f035eff38e4 | 91 | } |
adustm | 0:6f035eff38e4 | 92 | |
adustm | 0:6f035eff38e4 | 93 | void AUDIO_DISCO_F746NG::OUT_DeInit(void) |
adustm | 0:6f035eff38e4 | 94 | { |
adustm | 0:6f035eff38e4 | 95 | BSP_AUDIO_OUT_DeInit(); |
adustm | 0:6f035eff38e4 | 96 | } |
adustm | 0:6f035eff38e4 | 97 | |
adustm | 0:6f035eff38e4 | 98 | uint8_t AUDIO_DISCO_F746NG::IN_Init(uint16_t InputDevice, uint8_t Volume, uint32_t AudioFreq) |
adustm | 0:6f035eff38e4 | 99 | { |
adustm | 0:6f035eff38e4 | 100 | return BSP_AUDIO_IN_Init(InputDevice, Volume, AudioFreq); |
adustm | 0:6f035eff38e4 | 101 | } |
adustm | 0:6f035eff38e4 | 102 | |
adustm | 0:6f035eff38e4 | 103 | uint8_t AUDIO_DISCO_F746NG::IN_OUT_Init(uint16_t InputDevice, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq) |
adustm | 0:6f035eff38e4 | 104 | { |
adustm | 0:6f035eff38e4 | 105 | return BSP_AUDIO_IN_OUT_Init(InputDevice, OutputDevice, Volume, AudioFreq); |
adustm | 0:6f035eff38e4 | 106 | } |
adustm | 0:6f035eff38e4 | 107 | |
adustm | 0:6f035eff38e4 | 108 | uint8_t AUDIO_DISCO_F746NG::IN_Record(uint16_t* pbuf, uint32_t size) |
adustm | 0:6f035eff38e4 | 109 | { |
adustm | 0:6f035eff38e4 | 110 | return BSP_AUDIO_IN_Record(pbuf, size); |
adustm | 0:6f035eff38e4 | 111 | } |
adustm | 0:6f035eff38e4 | 112 | |
adustm | 0:6f035eff38e4 | 113 | uint8_t AUDIO_DISCO_F746NG::IN_Stop(uint32_t Option) |
adustm | 0:6f035eff38e4 | 114 | { |
adustm | 0:6f035eff38e4 | 115 | return BSP_AUDIO_IN_Stop(Option); |
adustm | 0:6f035eff38e4 | 116 | } |
adustm | 0:6f035eff38e4 | 117 | |
adustm | 0:6f035eff38e4 | 118 | uint8_t AUDIO_DISCO_F746NG::IN_Pause(void) |
adustm | 0:6f035eff38e4 | 119 | { |
adustm | 0:6f035eff38e4 | 120 | return BSP_AUDIO_IN_Pause(); |
adustm | 0:6f035eff38e4 | 121 | } |
adustm | 0:6f035eff38e4 | 122 | |
adustm | 0:6f035eff38e4 | 123 | uint8_t AUDIO_DISCO_F746NG::IN_Resume(void) |
adustm | 0:6f035eff38e4 | 124 | { |
adustm | 0:6f035eff38e4 | 125 | return BSP_AUDIO_IN_Resume(); |
adustm | 0:6f035eff38e4 | 126 | } |
adustm | 0:6f035eff38e4 | 127 | |
adustm | 0:6f035eff38e4 | 128 | uint8_t AUDIO_DISCO_F746NG::IN_SetVolume(uint8_t Volume) |
adustm | 0:6f035eff38e4 | 129 | { |
adustm | 0:6f035eff38e4 | 130 | return BSP_AUDIO_IN_SetVolume(Volume); |
adustm | 0:6f035eff38e4 | 131 | } |
adustm | 0:6f035eff38e4 | 132 | |
adustm | 0:6f035eff38e4 | 133 | void AUDIO_DISCO_F746NG::IN_DeInit(void) |
adustm | 0:6f035eff38e4 | 134 | { |
adustm | 0:6f035eff38e4 | 135 | BSP_AUDIO_IN_DeInit(); |
adustm | 0:6f035eff38e4 | 136 | } |