Production Test Program (PTP) for the LPC4088 Experiment Base Board
Dependencies: EALib I2S LM75B SDFileSystem mbed
WM8731.h@0:0d5190d379d3, 2014-08-25 (annotated)
- Committer:
- embeddedartists
- Date:
- Mon Aug 25 13:15:27 2014 +0000
- Revision:
- 0:0d5190d379d3
- Child:
- 3:7ef908e84ae1
Baseline for PTP (production test program) for the LPC4088 QSB + Experiment Base Board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:0d5190d379d3 | 1 | /* |
embeddedartists | 0:0d5190d379d3 | 2 | * Copyright 2013 Embedded Artists AB |
embeddedartists | 0:0d5190d379d3 | 3 | * |
embeddedartists | 0:0d5190d379d3 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
embeddedartists | 0:0d5190d379d3 | 5 | * you may not use this file except in compliance with the License. |
embeddedartists | 0:0d5190d379d3 | 6 | * You may obtain a copy of the License at |
embeddedartists | 0:0d5190d379d3 | 7 | * |
embeddedartists | 0:0d5190d379d3 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
embeddedartists | 0:0d5190d379d3 | 9 | * |
embeddedartists | 0:0d5190d379d3 | 10 | * Unless required by applicable law or agreed to in writing, software |
embeddedartists | 0:0d5190d379d3 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
embeddedartists | 0:0d5190d379d3 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
embeddedartists | 0:0d5190d379d3 | 13 | * See the License for the specific language governing permissions and |
embeddedartists | 0:0d5190d379d3 | 14 | * limitations under the License. |
embeddedartists | 0:0d5190d379d3 | 15 | */ |
embeddedartists | 0:0d5190d379d3 | 16 | |
embeddedartists | 0:0d5190d379d3 | 17 | #ifndef WM8731_H |
embeddedartists | 0:0d5190d379d3 | 18 | #define WM8731_H |
embeddedartists | 0:0d5190d379d3 | 19 | |
embeddedartists | 0:0d5190d379d3 | 20 | |
embeddedartists | 0:0d5190d379d3 | 21 | /** |
embeddedartists | 0:0d5190d379d3 | 22 | * Wolfson Mgiroelectronics Audio Codec WM8731. |
embeddedartists | 0:0d5190d379d3 | 23 | */ |
embeddedartists | 0:0d5190d379d3 | 24 | class WM8731 { |
embeddedartists | 0:0d5190d379d3 | 25 | public: |
embeddedartists | 0:0d5190d379d3 | 26 | |
embeddedartists | 0:0d5190d379d3 | 27 | /** Registers */ |
embeddedartists | 0:0d5190d379d3 | 28 | enum Register { |
embeddedartists | 0:0d5190d379d3 | 29 | REG_R0_LEFT_LINE_IN = 0x00, |
embeddedartists | 0:0d5190d379d3 | 30 | REG_R1_RIGHT_LINE_IN = 0x01, |
embeddedartists | 0:0d5190d379d3 | 31 | REG_R2_LEFT_HP_OUT = 0x02, |
embeddedartists | 0:0d5190d379d3 | 32 | REG_R3_RIGHT_HP_OUT = 0x03, |
embeddedartists | 0:0d5190d379d3 | 33 | REG_R4_ANALOGUE_AUDIO_PATH_CONTROL = 0x04, |
embeddedartists | 0:0d5190d379d3 | 34 | REG_R5_DIGITAL_AUDIO_PATH_CONTROL = 0x05, |
embeddedartists | 0:0d5190d379d3 | 35 | REG_R6_POWER_DOWN_CONTROL = 0x06, |
embeddedartists | 0:0d5190d379d3 | 36 | REG_R7_DIGITAL_AUDIO_INTERFACE_FORMAT = 0x07, |
embeddedartists | 0:0d5190d379d3 | 37 | REG_R8_SAMPLING_CONTROL = 0x08, |
embeddedartists | 0:0d5190d379d3 | 38 | REG_R9_ACTIVE_CONTROL = 0x09, |
embeddedartists | 0:0d5190d379d3 | 39 | REG_R15_RESET = 0x0f |
embeddedartists | 0:0d5190d379d3 | 40 | }; |
embeddedartists | 0:0d5190d379d3 | 41 | |
embeddedartists | 0:0d5190d379d3 | 42 | /** |
embeddedartists | 0:0d5190d379d3 | 43 | * Create an interface to the WM8731 accelerometer |
embeddedartists | 0:0d5190d379d3 | 44 | * |
embeddedartists | 0:0d5190d379d3 | 45 | * @param sda I2C data line pin |
embeddedartists | 0:0d5190d379d3 | 46 | * @param scl I2C clock line pin |
embeddedartists | 0:0d5190d379d3 | 47 | */ |
embeddedartists | 0:0d5190d379d3 | 48 | WM8731(PinName sda, PinName scl); |
embeddedartists | 0:0d5190d379d3 | 49 | |
embeddedartists | 0:0d5190d379d3 | 50 | /** |
embeddedartists | 0:0d5190d379d3 | 51 | * Write data to the specified address. |
embeddedartists | 0:0d5190d379d3 | 52 | * |
embeddedartists | 0:0d5190d379d3 | 53 | * @param reg register to write to |
embeddedartists | 0:0d5190d379d3 | 54 | * @param data data to write |
embeddedartists | 0:0d5190d379d3 | 55 | * |
embeddedartists | 0:0d5190d379d3 | 56 | * @return true if command was successful; otherwise false |
embeddedartists | 0:0d5190d379d3 | 57 | */ |
embeddedartists | 0:0d5190d379d3 | 58 | bool writeCmd(Register reg, uint16_t data); |
embeddedartists | 0:0d5190d379d3 | 59 | |
embeddedartists | 0:0d5190d379d3 | 60 | private: |
embeddedartists | 0:0d5190d379d3 | 61 | |
embeddedartists | 0:0d5190d379d3 | 62 | I2C _i2c; |
embeddedartists | 0:0d5190d379d3 | 63 | }; |
embeddedartists | 0:0d5190d379d3 | 64 | |
embeddedartists | 0:0d5190d379d3 | 65 | #endif |
embeddedartists | 0:0d5190d379d3 | 66 | |
embeddedartists | 0:0d5190d379d3 | 67 |