Production Test Program (PTP) for the LPC4088 Experiment Base Board
Dependencies: EALib I2S LM75B SDFileSystem mbed
TestAudio.h@3:7ef908e84ae1, 2014-09-08 (annotated)
- Committer:
- embeddedartists
- Date:
- Mon Sep 08 11:34:53 2014 +0000
- Revision:
- 3:7ef908e84ae1
- Parent:
- 2:2f4b7535ceb3
Added audio test. Shortened RGB LED startup sequence and added message for user when uSD card not inserted to explain the long delay.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 2:2f4b7535ceb3 | 1 | /* |
embeddedartists | 2:2f4b7535ceb3 | 2 | * Copyright 2013 Embedded Artists AB |
embeddedartists | 2:2f4b7535ceb3 | 3 | * |
embeddedartists | 2:2f4b7535ceb3 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
embeddedartists | 2:2f4b7535ceb3 | 5 | * you may not use this file except in compliance with the License. |
embeddedartists | 2:2f4b7535ceb3 | 6 | * You may obtain a copy of the License at |
embeddedartists | 2:2f4b7535ceb3 | 7 | * |
embeddedartists | 2:2f4b7535ceb3 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
embeddedartists | 2:2f4b7535ceb3 | 9 | * |
embeddedartists | 2:2f4b7535ceb3 | 10 | * Unless required by applicable law or agreed to in writing, software |
embeddedartists | 2:2f4b7535ceb3 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
embeddedartists | 2:2f4b7535ceb3 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
embeddedartists | 2:2f4b7535ceb3 | 13 | * See the License for the specific language governing permissions and |
embeddedartists | 2:2f4b7535ceb3 | 14 | * limitations under the License. |
embeddedartists | 2:2f4b7535ceb3 | 15 | */ |
embeddedartists | 2:2f4b7535ceb3 | 16 | |
embeddedartists | 2:2f4b7535ceb3 | 17 | #ifndef TESTAUDIO_H |
embeddedartists | 2:2f4b7535ceb3 | 18 | #define TESTAUDIO_H |
embeddedartists | 2:2f4b7535ceb3 | 19 | |
embeddedartists | 3:7ef908e84ae1 | 20 | #include "WM8731.h" |
embeddedartists | 3:7ef908e84ae1 | 21 | #include "I2S.h" |
embeddedartists | 3:7ef908e84ae1 | 22 | |
embeddedartists | 3:7ef908e84ae1 | 23 | #define ECHOLENGTH 12000 |
embeddedartists | 3:7ef908e84ae1 | 24 | |
embeddedartists | 2:2f4b7535ceb3 | 25 | |
embeddedartists | 2:2f4b7535ceb3 | 26 | /** |
embeddedartists | 2:2f4b7535ceb3 | 27 | * Test the WM8731 audio codec and the audio connectors on |
embeddedartists | 2:2f4b7535ceb3 | 28 | * the LPC4088 Experiment Base Board |
embeddedartists | 2:2f4b7535ceb3 | 29 | */ |
embeddedartists | 2:2f4b7535ceb3 | 30 | class TestAudio { |
embeddedartists | 2:2f4b7535ceb3 | 31 | public: |
embeddedartists | 2:2f4b7535ceb3 | 32 | |
embeddedartists | 2:2f4b7535ceb3 | 33 | /** |
embeddedartists | 3:7ef908e84ae1 | 34 | * Create an interface to the audio codec |
embeddedartists | 3:7ef908e84ae1 | 35 | */ |
embeddedartists | 3:7ef908e84ae1 | 36 | TestAudio(); |
embeddedartists | 3:7ef908e84ae1 | 37 | |
embeddedartists | 3:7ef908e84ae1 | 38 | /** |
embeddedartists | 2:2f4b7535ceb3 | 39 | * Test the audio |
embeddedartists | 2:2f4b7535ceb3 | 40 | * |
embeddedartists | 2:2f4b7535ceb3 | 41 | * @return true if the test was successful; otherwise false |
embeddedartists | 2:2f4b7535ceb3 | 42 | */ |
embeddedartists | 2:2f4b7535ceb3 | 43 | bool runTest(); |
embeddedartists | 2:2f4b7535ceb3 | 44 | |
embeddedartists | 2:2f4b7535ceb3 | 45 | private: |
embeddedartists | 2:2f4b7535ceb3 | 46 | |
embeddedartists | 3:7ef908e84ae1 | 47 | /** |
embeddedartists | 3:7ef908e84ae1 | 48 | * Callback function for I2S |
embeddedartists | 3:7ef908e84ae1 | 49 | */ |
embeddedartists | 3:7ef908e84ae1 | 50 | void echo(void); |
embeddedartists | 3:7ef908e84ae1 | 51 | |
embeddedartists | 3:7ef908e84ae1 | 52 | WM8731 _codec; |
embeddedartists | 3:7ef908e84ae1 | 53 | I2S _i2sTx; |
embeddedartists | 3:7ef908e84ae1 | 54 | I2S _i2sRx; |
embeddedartists | 3:7ef908e84ae1 | 55 | AnalogIn _aIn; |
embeddedartists | 3:7ef908e84ae1 | 56 | |
embeddedartists | 3:7ef908e84ae1 | 57 | int _waveIdx; |
embeddedartists | 3:7ef908e84ae1 | 58 | int _echoBufPtr; |
embeddedartists | 3:7ef908e84ae1 | 59 | int _echoBuf[ECHOLENGTH]; |
embeddedartists | 3:7ef908e84ae1 | 60 | int _txBuf[16]; |
embeddedartists | 3:7ef908e84ae1 | 61 | int _rxBuf[16]; |
embeddedartists | 2:2f4b7535ceb3 | 62 | }; |
embeddedartists | 2:2f4b7535ceb3 | 63 | |
embeddedartists | 2:2f4b7535ceb3 | 64 | #endif |
embeddedartists | 2:2f4b7535ceb3 | 65 |