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 #ifndef MBED_TICKER_H
MikamiUitOpen 16:cbb726ac20d8 17 #define MBED_TICKER_H
MikamiUitOpen 16:cbb726ac20d8 18
MikamiUitOpen 16:cbb726ac20d8 19 #include "TimerEvent.h"
MikamiUitOpen 16:cbb726ac20d8 20 #include "FunctionPointer.h"
MikamiUitOpen 16:cbb726ac20d8 21
MikamiUitOpen 16:cbb726ac20d8 22 namespace mbed {
MikamiUitOpen 16:cbb726ac20d8 23
MikamiUitOpen 16:cbb726ac20d8 24 /** A Ticker is used to call a function at a recurring interval
MikamiUitOpen 16:cbb726ac20d8 25 *
MikamiUitOpen 16:cbb726ac20d8 26 * You can use as many seperate Ticker objects as you require.
MikamiUitOpen 16:cbb726ac20d8 27 *
MikamiUitOpen 16:cbb726ac20d8 28 * Example:
MikamiUitOpen 16:cbb726ac20d8 29 * @code
MikamiUitOpen 16:cbb726ac20d8 30 * // Toggle the blinking led after 5 seconds
MikamiUitOpen 16:cbb726ac20d8 31 *
MikamiUitOpen 16:cbb726ac20d8 32 * #include "mbed.h"
MikamiUitOpen 16:cbb726ac20d8 33 *
MikamiUitOpen 16:cbb726ac20d8 34 * Ticker timer;
MikamiUitOpen 16:cbb726ac20d8 35 * DigitalOut led1(LED1);
MikamiUitOpen 16:cbb726ac20d8 36 * DigitalOut led2(LED2);
MikamiUitOpen 16:cbb726ac20d8 37 *
MikamiUitOpen 16:cbb726ac20d8 38 * int flip = 0;
MikamiUitOpen 16:cbb726ac20d8 39 *
MikamiUitOpen 16:cbb726ac20d8 40 * void attime() {
MikamiUitOpen 16:cbb726ac20d8 41 * flip = !flip;
MikamiUitOpen 16:cbb726ac20d8 42 * }
MikamiUitOpen 16:cbb726ac20d8 43 *
MikamiUitOpen 16:cbb726ac20d8 44 * int main() {
MikamiUitOpen 16:cbb726ac20d8 45 * timer.attach(&attime, 5);
MikamiUitOpen 16:cbb726ac20d8 46 * while(1) {
MikamiUitOpen 16:cbb726ac20d8 47 * if(flip == 0) {
MikamiUitOpen 16:cbb726ac20d8 48 * led1 = !led1;
MikamiUitOpen 16:cbb726ac20d8 49 * } else {
MikamiUitOpen 16:cbb726ac20d8 50 * led2 = !led2;
MikamiUitOpen 16:cbb726ac20d8 51 * }
MikamiUitOpen 16:cbb726ac20d8 52 * wait(0.2);
MikamiUitOpen 16:cbb726ac20d8 53 * }
MikamiUitOpen 16:cbb726ac20d8 54 * }
MikamiUitOpen 16:cbb726ac20d8 55 * @endcode
MikamiUitOpen 16:cbb726ac20d8 56 */
MikamiUitOpen 16:cbb726ac20d8 57 class Ticker : public TimerEvent {
MikamiUitOpen 16:cbb726ac20d8 58
MikamiUitOpen 16:cbb726ac20d8 59 public:
MikamiUitOpen 16:cbb726ac20d8 60 Ticker() : TimerEvent() {
MikamiUitOpen 16:cbb726ac20d8 61 }
MikamiUitOpen 16:cbb726ac20d8 62
MikamiUitOpen 16:cbb726ac20d8 63 Ticker(const ticker_data_t *data) : TimerEvent(data) {
MikamiUitOpen 16:cbb726ac20d8 64 }
MikamiUitOpen 16:cbb726ac20d8 65
MikamiUitOpen 16:cbb726ac20d8 66 /** Attach a function to be called by the Ticker, specifiying the interval in seconds
MikamiUitOpen 16:cbb726ac20d8 67 *
MikamiUitOpen 16:cbb726ac20d8 68 * @param fptr pointer to the function to be called
MikamiUitOpen 16:cbb726ac20d8 69 * @param t the time between calls in seconds
MikamiUitOpen 16:cbb726ac20d8 70 */
MikamiUitOpen 16:cbb726ac20d8 71 void attach(void (*fptr)(void), float t) {
MikamiUitOpen 16:cbb726ac20d8 72 attach_us(fptr, t * 1000000.0f);
MikamiUitOpen 16:cbb726ac20d8 73 }
MikamiUitOpen 16:cbb726ac20d8 74
MikamiUitOpen 16:cbb726ac20d8 75 /** Attach a member function to be called by the Ticker, specifiying the interval in seconds
MikamiUitOpen 16:cbb726ac20d8 76 *
MikamiUitOpen 16:cbb726ac20d8 77 * @param tptr pointer to the object to call the member function on
MikamiUitOpen 16:cbb726ac20d8 78 * @param mptr pointer to the member function to be called
MikamiUitOpen 16:cbb726ac20d8 79 * @param t the time between calls in seconds
MikamiUitOpen 16:cbb726ac20d8 80 */
MikamiUitOpen 16:cbb726ac20d8 81 template<typename T>
MikamiUitOpen 16:cbb726ac20d8 82 void attach(T* tptr, void (T::*mptr)(void), float t) {
MikamiUitOpen 16:cbb726ac20d8 83 attach_us(tptr, mptr, t * 1000000.0f);
MikamiUitOpen 16:cbb726ac20d8 84 }
MikamiUitOpen 16:cbb726ac20d8 85
MikamiUitOpen 16:cbb726ac20d8 86 /** Attach a function to be called by the Ticker, specifiying the interval in micro-seconds
MikamiUitOpen 16:cbb726ac20d8 87 *
MikamiUitOpen 16:cbb726ac20d8 88 * @param fptr pointer to the function to be called
MikamiUitOpen 16:cbb726ac20d8 89 * @param t the time between calls in micro-seconds
MikamiUitOpen 16:cbb726ac20d8 90 */
MikamiUitOpen 16:cbb726ac20d8 91 void attach_us(void (*fptr)(void), timestamp_t t) {
MikamiUitOpen 16:cbb726ac20d8 92 _function.attach(fptr);
MikamiUitOpen 16:cbb726ac20d8 93 setup(t);
MikamiUitOpen 16:cbb726ac20d8 94 }
MikamiUitOpen 16:cbb726ac20d8 95
MikamiUitOpen 16:cbb726ac20d8 96 /** Attach a member function to be called by the Ticker, specifiying the interval in micro-seconds
MikamiUitOpen 16:cbb726ac20d8 97 *
MikamiUitOpen 16:cbb726ac20d8 98 * @param tptr pointer to the object to call the member function on
MikamiUitOpen 16:cbb726ac20d8 99 * @param mptr pointer to the member function to be called
MikamiUitOpen 16:cbb726ac20d8 100 * @param t the time between calls in micro-seconds
MikamiUitOpen 16:cbb726ac20d8 101 */
MikamiUitOpen 16:cbb726ac20d8 102 template<typename T>
MikamiUitOpen 16:cbb726ac20d8 103 void attach_us(T* tptr, void (T::*mptr)(void), timestamp_t t) {
MikamiUitOpen 16:cbb726ac20d8 104 _function.attach(tptr, mptr);
MikamiUitOpen 16:cbb726ac20d8 105 setup(t);
MikamiUitOpen 16:cbb726ac20d8 106 }
MikamiUitOpen 16:cbb726ac20d8 107
MikamiUitOpen 16:cbb726ac20d8 108 virtual ~Ticker() {
MikamiUitOpen 16:cbb726ac20d8 109 detach();
MikamiUitOpen 16:cbb726ac20d8 110 }
MikamiUitOpen 16:cbb726ac20d8 111
MikamiUitOpen 16:cbb726ac20d8 112 /** Detach the function
MikamiUitOpen 16:cbb726ac20d8 113 */
MikamiUitOpen 16:cbb726ac20d8 114 void detach();
MikamiUitOpen 16:cbb726ac20d8 115
MikamiUitOpen 16:cbb726ac20d8 116 protected:
MikamiUitOpen 16:cbb726ac20d8 117 void setup(timestamp_t t);
MikamiUitOpen 16:cbb726ac20d8 118 virtual void handler();
MikamiUitOpen 16:cbb726ac20d8 119
MikamiUitOpen 16:cbb726ac20d8 120 protected:
MikamiUitOpen 16:cbb726ac20d8 121 timestamp_t _delay; /**< Time delay (in microseconds) for re-setting the multi-shot callback. */
MikamiUitOpen 16:cbb726ac20d8 122 FunctionPointer _function; /**< Callback. */
MikamiUitOpen 16:cbb726ac20d8 123 };
MikamiUitOpen 16:cbb726ac20d8 124
MikamiUitOpen 16:cbb726ac20d8 125 } // namespace mbed
MikamiUitOpen 16:cbb726ac20d8 126
MikamiUitOpen 16:cbb726ac20d8 127 #endif