Library for Texas Instruments TLV320AIC23B hi-def audio chip note: requires I2SSlave abstraction library

Dependents:   playback FTSESpeech i2s_audio_echo i2s_audio_sampler ... more

Embed: (wiki syntax)

« Back to documentation index

TLV320 Class Reference

TLV320 Class Reference

TLV320 class, defined on the I2C master bus. More...

#include <TLV320.h>

Public Member Functions

 TLV320 (PinName sda, PinName scl, int addr, PinName tx_sda, PinName tx_ws, PinName clk, PinName rx_sda, PinName rx_ws)
 Create a TLV320 object defined on the I2C port.
void power (bool powerUp)
 Power up/down.
void power (int device)
 Overloaded power() function default = 0x07, record requires 0x02.
void format (char length, bool mode)
 Set I2S interface bit length and mode.
int frequency (int hz)
 Set sample frequency.
void reset (void)
 Reset TLV320.
void start (int mode)
 Start streaming i.e.
void stop (void)
 Stop streaming i.e.
void write (int *buffer, int from, int length)
 Write [length] 32 bit words in buffer to I2S port.
void read (void)
 Read 4 x (32bit) words into rxBuffer.
void attach (void(*fptr)(void))
 Attach a void/void function or void/void static member function to an interrupt generated by the I2SxxFIFOs.
template<typename T >
void attach (T *tptr, void(T::*mptr)(void))
 Attach a nonstatic void/void member function to an interrupt generated by the I2SxxFIFOs.
int inputVolume (float leftVolumeIn, float rightVolumeIn)
 Line in volume control i.e.
int outputVolume (float leftVolumeOut, float rightVolumeOut)
 Headphone out volume control.
void bypass (bool bypassVar)
 Analog audio path control.
void mute (bool softMute)
 Digital audio path control.

Detailed Description

TLV320 class, defined on the I2C master bus.

Definition at line 41 of file TLV320.h.


Constructor & Destructor Documentation

TLV320 ( PinName  sda,
PinName  scl,
int  addr,
PinName  tx_sda,
PinName  tx_ws,
PinName  clk,
PinName  rx_sda,
PinName  rx_ws 
)

Create a TLV320 object defined on the I2C port.

Parameters:
sdaSerial data pin (p9 or p28)
sclSerial clock pin (p10 or p27)
addrObject address
Author:
Ioannis Kedros, Daniel Worrall

LICENSE

Copyright (c) 2011 mbed

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

DESCRIPTION

Library for Texas instruments TLV320AIC23B library NXP LPC1768

Definition at line 34 of file TLV320.cpp.


Member Function Documentation

void attach ( void(*)(void)  fptr )

Attach a void/void function or void/void static member function to an interrupt generated by the I2SxxFIFOs.

Parameters:
functionFunction to attach

e.g. myTlv320Object.attach(&myfunction); OR myTlv320Object.attach(&myClass::myStaticMemberFunction);

Definition at line 299 of file TLV320.cpp.

void attach ( T *  tptr,
void(T::*)(void)  mptr 
)

Attach a nonstatic void/void member function to an interrupt generated by the I2SxxFIFOs.

Parameters:
tptrObject pointer
mptrMember function pointer

e.g. myTlv320Object.attach(&myObject, &myClass::myNonstaticMemberFunction); where myObject is an object of myClass

Definition at line 125 of file TLV320.h.

void bypass ( bool  bypassVar )

Analog audio path control.

Parameters:
bypassVarRoute analogue audio direct from line in to headphone out

Definition at line 106 of file TLV320.cpp.

void format ( char  length,
bool  mode 
)

Set I2S interface bit length and mode.

Parameters:
lengthSet bit length to 16, 20, 24 or 32 bits
modeSet STEREO (0), MONO (1)

Definition at line 166 of file TLV320.cpp.

int frequency ( int  hz )

Set sample frequency.

Parameters:
frequencySample frequency of data in Hz
Returns:
Returns an integer 0 = success, -1 = unrecognnised frequency

The TLV320 supports the following frequencies: 8kHz, 8.021kHz, 32kHz, 44.1kHz, 48kHz, 88.2kHz, 96kHz Default is 44.1kHz

Definition at line 199 of file TLV320.cpp.

int inputVolume ( float  leftVolumeIn,
float  rightVolumeIn 
)

Line in volume control i.e.

record volume

Parameters:
leftVolumeInLeft line-in volume
rightVolumeInRight line-in volume
Returns:
Returns 0 for success, -1 if parameters are out of range Parameters accept a value, where 0.0 < parameter < 1.0 and where 0.0 maps to -34.5dB and 1.0 maps to +12dB (0.74 = 0 dB default).

Definition at line 56 of file TLV320.cpp.

void mute ( bool  softMute )

Digital audio path control.

Parameters:
softMuteMute output

Definition at line 123 of file TLV320.cpp.

int outputVolume ( float  leftVolumeOut,
float  rightVolumeOut 
)

Headphone out volume control.

Parameters:
leftVolumeOutLeft line-out volume
rightVolumeOutRight line-out volume
Returns:
Returns 0 for success, -1 if parameters are out of range Parameters accept a value, where 0.0 < parameter < 1.0 and where 0.0 maps to -73dB (mute) and 1.0 maps to +6dB (0.5 = default)

Definition at line 81 of file TLV320.cpp.

void power ( int  device )

Overloaded power() function default = 0x07, record requires 0x02.

Parameters:
deviceCall individual devices to power up/down Device power 0x00 = On 0x80 = Off Clock 0x00 = On 0x40 = Off Oscillator 0x00 = On 0x20 = Off Outputs 0x00 = On 0x10 = Off DAC 0x00 = On 0x08 = Off ADC 0x00 = On 0x04 = Off Microphone input 0x00 = On 0x02 = Off Line input 0x00 = On 0x01 = Off

Definition at line 153 of file TLV320.cpp.

void power ( bool  powerUp )

Power up/down.

Parameters:
powerUp0 = power down, 1 = power up

Definition at line 138 of file TLV320.cpp.

void read ( void   )

Read 4 x (32bit) words into rxBuffer.

Definition at line 288 of file TLV320.cpp.

void reset ( void   )

Reset TLV320.

Definition at line 242 of file TLV320.cpp.

void start ( int  mode )

Start streaming i.e.

enable interrupts

Parameters:
modeEnable interrupts for NONE, TRANSMIT only, RECEIVE only, BOTH

Definition at line 255 of file TLV320.cpp.

void stop ( void   )

Stop streaming i.e.

disable all interrupts

Definition at line 266 of file TLV320.cpp.

void write ( int *  buffer,
int  from,
int  length 
)

Write [length] 32 bit words in buffer to I2S port.

Parameters:
*bufferAddress of buffer to be written
fromStart position in buffer to read from
lengthNumber of words to be written (MUST not exceed 4)

Definition at line 277 of file TLV320.cpp.