Device driver for TI TLV320AIC1110 voice band codec
Work in Progress
TLV320AIC1110.h
- Committer:
- sam_grove
- Date:
- 2013-05-21
- Revision:
- 5:174f94df7624
- Parent:
- 4:470f89e786f9
File content as of revision 5:174f94df7624:
/** * @file TLV320AIC1110.h * @brief Device driver - TLV320AIC1110 CODEC * @author sam grove * @version 1.0 * @see http://www.ti.com/product/tlv320aic1110 * * Copyright (c) 2013 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TLV320AIC1110_H #define TLV320AIC1110_H #include "mbed.h" /** Using the TI TLV320AIC1110 audio CODEC * * Example: * @code * @endcode */ /** * @class TLV320AIC1110 * @brief API abstraction for the TLV320AIC1110 audio CODEC */ class TLV320AIC1110 { private: I2C *_i2c; /** * @enum TLV320AIC1110_REGISTERS * @brief The device register map */ enum TLV320AIC1110_REGISTERS { POWER_CONTROL = 0, MODE_CONTROL, TXPGA, RXPGA, HI_DTMF, LO_DTMF, AUX }; /** * @enum CHANNEL_T * @brief List of channels that can be muted / unmuted */ enum CHANNEL_T { RECEIVE = 0x04, TRANSMIT = 0x40, SIDETONE = 0x80 }; public: /** Create the TLV320AIC1110 object * @param i2c - A defined I2C object */ TLV320AIC1110(I2C &i2c); /** Destroy the TLV320AIC1110 object */ ~TLV320AIC1110(); /** Print register values to the stdio stream */ void regDump(void); /** Initialize the register settings to basic operational settings */ void init(void); /** Direct write access to a device register * @param reg - A register name from the register map enum * @param value - The value to write to the specified register */ void writeRegister(const TLV320AIC1110_REGISTERS reg, const uint8_t value); /** Read the contents from a specific register * @param reg - A register name from the register map enum */ uint8_t readRegister(const uint8_t reg); /** Mute an audio stream - bit mapped enum values so multiple can be "or'd" and passed * @param ch - A channel name from the channel access enum */ void mute(const CHANNEL_T ch); /** Un-mute an audio stream - bit mapped enum values so multiple can be "or'd" and passed * @param ch - A channel name from the channel access enum */ void unmute(const CHANNEL_T ch); /** Adjust the gain applied to the transmit audio stream * @param gain - Adjustable from 20dB to 42dB in 2dB steps (passed as 20 ... 42) */ uint32_t txGain(const uint8_t gain); /** Adjust the local sidetone * @param gain - Adjustable from -12dB to -24dB in 2dB steps (passed as -12 ... -24) */ uint32_t sidetoneGain(const int8_t gain); /** Adjust the gain applied to the receive audio stream * @param gain - Adjustable from 6dB to -6dB in 1dB steps (passed as 6 ... -6) */ uint32_t rxGain(const int8_t gain); /** Adjust the volume of the EARxOP outputs that drive speakers or line outputs * @param gain - Adjustable from 0dB to -18dB in 2dB steps (passed as 0 ... -18) */ uint32_t rxVolume(const int8_t gain); }; #endif