NXP's driver library for LPC17xx, ported to mbed's online compiler. Not tested! I had to fix a lot of warings and found a couple of pretty obvious bugs, so the chances are there are more. Original: http://ics.nxp.com/support/documents/microcontrollers/zip/lpc17xx.cmsis.driver.library.zip

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
  • Setup I2S pin select.

void I2S_DeInit (LPC_I2S_TypeDef *I2Sx)
 DeInitial both I2S transmit or receive.
void I2S_Config (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode, I2S_CFG_Type *ConfigStruct)
 Configuration I2S, setting:

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

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_Send (LPC_I2S_TypeDef *I2Sx, uint32_t BufferData)
 I2S Send data.
uint32_t I2S_Receive (LPC_I2S_TypeDef *I2Sx)
 I2S Receive Data.
void I2S_Start (LPC_I2S_TypeDef *I2Sx)
 I2S Start: clear all STOP,RESET and MUTE bit, ready to operate.
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.
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, fnI2SCbs_Type *pfnI2SCbs)
 Configure IRQ for I2S.
void I2S_IRQCmd (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode, FunctionalState NewState)
 Enable/Disable IRQ for I2S.
void I2S_IntHandler (void)
 Standard I2S interrupt handler, this function will check all interrupt status of I2S channels, then execute the call back function if they're already installed.
uint8_t I2S_GetLevel (LPC_I2S_TypeDef *I2Sx, uint8_t TRMode)
 Get I2S Buffer Level.

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]I2Sx,:I2S peripheral selected, should be: I2S
[in]TRMode,:transmit/receive mode, should be:

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

Definition at line 152 of file lpc17xx_i2s.c.

void I2S_DeInit ( LPC_I2S_TypeDef *  I2Sx )

DeInitial both I2S transmit or receive.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
Returns:
none

Definition at line 184 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: I2S
[in]DMAIndexchose what DMA is used, should be:

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

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

  • ENABLE
  • DISABLE
Returns:
none

Definition at line 520 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]I2Sx,:I2S peripheral selected, should be: I2S
[in]DMAConfigpointer to I2S_DMAConf_Type will be used to configure
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE: transmit mode
  • I2S_RX_MODE: receive mode
Returns:
none

Definition at line 483 of file lpc17xx_i2s.c.

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

Set frequency for I2S.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: 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: transmit mode
  • I2S_RX_MODE: receive mode
Returns:
Status: ERROR or SUCCESS

Definition at line 326 of file lpc17xx_i2s.c.

uint8_t I2S_GetLevel ( LPC_I2S_TypeDef *  I2Sx,
uint8_t  TRMode 
)

Get I2S Buffer Level.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
[in]TRMode,:Transmit/receive mode, should be:

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

Definition at line 199 of file lpc17xx_i2s.c.

void I2S_Init ( LPC_I2S_TypeDef *  I2Sx )

Initialize I2S

  • Turn on power and clock
  • Setup I2S pin select.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
Returns:
none

Definition at line 131 of file lpc17xx_i2s.c.

void I2S_IntHandler ( void   )

Standard I2S interrupt handler, this function will check all interrupt status of I2S channels, then execute the call back function if they're already installed.

Parameters:
[in]None
Returns:
None

Definition at line 615 of file lpc17xx_i2s.c.

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

Enable/Disable IRQ for I2S.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
[in]TRModeis transmit/receive mode, should be:

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

  • ENABLE
  • DISABLE
Returns:
none

Definition at line 590 of file lpc17xx_i2s.c.

void I2S_IRQConfig ( LPC_I2S_TypeDef *  I2Sx,
uint8_t  TRMode,
uint8_t  level,
fnI2SCbs_Type pfnI2SCbs 
)

Configure IRQ for I2S.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE: transmit mode
  • I2S_RX_MODE: receive mode
[in]level,:is the FIFO level that triggers IRQ request
[in]pfnI2SCbs,:the pointer to call-back function handle this interrupt
Returns:
none

Definition at line 565 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]I2Sx,:I2S peripheral selected, should be: I2S
[in]ModeConfigpointer to I2S_MODEConf_Type will be used to configure, should be:
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE: transmit mode
  • I2S_RX_MODE: receive mode
Returns:
none

Definition at line 440 of file lpc17xx_i2s.c.

void I2S_Mute ( LPC_I2S_TypeDef *  I2Sx,
uint8_t  TRMode 
)

I2S Mute.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE: transmit mode
  • I2S_RX_MODE: receive mode
Returns:
none

Definition at line 279 of file lpc17xx_i2s.c.

void I2S_Pause ( LPC_I2S_TypeDef *  I2Sx,
uint8_t  TRMode 
)

I2S Pause.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE: transmit mode
  • I2S_RX_MODE: receive mode
Returns:
none

Definition at line 259 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 245 of file lpc17xx_i2s.c.

void I2S_Send ( LPC_I2S_TypeDef *  I2Sx,
uint32_t  BufferData 
)

I2S Send data.

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

Definition at line 233 of file lpc17xx_i2s.c.

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

I2S set bitrate.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
[in]bitratevalue will be set
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE: transmit mode
  • I2S_RX_MODE: receive mode
Returns:
none

Definition at line 415 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]I2Sx,:I2S peripheral selected, should be: I2S
Returns:
none

Definition at line 218 of file lpc17xx_i2s.c.

void I2S_Stop ( LPC_I2S_TypeDef *  I2Sx,
uint8_t  TRMode 
)

I2S Stop.

Parameters:
[in]I2Sx,:I2S peripheral selected, should be: I2S
[in]TRModeis transmit/receive mode, should be:

  • I2S_TX_MODE: transmit mode
  • I2S_RX_MODE: receive mode
Returns:
none

Definition at line 300 of file lpc17xx_i2s.c.