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
mbed_src_STM32F7/api/RawSerial.h@6:38f7dce055d0, 2016-10-02 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Sun Oct 02 10:44:58 2016 +0000
- Revision:
- 6:38f7dce055d0
7
Who changed what in which revision?
User | Revision | Line number | New 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_RAW_SERIAL_H |
MikamiUitOpen | 6:38f7dce055d0 | 17 | #define MBED_RAW_SERIAL_H |
MikamiUitOpen | 6:38f7dce055d0 | 18 | |
MikamiUitOpen | 6:38f7dce055d0 | 19 | #include "platform.h" |
MikamiUitOpen | 6:38f7dce055d0 | 20 | |
MikamiUitOpen | 6:38f7dce055d0 | 21 | #if DEVICE_SERIAL |
MikamiUitOpen | 6:38f7dce055d0 | 22 | |
MikamiUitOpen | 6:38f7dce055d0 | 23 | #include "SerialBase.h" |
MikamiUitOpen | 6:38f7dce055d0 | 24 | #include "serial_api.h" |
MikamiUitOpen | 6:38f7dce055d0 | 25 | |
MikamiUitOpen | 6:38f7dce055d0 | 26 | namespace mbed { |
MikamiUitOpen | 6:38f7dce055d0 | 27 | |
MikamiUitOpen | 6:38f7dce055d0 | 28 | /** A serial port (UART) for communication with other serial devices |
MikamiUitOpen | 6:38f7dce055d0 | 29 | * This is a variation of the Serial class that doesn't use streams, |
MikamiUitOpen | 6:38f7dce055d0 | 30 | * thus making it safe to use in interrupt handlers with the RTOS. |
MikamiUitOpen | 6:38f7dce055d0 | 31 | * |
MikamiUitOpen | 6:38f7dce055d0 | 32 | * Can be used for Full Duplex communication, or Simplex by specifying |
MikamiUitOpen | 6:38f7dce055d0 | 33 | * one pin as NC (Not Connected) |
MikamiUitOpen | 6:38f7dce055d0 | 34 | * |
MikamiUitOpen | 6:38f7dce055d0 | 35 | * Example: |
MikamiUitOpen | 6:38f7dce055d0 | 36 | * @code |
MikamiUitOpen | 6:38f7dce055d0 | 37 | * // Send a char to the PC |
MikamiUitOpen | 6:38f7dce055d0 | 38 | * |
MikamiUitOpen | 6:38f7dce055d0 | 39 | * #include "mbed.h" |
MikamiUitOpen | 6:38f7dce055d0 | 40 | * |
MikamiUitOpen | 6:38f7dce055d0 | 41 | * RawSerial pc(USBTX, USBRX); |
MikamiUitOpen | 6:38f7dce055d0 | 42 | * |
MikamiUitOpen | 6:38f7dce055d0 | 43 | * int main() { |
MikamiUitOpen | 6:38f7dce055d0 | 44 | * pc.putc('A'); |
MikamiUitOpen | 6:38f7dce055d0 | 45 | * } |
MikamiUitOpen | 6:38f7dce055d0 | 46 | * @endcode |
MikamiUitOpen | 6:38f7dce055d0 | 47 | */ |
MikamiUitOpen | 6:38f7dce055d0 | 48 | class RawSerial: public SerialBase { |
MikamiUitOpen | 6:38f7dce055d0 | 49 | |
MikamiUitOpen | 6:38f7dce055d0 | 50 | public: |
MikamiUitOpen | 6:38f7dce055d0 | 51 | /** Create a RawSerial port, connected to the specified transmit and receive pins |
MikamiUitOpen | 6:38f7dce055d0 | 52 | * |
MikamiUitOpen | 6:38f7dce055d0 | 53 | * @param tx Transmit pin |
MikamiUitOpen | 6:38f7dce055d0 | 54 | * @param rx Receive pin |
MikamiUitOpen | 6:38f7dce055d0 | 55 | * |
MikamiUitOpen | 6:38f7dce055d0 | 56 | * @note |
MikamiUitOpen | 6:38f7dce055d0 | 57 | * Either tx or rx may be specified as NC if unused |
MikamiUitOpen | 6:38f7dce055d0 | 58 | */ |
MikamiUitOpen | 6:38f7dce055d0 | 59 | RawSerial(PinName tx, PinName rx); |
MikamiUitOpen | 6:38f7dce055d0 | 60 | |
MikamiUitOpen | 6:38f7dce055d0 | 61 | /** Write a char to the serial port |
MikamiUitOpen | 6:38f7dce055d0 | 62 | * |
MikamiUitOpen | 6:38f7dce055d0 | 63 | * @param c The char to write |
MikamiUitOpen | 6:38f7dce055d0 | 64 | * |
MikamiUitOpen | 6:38f7dce055d0 | 65 | * @returns The written char or -1 if an error occured |
MikamiUitOpen | 6:38f7dce055d0 | 66 | */ |
MikamiUitOpen | 6:38f7dce055d0 | 67 | int putc(int c); |
MikamiUitOpen | 6:38f7dce055d0 | 68 | |
MikamiUitOpen | 6:38f7dce055d0 | 69 | /** Read a char from the serial port |
MikamiUitOpen | 6:38f7dce055d0 | 70 | * |
MikamiUitOpen | 6:38f7dce055d0 | 71 | * @returns The char read from the serial port |
MikamiUitOpen | 6:38f7dce055d0 | 72 | */ |
MikamiUitOpen | 6:38f7dce055d0 | 73 | int getc(); |
MikamiUitOpen | 6:38f7dce055d0 | 74 | |
MikamiUitOpen | 6:38f7dce055d0 | 75 | /** Write a string to the serial port |
MikamiUitOpen | 6:38f7dce055d0 | 76 | * |
MikamiUitOpen | 6:38f7dce055d0 | 77 | * @param str The string to write |
MikamiUitOpen | 6:38f7dce055d0 | 78 | * |
MikamiUitOpen | 6:38f7dce055d0 | 79 | * @returns 0 if the write succeeds, EOF for error |
MikamiUitOpen | 6:38f7dce055d0 | 80 | */ |
MikamiUitOpen | 6:38f7dce055d0 | 81 | int puts(const char *str); |
MikamiUitOpen | 6:38f7dce055d0 | 82 | |
MikamiUitOpen | 6:38f7dce055d0 | 83 | int printf(const char *format, ...); |
MikamiUitOpen | 6:38f7dce055d0 | 84 | }; |
MikamiUitOpen | 6:38f7dce055d0 | 85 | |
MikamiUitOpen | 6:38f7dce055d0 | 86 | } // namespace mbed |
MikamiUitOpen | 6:38f7dce055d0 | 87 | |
MikamiUitOpen | 6:38f7dce055d0 | 88 | #endif |
MikamiUitOpen | 6:38f7dce055d0 | 89 | |
MikamiUitOpen | 6:38f7dce055d0 | 90 | #endif |