Output the audio signal with filtering by graphic equalizer in the *.wav file on the SD card using onboard CODEC. SD カードの *.wav ファイルのオーディオ信号をグラフィック・イコライザを通して,ボードに搭載されているCODEC で出力する.

Dependencies:   F746_GUI F746_SAI_IO SD_PlayerSkeleton FrequencyResponseDrawer

Committer:
MikamiUitOpen
Date:
Sun Oct 02 06:33:59 2016 +0000
Revision:
16:cbb726ac20d8
17

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 16:cbb726ac20d8 1 /* mbed Microcontroller Library
MikamiUitOpen 16:cbb726ac20d8 2 * Copyright (c) 2006-2013 ARM Limited
MikamiUitOpen 16:cbb726ac20d8 3 *
MikamiUitOpen 16:cbb726ac20d8 4 * Licensed under the Apache License, Version 2.0 (the "License");
MikamiUitOpen 16:cbb726ac20d8 5 * you may not use this file except in compliance with the License.
MikamiUitOpen 16:cbb726ac20d8 6 * You may obtain a copy of the License at
MikamiUitOpen 16:cbb726ac20d8 7 *
MikamiUitOpen 16:cbb726ac20d8 8 * http://www.apache.org/licenses/LICENSE-2.0
MikamiUitOpen 16:cbb726ac20d8 9 *
MikamiUitOpen 16:cbb726ac20d8 10 * Unless required by applicable law or agreed to in writing, software
MikamiUitOpen 16:cbb726ac20d8 11 * distributed under the License is distributed on an "AS IS" BASIS,
MikamiUitOpen 16:cbb726ac20d8 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MikamiUitOpen 16:cbb726ac20d8 13 * See the License for the specific language governing permissions and
MikamiUitOpen 16:cbb726ac20d8 14 * limitations under the License.
MikamiUitOpen 16:cbb726ac20d8 15 */
MikamiUitOpen 16:cbb726ac20d8 16 #include "BusOut.h"
MikamiUitOpen 16:cbb726ac20d8 17 #include "mbed_assert.h"
MikamiUitOpen 16:cbb726ac20d8 18
MikamiUitOpen 16:cbb726ac20d8 19 namespace mbed {
MikamiUitOpen 16:cbb726ac20d8 20
MikamiUitOpen 16:cbb726ac20d8 21 BusOut::BusOut(PinName p0, PinName p1, PinName p2, PinName p3, PinName p4, PinName p5, PinName p6, PinName p7, PinName p8, PinName p9, PinName p10, PinName p11, PinName p12, PinName p13, PinName p14, PinName p15) {
MikamiUitOpen 16:cbb726ac20d8 22 PinName pins[16] = {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15};
MikamiUitOpen 16:cbb726ac20d8 23
MikamiUitOpen 16:cbb726ac20d8 24 _nc_mask = 0;
MikamiUitOpen 16:cbb726ac20d8 25 for (int i=0; i<16; i++) {
MikamiUitOpen 16:cbb726ac20d8 26 _pin[i] = (pins[i] != NC) ? new DigitalOut(pins[i]) : 0;
MikamiUitOpen 16:cbb726ac20d8 27 if (pins[i] != NC) {
MikamiUitOpen 16:cbb726ac20d8 28 _nc_mask |= (1 << i);
MikamiUitOpen 16:cbb726ac20d8 29 }
MikamiUitOpen 16:cbb726ac20d8 30 }
MikamiUitOpen 16:cbb726ac20d8 31 }
MikamiUitOpen 16:cbb726ac20d8 32
MikamiUitOpen 16:cbb726ac20d8 33 BusOut::BusOut(PinName pins[16]) {
MikamiUitOpen 16:cbb726ac20d8 34 _nc_mask = 0;
MikamiUitOpen 16:cbb726ac20d8 35 for (int i=0; i<16; i++) {
MikamiUitOpen 16:cbb726ac20d8 36 _pin[i] = (pins[i] != NC) ? new DigitalOut(pins[i]) : 0;
MikamiUitOpen 16:cbb726ac20d8 37 if (pins[i] != NC) {
MikamiUitOpen 16:cbb726ac20d8 38 _nc_mask |= (1 << i);
MikamiUitOpen 16:cbb726ac20d8 39 }
MikamiUitOpen 16:cbb726ac20d8 40 }
MikamiUitOpen 16:cbb726ac20d8 41 }
MikamiUitOpen 16:cbb726ac20d8 42
MikamiUitOpen 16:cbb726ac20d8 43 BusOut::~BusOut() {
MikamiUitOpen 16:cbb726ac20d8 44 for (int i=0; i<16; i++) {
MikamiUitOpen 16:cbb726ac20d8 45 if (_pin[i] != 0) {
MikamiUitOpen 16:cbb726ac20d8 46 delete _pin[i];
MikamiUitOpen 16:cbb726ac20d8 47 }
MikamiUitOpen 16:cbb726ac20d8 48 }
MikamiUitOpen 16:cbb726ac20d8 49 }
MikamiUitOpen 16:cbb726ac20d8 50
MikamiUitOpen 16:cbb726ac20d8 51 void BusOut::write(int value) {
MikamiUitOpen 16:cbb726ac20d8 52 for (int i=0; i<16; i++) {
MikamiUitOpen 16:cbb726ac20d8 53 if (_pin[i] != 0) {
MikamiUitOpen 16:cbb726ac20d8 54 _pin[i]->write((value >> i) & 1);
MikamiUitOpen 16:cbb726ac20d8 55 }
MikamiUitOpen 16:cbb726ac20d8 56 }
MikamiUitOpen 16:cbb726ac20d8 57 }
MikamiUitOpen 16:cbb726ac20d8 58
MikamiUitOpen 16:cbb726ac20d8 59 int BusOut::read() {
MikamiUitOpen 16:cbb726ac20d8 60 int v = 0;
MikamiUitOpen 16:cbb726ac20d8 61 for (int i=0; i<16; i++) {
MikamiUitOpen 16:cbb726ac20d8 62 if (_pin[i] != 0) {
MikamiUitOpen 16:cbb726ac20d8 63 v |= _pin[i]->read() << i;
MikamiUitOpen 16:cbb726ac20d8 64 }
MikamiUitOpen 16:cbb726ac20d8 65 }
MikamiUitOpen 16:cbb726ac20d8 66 return v;
MikamiUitOpen 16:cbb726ac20d8 67 }
MikamiUitOpen 16:cbb726ac20d8 68
MikamiUitOpen 16:cbb726ac20d8 69 #ifdef MBED_OPERATORS
MikamiUitOpen 16:cbb726ac20d8 70 BusOut& BusOut::operator= (int v) {
MikamiUitOpen 16:cbb726ac20d8 71 write(v);
MikamiUitOpen 16:cbb726ac20d8 72 return *this;
MikamiUitOpen 16:cbb726ac20d8 73 }
MikamiUitOpen 16:cbb726ac20d8 74
MikamiUitOpen 16:cbb726ac20d8 75 BusOut& BusOut::operator= (BusOut& rhs) {
MikamiUitOpen 16:cbb726ac20d8 76 write(rhs.read());
MikamiUitOpen 16:cbb726ac20d8 77 return *this;
MikamiUitOpen 16:cbb726ac20d8 78 }
MikamiUitOpen 16:cbb726ac20d8 79
MikamiUitOpen 16:cbb726ac20d8 80 DigitalOut& BusOut::operator[] (int index) {
MikamiUitOpen 16:cbb726ac20d8 81 MBED_ASSERT(index >= 0 && index <= 16);
MikamiUitOpen 16:cbb726ac20d8 82 MBED_ASSERT(_pin[index]);
MikamiUitOpen 16:cbb726ac20d8 83 return *_pin[index];
MikamiUitOpen 16:cbb726ac20d8 84 }
MikamiUitOpen 16:cbb726ac20d8 85
MikamiUitOpen 16:cbb726ac20d8 86 BusOut::operator int() {
MikamiUitOpen 16:cbb726ac20d8 87 return read();
MikamiUitOpen 16:cbb726ac20d8 88 }
MikamiUitOpen 16:cbb726ac20d8 89 #endif
MikamiUitOpen 16:cbb726ac20d8 90
MikamiUitOpen 16:cbb726ac20d8 91 } // namespace mbed