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:
Mon Apr 10 04:07:35 2017 +0000
Revision:
24:f78f9d0ac262
Parent:
16:cbb726ac20d8
25

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 "InterruptIn.h"
MikamiUitOpen 16:cbb726ac20d8 17
MikamiUitOpen 16:cbb726ac20d8 18 #if DEVICE_INTERRUPTIN
MikamiUitOpen 16:cbb726ac20d8 19
MikamiUitOpen 16:cbb726ac20d8 20 namespace mbed {
MikamiUitOpen 16:cbb726ac20d8 21
MikamiUitOpen 16:cbb726ac20d8 22 InterruptIn::InterruptIn(PinName pin) : gpio(),
MikamiUitOpen 16:cbb726ac20d8 23 gpio_irq(),
MikamiUitOpen 16:cbb726ac20d8 24 _rise(),
MikamiUitOpen 16:cbb726ac20d8 25 _fall() {
MikamiUitOpen 16:cbb726ac20d8 26 gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this);
MikamiUitOpen 16:cbb726ac20d8 27 gpio_init_in(&gpio, pin);
MikamiUitOpen 16:cbb726ac20d8 28 }
MikamiUitOpen 16:cbb726ac20d8 29
MikamiUitOpen 16:cbb726ac20d8 30 InterruptIn::~InterruptIn() {
MikamiUitOpen 16:cbb726ac20d8 31 gpio_irq_free(&gpio_irq);
MikamiUitOpen 16:cbb726ac20d8 32 }
MikamiUitOpen 16:cbb726ac20d8 33
MikamiUitOpen 16:cbb726ac20d8 34 int InterruptIn::read() {
MikamiUitOpen 16:cbb726ac20d8 35 return gpio_read(&gpio);
MikamiUitOpen 16:cbb726ac20d8 36 }
MikamiUitOpen 16:cbb726ac20d8 37
MikamiUitOpen 16:cbb726ac20d8 38 void InterruptIn::mode(PinMode pull) {
MikamiUitOpen 16:cbb726ac20d8 39 gpio_mode(&gpio, pull);
MikamiUitOpen 16:cbb726ac20d8 40 }
MikamiUitOpen 16:cbb726ac20d8 41
MikamiUitOpen 16:cbb726ac20d8 42 void InterruptIn::rise(void (*fptr)(void)) {
MikamiUitOpen 16:cbb726ac20d8 43 if (fptr) {
MikamiUitOpen 16:cbb726ac20d8 44 _rise.attach(fptr);
MikamiUitOpen 16:cbb726ac20d8 45 gpio_irq_set(&gpio_irq, IRQ_RISE, 1);
MikamiUitOpen 16:cbb726ac20d8 46 } else {
MikamiUitOpen 16:cbb726ac20d8 47 _rise.attach(NULL);
MikamiUitOpen 16:cbb726ac20d8 48 gpio_irq_set(&gpio_irq, IRQ_RISE, 0);
MikamiUitOpen 16:cbb726ac20d8 49 }
MikamiUitOpen 16:cbb726ac20d8 50 }
MikamiUitOpen 16:cbb726ac20d8 51
MikamiUitOpen 16:cbb726ac20d8 52 void InterruptIn::fall(void (*fptr)(void)) {
MikamiUitOpen 16:cbb726ac20d8 53 if (fptr) {
MikamiUitOpen 16:cbb726ac20d8 54 _fall.attach(fptr);
MikamiUitOpen 16:cbb726ac20d8 55 gpio_irq_set(&gpio_irq, IRQ_FALL, 1);
MikamiUitOpen 16:cbb726ac20d8 56 } else {
MikamiUitOpen 16:cbb726ac20d8 57 _fall.attach(NULL);
MikamiUitOpen 16:cbb726ac20d8 58 gpio_irq_set(&gpio_irq, IRQ_FALL, 0);
MikamiUitOpen 16:cbb726ac20d8 59 }
MikamiUitOpen 16:cbb726ac20d8 60 }
MikamiUitOpen 16:cbb726ac20d8 61
MikamiUitOpen 16:cbb726ac20d8 62 void InterruptIn::_irq_handler(uint32_t id, gpio_irq_event event) {
MikamiUitOpen 16:cbb726ac20d8 63 InterruptIn *handler = (InterruptIn*)id;
MikamiUitOpen 16:cbb726ac20d8 64 switch (event) {
MikamiUitOpen 16:cbb726ac20d8 65 case IRQ_RISE: handler->_rise.call(); break;
MikamiUitOpen 16:cbb726ac20d8 66 case IRQ_FALL: handler->_fall.call(); break;
MikamiUitOpen 16:cbb726ac20d8 67 case IRQ_NONE: break;
MikamiUitOpen 16:cbb726ac20d8 68 }
MikamiUitOpen 16:cbb726ac20d8 69 }
MikamiUitOpen 16:cbb726ac20d8 70
MikamiUitOpen 16:cbb726ac20d8 71 void InterruptIn::enable_irq() {
MikamiUitOpen 16:cbb726ac20d8 72 gpio_irq_enable(&gpio_irq);
MikamiUitOpen 16:cbb726ac20d8 73 }
MikamiUitOpen 16:cbb726ac20d8 74
MikamiUitOpen 16:cbb726ac20d8 75 void InterruptIn::disable_irq() {
MikamiUitOpen 16:cbb726ac20d8 76 gpio_irq_disable(&gpio_irq);
MikamiUitOpen 16:cbb726ac20d8 77 }
MikamiUitOpen 16:cbb726ac20d8 78
MikamiUitOpen 16:cbb726ac20d8 79 #ifdef MBED_OPERATORS
MikamiUitOpen 16:cbb726ac20d8 80 InterruptIn::operator int() {
MikamiUitOpen 16:cbb726ac20d8 81 return read();
MikamiUitOpen 16:cbb726ac20d8 82 }
MikamiUitOpen 16:cbb726ac20d8 83 #endif
MikamiUitOpen 16:cbb726ac20d8 84
MikamiUitOpen 16:cbb726ac20d8 85 } // namespace mbed
MikamiUitOpen 16:cbb726ac20d8 86
MikamiUitOpen 16:cbb726ac20d8 87 #endif