TLV320_RBSP class, defined on the I2C master bus.

Dependents:   MovPlayer GR-PEACH_Audio_Playback_Sample GR-PEACH_Audio_Playback_7InchLCD_Sample RGA-MJPEG_VideoDemo ... more

Fork of TLV320_RBSP by Daiki Kato

Embed: (wiki syntax)

« Back to documentation index

TLV320_RBSP Class Reference

TLV320_RBSP Class Reference

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

#include <TLV320_RBSP.h>

Public Member Functions

 TLV320_RBSP (PinName cs, PinName sda, PinName scl, PinName sck, PinName ws, PinName tx, PinName rx, uint8_t int_level=0x80, int32_t max_write_num=16, int32_t max_read_num=16)
 Create a TLV320_RBSP object defined on the I2C port.
void power (int device=0x07)
 Overloaded power() function default = 0x80, record requires 0x02.
bool format (char length)
 Set I2S interface bit length and mode.
bool frequency (int hz)
 Set sample frequency.
void reset (void)
 Reset TLV320.
int32_t GetSsifChNo (void)
 Get a value of SSIF channel number.
int write (void *const p_data, uint32_t data_size, const rbsp_data_conf_t *const p_data_conf=NULL)
 Enqueue asynchronous write request.
int read (void *const p_data, uint32_t data_size, const rbsp_data_conf_t *const p_data_conf=NULL)
 Enqueue asynchronous read request.
bool inputVolume (float leftVolumeIn, float rightVolumeIn)
 Line in volume control i.e.
bool outputVolume (float leftVolumeOut, float rightVolumeOut)
 Headphone out volume control.
void bypass (bool bypassVar)
 Analog audio path control (Bypass) function default = false.
void mic (bool micVar)
 Analog audio path control (Input select for ADC) function default = false.
void micVolume (bool mute, bool boost=false)
 Microphone volume.
void mute (bool softMute)
 Digital audio path control.

Detailed Description

TLV320_RBSP class, defined on the I2C master bus.

Definition at line 33 of file TLV320_RBSP.h.


Constructor & Destructor Documentation

TLV320_RBSP ( PinName  cs,
PinName  sda,
PinName  scl,
PinName  sck,
PinName  ws,
PinName  tx,
PinName  rx,
uint8_t  int_level = 0x80,
int32_t  max_write_num = 16,
int32_t  max_read_num = 16 
)

Create a TLV320_RBSP object defined on the I2C port.

Parameters:
csControl port input latch/address select (codec pin)
sdaI2C data line pin
sclI2C clock line pin
sckSSIF serial bit clock
wsSSIF word selection
txSSIF serial data output
rxSSIF serial data input
int_levelInterupt priority (SSIF)
max_write_numThe upper limit of write buffer (SSIF)
max_read_numThe upper limit of read buffer (SSIF)

Definition at line 31 of file TLV320_RBSP.cpp.


Member Function Documentation

void bypass ( bool  bypassVar )

Analog audio path control (Bypass) function default = false.

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

Definition at line 118 of file TLV320_RBSP.cpp.

bool format ( char  length )

Set I2S interface bit length and mode.

Parameters:
lengthSet bit length to 16, 20, 24 or 32 bits
Returns:
true = success, false = failure

Definition at line 174 of file TLV320_RBSP.cpp.

bool frequency ( int  hz )

Set sample frequency.

Parameters:
frequencySample frequency of data in Hz
Returns:
true = success, false = failure

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

Definition at line 203 of file TLV320_RBSP.cpp.

int32_t GetSsifChNo ( void   )

Get a value of SSIF channel number.

Returns:
SSIF channel number

Definition at line 91 of file TLV320_RBSP.h.

bool inputVolume ( float  leftVolumeIn,
float  rightVolumeIn 
)

Line in volume control i.e.

record volume

Parameters:
leftVolumeInLeft line-in volume
rightVolumeInRight line-in volume
Returns:
Returns "true" for success, "false" 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 70 of file TLV320_RBSP.cpp.

void mic ( bool  micVar )

Analog audio path control (Input select for ADC) function default = false.

Parameters:
micVarInput select for ADC. true : Microphone , false : Line

Definition at line 131 of file TLV320_RBSP.cpp.

void micVolume ( bool  mute,
bool  boost = false 
)

Microphone volume.

Parameters:
muteMicrophone mute. true : mute , false : normal
boostMicrophone boost. true : 20dB , false : 0dB

Definition at line 142 of file TLV320_RBSP.cpp.

void mute ( bool  softMute )

Digital audio path control.

Parameters:
softMuteMute output

Definition at line 158 of file TLV320_RBSP.cpp.

bool outputVolume ( float  leftVolumeOut,
float  rightVolumeOut 
)

Headphone out volume control.

Parameters:
leftVolumeOutLeft headphone-out volume
rightVolumeOutRight headphone-out volume
Returns:
Returns "true" for success, "false" 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 94 of file TLV320_RBSP.cpp.

void power ( int  device = 0x07 )

Overloaded power() function default = 0x80, 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 168 of file TLV320_RBSP.cpp.

int read ( void *const   p_data,
uint32_t  data_size,
const rbsp_data_conf_t *const   p_data_conf = NULL 
)

Enqueue asynchronous read request.

Parameters:
p_dataLocation of the data
data_sizeNumber of bytes to read
p_data_confAsynchronous control block structure
Returns:
Number of bytes read on success. negative number on error.

Definition at line 113 of file TLV320_RBSP.h.

void reset ( void   )

Reset TLV320.

Definition at line 256 of file TLV320_RBSP.cpp.

int write ( void *const   p_data,
uint32_t  data_size,
const rbsp_data_conf_t *const   p_data_conf = NULL 
)

Enqueue asynchronous write request.

Parameters:
p_dataLocation of the data
data_sizeNumber of bytes to write
p_data_confAsynchronous control block structure
Returns:
Number of bytes written on success. negative number on error.

Definition at line 102 of file TLV320_RBSP.h.