Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

I2S Public Functions

I2S Public Functions
[I2S]

Functions

void I2S_Init (LPC_I2S_TypeDef *I2Sx)
 Initialize I2S

  • Turn on power and clock.

void I2S_Config (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode, I2S_CFG_Type *ConfigStruct)
 Configuration I2S, setting:

  • master/slave mode
  • wordwidth value
  • channel mode.

void I2S_DeInit (LPC_I2S_TypeDef *I2Sx)
 DeInitial both I2S transmit or receive.
uint8_t I2S_GetLevel (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode)
 Get I2S Buffer Level.
void I2S_Start (LPC_I2S_TypeDef *I2Sx)
 I2S Start: clear all STOP,RESET and MUTE bit, ready to operate.
void I2S_Send (LPC_I2S_TypeDef *I2Sx, uint32_t BufferData)
 I2S Send data.
uint32_t I2S_Receive (LPC_I2S_TypeDef *I2Sx)
 I2S Receive Data.
void I2S_Pause (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode)
 I2S Pause.
void I2S_Mute (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode)
 I2S Mute.
void I2S_Stop (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode)
 I2S Stop.
Status I2S_FreqConfig (LPC_I2S_TypeDef *I2Sx, uint32_t Freq, uint8_t TRMode)
 Set frequency for I2S.
void I2S_SetBitRate (LPC_I2S_TypeDef *I2Sx, uint8_t bitrate, uint8_t TRMode)
 I2S set bitrate.
void I2S_ModeConfig (LPC_I2S_TypeDef *I2Sx, I2S_MODEConf_Type *ModeConfig, uint8_t TRMode)
 Configuration operating mode for I2S.
void I2S_DMAConfig (LPC_I2S_TypeDef *I2Sx, I2S_DMAConf_Type *DMAConfig, uint8_t TRMode)
 Configure DMA operation for I2S.
void I2S_DMACmd (LPC_I2S_TypeDef *I2Sx, uint8_t DMAIndex, uint8_t TRMode, FunctionalState NewState)
 Enable/Disable DMA operation for I2S.
void I2S_IRQConfig (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode, uint8_t level)
 Configure IRQ for I2S.
void I2S_IRQCmd (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode, FunctionalState NewState)
 Enable/Disable IRQ for I2S.
FunctionalState I2S_GetIRQStatus (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode)
 Get I2S interrupt status.
uint8_t I2S_GetIRQDepth (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode)
 Get I2S interrupt depth.

Function Documentation

void I2S_Config ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode,
I2S_CFG_Type ConfigStruct 
)

Configuration I2S, setting:

  • master/slave mode
  • wordwidth value
  • channel mode.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModetransmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
[in]ConfigStructpointer to I2S_CFG_Type structure which will be initialized.
Returns:
none

Definition at line 137 of file lpc17xx_i2s.c.

void I2S_DeInit ( LPC_I2S_TypeDef I2Sx )

DeInitial both I2S transmit or receive.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
Returns:
none

Definition at line 169 of file lpc17xx_i2s.c.

void I2S_DMACmd ( LPC_I2S_TypeDef I2Sx,
uint8_t  DMAIndex,
uint8_t  TRMode,
FunctionalState  NewState 
)

Enable/Disable DMA operation for I2S.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: LPC_I2S
[in]DMAIndexchose what DMA is used, should be:

  • I2S_DMA_1 = 0: DMA1
  • I2S_DMA_2 = 1: DMA2
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
[in]NewStateis new state of DMA operation, should be:

  • ENABLE
  • DISABLE
Returns:
none

Definition at line 519 of file lpc17xx_i2s.c.

void I2S_DMAConfig ( LPC_I2S_TypeDef I2Sx,
I2S_DMAConf_Type DMAConfig,
uint8_t  TRMode 
)

Configure DMA operation for I2S.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]DMAConfigpointer to I2S_DMAConf_Type will be used to configure
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
none

Definition at line 482 of file lpc17xx_i2s.c.

Status I2S_FreqConfig ( LPC_I2S_TypeDef I2Sx,
uint32_t  Freq,
uint8_t  TRMode 
)

Set frequency for I2S.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]Freqis the frequency for I2S will be set. It can range from 16-96 kHz(16, 22.05, 32, 44.1, 48, 96kHz)
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
Status: ERROR or SUCCESS

Definition at line 314 of file lpc17xx_i2s.c.

uint8_t I2S_GetIRQDepth ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode 
)

Get I2S interrupt depth.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
depth of FIFO level on which to create an irq request

Definition at line 632 of file lpc17xx_i2s.c.

FunctionalState I2S_GetIRQStatus ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode 
)

Get I2S interrupt status.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
FunctionState should be:
  • ENABLE: interrupt is enable
  • DISABLE: interrupt is disable

Definition at line 615 of file lpc17xx_i2s.c.

uint8_t I2S_GetLevel ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode 
)

Get I2S Buffer Level.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModeTransmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
current level of Transmit/Receive Buffer

Definition at line 184 of file lpc17xx_i2s.c.

void I2S_Init ( LPC_I2S_TypeDef I2Sx )

Initialize I2S

  • Turn on power and clock.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
Returns:
none

Definition at line 116 of file lpc17xx_i2s.c.

void I2S_IRQCmd ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode,
FunctionalState  NewState 
)

Enable/Disable IRQ for I2S.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
[in]NewStateis new state of DMA operation, should be:

  • ENABLE
  • DISABLE
Returns:
none

Definition at line 586 of file lpc17xx_i2s.c.

void I2S_IRQConfig ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode,
uint8_t  level 
)

Configure IRQ for I2S.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
[in]levelis the FIFO level that triggers IRQ request
Returns:
none

Definition at line 563 of file lpc17xx_i2s.c.

void I2S_ModeConfig ( LPC_I2S_TypeDef I2Sx,
I2S_MODEConf_Type ModeConfig,
uint8_t  TRMode 
)

Configuration operating mode for I2S.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]ModeConfigpointer to I2S_MODEConf_Type will be used to configure
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
none

Definition at line 439 of file lpc17xx_i2s.c.

void I2S_Mute ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode 
)

I2S Mute.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
none

Definition at line 267 of file lpc17xx_i2s.c.

void I2S_Pause ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode 
)

I2S Pause.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
none

Definition at line 246 of file lpc17xx_i2s.c.

uint32_t I2S_Receive ( LPC_I2S_TypeDef I2Sx )

I2S Receive Data.

Parameters:
[in]I2Sxpointer to LPC_I2S_TypeDef
Returns:
received value

Definition at line 231 of file lpc17xx_i2s.c.

void I2S_Send ( LPC_I2S_TypeDef I2Sx,
uint32_t  BufferData 
)

I2S Send data.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]BufferDatapointer to uint32_t is the data will be send
Returns:
none

Definition at line 220 of file lpc17xx_i2s.c.

void I2S_SetBitRate ( LPC_I2S_TypeDef I2Sx,
uint8_t  bitrate,
uint8_t  TRMode 
)

I2S set bitrate.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]bitratevalue will be set, it can be calculate as follows: bitrate = channel * wordwidth - 1 bitrate value should be in range: 0 .. 63
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
none

Definition at line 413 of file lpc17xx_i2s.c.

void I2S_Start ( LPC_I2S_TypeDef I2Sx )

I2S Start: clear all STOP,RESET and MUTE bit, ready to operate.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
Returns:
none

Definition at line 204 of file lpc17xx_i2s.c.

void I2S_Stop ( LPC_I2S_TypeDef I2Sx,
uint8_t  TRMode 
)

I2S Stop.

Parameters:
[in]I2SxI2S peripheral selected, should be: LPC_I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE = 0: transmit mode
  • I2S_RX_MODE = 1: receive mode
Returns:
none

Definition at line 288 of file lpc17xx_i2s.c.