Audio singal input and output example for DISCO-F746. Input: MEMS mic, Output: CN10 OUT, Acoustic effect: echo and frequency shift. DISCO-F746 によるオーディオ信号入出力.入力:MEMS マイク,出力:CN10 OUT,音響効果:エコー,周波数変換.

Dependencies:   F746_GUI F746_SAI_IO

Committer:
MikamiUitOpen
Date:
Mon Apr 10 13:44:13 2017 +0000
Revision:
10:56f2f01df983
Parent:
6:38f7dce055d0
11

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 6:38f7dce055d0 1 /* mbed Microcontroller Library
MikamiUitOpen 6:38f7dce055d0 2 * Copyright (c) 2006-2013 ARM Limited
MikamiUitOpen 6:38f7dce055d0 3 *
MikamiUitOpen 6:38f7dce055d0 4 * Licensed under the Apache License, Version 2.0 (the "License");
MikamiUitOpen 6:38f7dce055d0 5 * you may not use this file except in compliance with the License.
MikamiUitOpen 6:38f7dce055d0 6 * You may obtain a copy of the License at
MikamiUitOpen 6:38f7dce055d0 7 *
MikamiUitOpen 6:38f7dce055d0 8 * http://www.apache.org/licenses/LICENSE-2.0
MikamiUitOpen 6:38f7dce055d0 9 *
MikamiUitOpen 6:38f7dce055d0 10 * Unless required by applicable law or agreed to in writing, software
MikamiUitOpen 6:38f7dce055d0 11 * distributed under the License is distributed on an "AS IS" BASIS,
MikamiUitOpen 6:38f7dce055d0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MikamiUitOpen 6:38f7dce055d0 13 * See the License for the specific language governing permissions and
MikamiUitOpen 6:38f7dce055d0 14 * limitations under the License.
MikamiUitOpen 6:38f7dce055d0 15 */
MikamiUitOpen 6:38f7dce055d0 16 #ifndef MBED_DIRHANDLE_H
MikamiUitOpen 6:38f7dce055d0 17 #define MBED_DIRHANDLE_H
MikamiUitOpen 6:38f7dce055d0 18
MikamiUitOpen 6:38f7dce055d0 19 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
MikamiUitOpen 6:38f7dce055d0 20 # define NAME_MAX 255
MikamiUitOpen 6:38f7dce055d0 21 typedef int mode_t;
MikamiUitOpen 6:38f7dce055d0 22
MikamiUitOpen 6:38f7dce055d0 23 #else
MikamiUitOpen 6:38f7dce055d0 24 # include <sys/syslimits.h>
MikamiUitOpen 6:38f7dce055d0 25 #endif
MikamiUitOpen 6:38f7dce055d0 26
MikamiUitOpen 6:38f7dce055d0 27 #include "FileHandle.h"
MikamiUitOpen 6:38f7dce055d0 28
MikamiUitOpen 6:38f7dce055d0 29 struct dirent {
MikamiUitOpen 6:38f7dce055d0 30 char d_name[NAME_MAX+1];
MikamiUitOpen 6:38f7dce055d0 31 };
MikamiUitOpen 6:38f7dce055d0 32
MikamiUitOpen 6:38f7dce055d0 33 namespace mbed {
MikamiUitOpen 6:38f7dce055d0 34
MikamiUitOpen 6:38f7dce055d0 35 /** Represents a directory stream. Objects of this type are returned
MikamiUitOpen 6:38f7dce055d0 36 * by a FileSystemLike's opendir method. Implementations must define
MikamiUitOpen 6:38f7dce055d0 37 * at least closedir, readdir and rewinddir.
MikamiUitOpen 6:38f7dce055d0 38 *
MikamiUitOpen 6:38f7dce055d0 39 * If a FileSystemLike class defines the opendir method, then the
MikamiUitOpen 6:38f7dce055d0 40 * directories of an object of that type can be accessed by
MikamiUitOpen 6:38f7dce055d0 41 * DIR *d = opendir("/example/directory") (or opendir("/example")
MikamiUitOpen 6:38f7dce055d0 42 * to open the root of the filesystem), and then using readdir(d) etc.
MikamiUitOpen 6:38f7dce055d0 43 *
MikamiUitOpen 6:38f7dce055d0 44 * The root directory is considered to contain all FileLike and
MikamiUitOpen 6:38f7dce055d0 45 * FileSystemLike objects, so the DIR* returned by opendir("/") will
MikamiUitOpen 6:38f7dce055d0 46 * reflect this.
MikamiUitOpen 6:38f7dce055d0 47 */
MikamiUitOpen 6:38f7dce055d0 48 class DirHandle {
MikamiUitOpen 6:38f7dce055d0 49
MikamiUitOpen 6:38f7dce055d0 50 public:
MikamiUitOpen 6:38f7dce055d0 51 /** Closes the directory.
MikamiUitOpen 6:38f7dce055d0 52 *
MikamiUitOpen 6:38f7dce055d0 53 * @returns
MikamiUitOpen 6:38f7dce055d0 54 * 0 on success,
MikamiUitOpen 6:38f7dce055d0 55 * -1 on error.
MikamiUitOpen 6:38f7dce055d0 56 */
MikamiUitOpen 6:38f7dce055d0 57 virtual int closedir()=0;
MikamiUitOpen 6:38f7dce055d0 58
MikamiUitOpen 6:38f7dce055d0 59 /** Return the directory entry at the current position, and
MikamiUitOpen 6:38f7dce055d0 60 * advances the position to the next entry.
MikamiUitOpen 6:38f7dce055d0 61 *
MikamiUitOpen 6:38f7dce055d0 62 * @returns
MikamiUitOpen 6:38f7dce055d0 63 * A pointer to a dirent structure representing the
MikamiUitOpen 6:38f7dce055d0 64 * directory entry at the current position, or NULL on reaching
MikamiUitOpen 6:38f7dce055d0 65 * end of directory or error.
MikamiUitOpen 6:38f7dce055d0 66 */
MikamiUitOpen 6:38f7dce055d0 67 virtual struct dirent *readdir()=0;
MikamiUitOpen 6:38f7dce055d0 68
MikamiUitOpen 6:38f7dce055d0 69 /** Resets the position to the beginning of the directory.
MikamiUitOpen 6:38f7dce055d0 70 */
MikamiUitOpen 6:38f7dce055d0 71 virtual void rewinddir()=0;
MikamiUitOpen 6:38f7dce055d0 72
MikamiUitOpen 6:38f7dce055d0 73 /** Returns the current position of the DirHandle.
MikamiUitOpen 6:38f7dce055d0 74 *
MikamiUitOpen 6:38f7dce055d0 75 * @returns
MikamiUitOpen 6:38f7dce055d0 76 * the current position,
MikamiUitOpen 6:38f7dce055d0 77 * -1 on error.
MikamiUitOpen 6:38f7dce055d0 78 */
MikamiUitOpen 6:38f7dce055d0 79 virtual off_t telldir() { return -1; }
MikamiUitOpen 6:38f7dce055d0 80
MikamiUitOpen 6:38f7dce055d0 81 /** Sets the position of the DirHandle.
MikamiUitOpen 6:38f7dce055d0 82 *
MikamiUitOpen 6:38f7dce055d0 83 * @param location The location to seek to. Must be a value returned by telldir.
MikamiUitOpen 6:38f7dce055d0 84 */
MikamiUitOpen 6:38f7dce055d0 85 virtual void seekdir(off_t location) { }
MikamiUitOpen 6:38f7dce055d0 86
MikamiUitOpen 6:38f7dce055d0 87 virtual ~DirHandle() {}
MikamiUitOpen 6:38f7dce055d0 88 };
MikamiUitOpen 6:38f7dce055d0 89
MikamiUitOpen 6:38f7dce055d0 90 } // namespace mbed
MikamiUitOpen 6:38f7dce055d0 91
MikamiUitOpen 6:38f7dce055d0 92 typedef mbed::DirHandle DIR;
MikamiUitOpen 6:38f7dce055d0 93
MikamiUitOpen 6:38f7dce055d0 94 extern "C" {
MikamiUitOpen 6:38f7dce055d0 95 DIR *opendir(const char*);
MikamiUitOpen 6:38f7dce055d0 96 struct dirent *readdir(DIR *);
MikamiUitOpen 6:38f7dce055d0 97 int closedir(DIR*);
MikamiUitOpen 6:38f7dce055d0 98 void rewinddir(DIR*);
MikamiUitOpen 6:38f7dce055d0 99 long telldir(DIR*);
MikamiUitOpen 6:38f7dce055d0 100 void seekdir(DIR*, long);
MikamiUitOpen 6:38f7dce055d0 101 int mkdir(const char *name, mode_t n);
MikamiUitOpen 6:38f7dce055d0 102 };
MikamiUitOpen 6:38f7dce055d0 103
MikamiUitOpen 6:38f7dce055d0 104 #endif /* MBED_DIRHANDLE_H */