This is an I2S library to allow people to take advantage of the I2S peripheral on the LPC1768. Ideally it will be included in future releases of the mbed.h file.

Embed: (wiki syntax)

« Back to documentation index

I2S Class Reference

I2S Class Reference

An I2S class It uses the I2S peripheral of the LPC1768. More...

#include <I2S.h>

Public Member Functions

 I2S (PinName, PinName, PinName, PinName, PinName, PinName)
 Creates an I2S object to control the I2S peripheral.
 ~I2S ()
 Destructs the I2S object and turns off the I2S peripheral.
void setClocks (uint8_t x, uint8_t y, uint8_t divider)
 Sets up the clocks for the I2S peripheral.
void setTx (uint16_t resolution, uint16_t rate, bool stereo)
 Sets the bit clock and word clocks for the channels.
void muteTx (void)
 Mutes or unmutes the transmit I2S channel.
void muteRx (void)
 Mutes or unmutes the receive I2S channel.
void resetTx (void)
 Resets the transmit I2S channel.
void resetRx (void)
 Resets the receive I2S channel.
void setTxMode (uint8_t mode)
 Sets the I2S mode of the transmit channel.
void setRxMode (uint8_t mode)
 Sets the I2S mode of the receive channel.
void setIRQ (bool rxInterrupt, bool txInterrupt, uint8_t rxDepth, uint8_t txDepth)
 Sets up the Interrupt Requests.
void setDMA1 (bool rxDMA, bool txDMA, uint8_t rxDepth, uint8_t txDepth)
 Sets up the DMA requests.

Detailed Description

An I2S class It uses the I2S peripheral of the LPC1768.

Author:
Pinski1 More details about the function goes here

An example:

 #include "I2S.h"
 #include "mbed.h"
 
 I2S audioInterface (p7, p6, p5, p30, p29, p8);

 void main()
 {
        audioInterface.setClocks(,,,);
        audioInterface.setTx(32,9600000,true);
        audioInterface.setRx(32,9600000,true);

        // now print out registers out to prove it's set up correctly
 
 
 
 
 
 
 
 
 
 }

Definition at line 37 of file I2S.h.


Constructor & Destructor Documentation

I2S ( PinName  bitTx = p7,
PinName  wdTx = p6,
PinName  daTx = p5,
PinName  bitRx = p30,
PinName  wdRx = p29,
PinName  daRx = p8 
)

Creates an I2S object to control the I2S peripheral.

Parameters:
bitTxThe bit clock pin used for transmitting I2S.
wdTxThe word clock pin used for transmitting I2S.
daTxThe data pin used for transmitting I2S.
bitRxThe bit clock pin used for recieving I2S.
wdRxThe word clock pin used for recieving I2S.
daRxThe data clock pin used for recieving I2S.

Definition at line 7 of file I2S.cpp.

~I2S (  )

Destructs the I2S object and turns off the I2S peripheral.

Definition at line 47 of file I2S.cpp.


Member Function Documentation

void muteRx ( void   )

Mutes or unmutes the receive I2S channel.

Definition at line 109 of file I2S.cpp.

void muteTx ( void   )

Mutes or unmutes the transmit I2S channel.

Definition at line 102 of file I2S.cpp.

void resetRx ( void   )

Resets the receive I2S channel.

Definition at line 122 of file I2S.cpp.

void resetTx ( void   )

Resets the transmit I2S channel.

Definition at line 116 of file I2S.cpp.

void setClocks ( uint8_t  x,
uint8_t  y,
uint8_t  divider 
)

Sets up the clocks for the I2S peripheral.

Currents sets up both recieve and transmit channels identically.

Parameters:
xThe X divider for the perphieral clock which sets the I2S master clock.
yThe Y divider for the perphieral clock which sets the I2S master clock.
dividerThe CPU clock divider that gives the peripheral clock.

Definition at line 53 of file I2S.cpp.

void setDMA1 ( bool  rxDMA,
bool  txDMA,
uint8_t  rxDepth,
uint8_t  txDepth 
)

Sets up the DMA requests.

Parameters:
rxDMA
txDMA
rxDepth
txDepth
void setIRQ ( bool  rxInterrupt,
bool  txInterrupt,
uint8_t  rxDepth,
uint8_t  txDepth 
)

Sets up the Interrupt Requests.

Parameters:
rxInterrupt
txInterrupt
rxDepth
txDepth
void setRxMode ( uint8_t  mode )

Sets the I2S mode of the receive channel.

Parameters:
modeSets the typical mode.
void setTx ( uint16_t  resolution,
uint16_t  rate,
bool  stereo 
)

Sets the bit clock and word clocks for the channels.

Parameters:
resolutionThe bits per sample (8, 16 or 32).
rateThe samples per second (16kHz to 96kHz).
stereoWhether the stream was stereo or mono.

Definition at line 68 of file I2S.cpp.

void setTxMode ( uint8_t  mode )

Sets the I2S mode of the transmit channel.

Parameters:
modeSets the typical mode.