EmbeddedArtists AB / Mbed 2 deprecated lpc4088_ebb_ptp

Dependencies:   EALib I2S LM75B SDFileSystem mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TestAudio.h Source File

TestAudio.h

00001 /*
00002  *  Copyright 2013 Embedded Artists AB
00003  *
00004  *  Licensed under the Apache License, Version 2.0 (the "License");
00005  *  you may not use this file except in compliance with the License.
00006  *  You may obtain a copy of the License at
00007  *
00008  *    http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *  Unless required by applicable law or agreed to in writing, software
00011  *  distributed under the License is distributed on an "AS IS" BASIS,
00012  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *  See the License for the specific language governing permissions and
00014  *  limitations under the License.
00015  */
00016 
00017 #ifndef TESTAUDIO_H
00018 #define TESTAUDIO_H
00019 
00020 #include "WM8731.h"
00021 #include "I2S.h"
00022 
00023 #define ECHOLENGTH 12000
00024 
00025 
00026 /**
00027  * Test the WM8731 audio codec and the audio connectors on 
00028  * the LPC4088 Experiment Base Board
00029  */
00030 class TestAudio {
00031 public:
00032 
00033     /**
00034      * Create an interface to the audio codec
00035      */
00036     TestAudio();
00037 
00038     /**
00039      * Test the audio
00040      *
00041      * @return true if the test was successful; otherwise false
00042      */
00043     bool runTest();
00044 
00045 private:
00046 
00047     /**
00048      * Callback function for I2S
00049      */
00050     void echo(void);
00051 
00052     WM8731 _codec;
00053     I2S _i2sTx;
00054     I2S _i2sRx;
00055     AnalogIn _aIn;
00056 
00057     int _waveIdx;
00058     int _echoBufPtr;
00059     int _echoBuf[ECHOLENGTH];
00060     int _txBuf[16];
00061     int _rxBuf[16];
00062 };
00063 
00064 #endif
00065