17. lpc17xx_i2s Module¶
I2S client library functions. Find implementation details in LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library documentation.
- class robovero.lpc17xx_i2s.I2S_CFG_Type(**kwargs)¶
Bases: robovero.internals.cstruct
I2S configuration structure definition.
wordwidth: the number of bytes in data as follow:
- I2S_WORDWIDTH_8: 8 bit data
- I2S_WORDWIDTH_16: 16 bit data
- I2S_WORDWIDTH_32: 32 bit data
mono: Set mono/stereo mode, should be:
- I2S_STEREO: stereo mode
- I2S_MONO: mono mode
stop: Disables accesses on FIFOs, should be:
- I2S_STOP_ENABLE: enable stop mode
- I2S_STOP_DISABLE: disable stop mode
reset: Asynchronously reset tje transmit channel and FIFO, should be:
- I2S_RESET_ENABLE: enable reset mode
- I2S_RESET_DISABLE: disable reset mode
ws_sel: Set Master/Slave mode, should be:
- I2S_MASTER_MODE: I2S master mode
- I2S_SLAVE_MODE: I2S slave mode
mute: MUTE mode: when true, the transmit channel sends only zeroes, shoule be:
- I2S_MUTE_ENABLE: enable mute mode
- I2S_MUTE_DISABLE: disable mute mode
- ptr: LPC1769 memory address where structure is stored. Use this in place of
the C reference operator (&).
- robovero.lpc17xx_i2s.I2S_Config(I2Sx, TRMode, ConfigStruct)¶
Configure I2S.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- ConfigStruct: pointer to I2S_CFG_Type structure which will be initialized
- robovero.lpc17xx_i2s.I2S_DAI_WS_HALFPERIOD(n)¶
I2S word select half period minus one (9 bits).
- robovero.lpc17xx_i2s.I2S_DAO_WS_HALFPERIOD(n)¶
I2S word select half period minus one.
- robovero.lpc17xx_i2s.I2S_DMA1_RX_DEPTH(n)¶
I2S set FIFO level that trigger a receive DMA request on DMA1.
- robovero.lpc17xx_i2s.I2S_DMA1_TX_DEPTH(n)¶
I2S set FIFO level that trigger a transmit DMA request on DMA1.
- robovero.lpc17xx_i2s.I2S_DMA2_RX_DEPTH(n)¶
I2S set FIFO level that trigger a receive DMA request on DMA2.
- robovero.lpc17xx_i2s.I2S_DMA2_TX_DEPTH(n)¶
I2S set FIFO level that trigger a transmit DMA request on DMA2.
- robovero.lpc17xx_i2s.I2S_DMACmd(I2Sx, DMAIndex, TRMode, NewState)¶
Enable/Disable DMA operation for I2S.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- DMAIndex: DMAIndex chose what DMA is used, should be:
- I2S_DMA_1 = 0: DMA1
- I2S_DMA_2 = 1: DMA2
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- NewState: new state of DMA operation, should be:
- ENABLE
- DISABLE
- class robovero.lpc17xx_i2s.I2S_DMAConf_Type(**kwargs)¶
Bases: robovero.internals.cstruct
I2S DMA configuration structure definition.
DMAIndex: Select DMA1 or DMA2, should be:
- I2S_DMA_1: DMA1
- I2S_DMA_2: DMA2
depth: FIFO level that triggers a DMA request
- ptr: LPC1769 memory address where structure is stored. Use this in place of
the C reference operator (&).
- robovero.lpc17xx_i2s.I2S_DMAConfig(I2Sx, DMAConfig, TRMode)¶
Configure DMA operation for I2S.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- DMAConfig: pointer to I2S_DMAConf_Type used for configuration
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- robovero.lpc17xx_i2s.I2S_DeInit(I2Sx)¶
Deinitialize I2S transmit or receive.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- robovero.lpc17xx_i2s.I2S_FreqConfig(I2Sx, Freq, TRMode)¶
Set frequency for I2S.
Args:
I2Sx: I2S peripheral selected, should be: LPC_I2S
- Freq: The frequency to be set. It can range from 16-96 kHz(16, 22.05, 32,
44.1, 48, 96kHz)
TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
Return:
- Status: ERROR or SUCCESS
- robovero.lpc17xx_i2s.I2S_GetIRQDepth(I2Sx, TRMode)¶
Get I2S interrupt depth. Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
Return:
- depth of FIFO level on which to create an irq request
- robovero.lpc17xx_i2s.I2S_GetIRQStatus(I2Sx, TRMode)¶
Get I2S interrupt status.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
Return:
- FunctionalState should be: ENABLE or DISABLE
- robovero.lpc17xx_i2s.I2S_GetLevel(I2Sx, TRMode)¶
Get I2S Buffer Level.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
Return:
- current level of Transmit/Receive Buffer
- robovero.lpc17xx_i2s.I2S_IRQCmd(I2Sx, TRMode, NewState)¶
Enable/Disable IRQ for I2S.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- NewState: ENABLE or DISABLE
- robovero.lpc17xx_i2s.I2S_IRQConfig(I2Sx, TRMode, level)¶
Configure IRQ for I2S.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- level: the FIFO level that triggers IRQ request
- robovero.lpc17xx_i2s.I2S_IRQ_RX_DEPTH(n)¶
I2S set the FIFO level on which to create an irq request.
- robovero.lpc17xx_i2s.I2S_IRQ_TX_DEPTH(n)¶
I2S set the FIFO level on which to create an irq request.
- robovero.lpc17xx_i2s.I2S_Init(I2Sx)¶
Initialize I2S.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- class robovero.lpc17xx_i2s.I2S_MODEConf_Type(**kwargs)¶
Bases: robovero.internals.cstruct
I2S mode configuration structure definition.
clksel: Clock source selection, should be:
- I2S_CLKSEL_FRDCLK: Select the fractional rate divider clock output
- I2S_CLKSEL_MCLK: Select the MCLK signal as the clock source
fpin: Select four pin mode, should be:
- I2S_4PIN_ENABLE: 4-pin enable
- I2S_4PIN_DISABLE: 4-pin disable
mcena: Select MCLK mode, should be:
- I2S_MCLK_ENABLE: MCLK enable for output
- I2S_MCLK_DISABLE: MCLK disable for output
- ptr: LPC1769 memory address where structure is stored. Use this in place of
the C reference operator (&).
- robovero.lpc17xx_i2s.I2S_ModeConfig(I2Sx, ModeConfig, TRMode)¶
Configuration operating mode for I2S.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- ModeConfig: pointer to I2S_MODEConf_Type used for configuration
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- robovero.lpc17xx_i2s.I2S_Mute(I2Sx, TRMode)¶
I2S Mute.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- robovero.lpc17xx_i2s.I2S_Pause(I2Sx, TRMode)¶
I2S Pause.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- robovero.lpc17xx_i2s.I2S_RXBITRATE(n)¶
Receive Bit Rate register.
- robovero.lpc17xx_i2s.I2S_RXMODE_CLKSEL(n)¶
I2S Receive select clock source.
- robovero.lpc17xx_i2s.I2S_RXRATE_X_DIVIDER(n)¶
I2S Receive MCLK rate denominator.
- robovero.lpc17xx_i2s.I2S_RXRATE_Y_DIVIDER(n)¶
I2S Receive MCLK rate denominator.
- robovero.lpc17xx_i2s.I2S_Receive(I2Sx)¶
I2S Receive Data.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
Return:
- received value
- robovero.lpc17xx_i2s.I2S_STATE_RX_LEVEL(n)¶
I2S Status Current level of the Receive FIFO (5 bits).
- robovero.lpc17xx_i2s.I2S_STATE_TX_LEVEL(n)¶
I2S Status Current level of the Transmit FIFO (5 bits).
- robovero.lpc17xx_i2s.I2S_Send(I2Sx, BufferData)¶
I2S Send data.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- BufferData: pointer to uint32_t is the data will be send
- robovero.lpc17xx_i2s.I2S_SetBitRate(I2Sx, bitrate, TRMode)¶
I2S set bitrate.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- bitrate: bitrate value should be in range: 0 .. 63
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- robovero.lpc17xx_i2s.I2S_Start(I2Sx)¶
Clear all STOP,RESET and MUTE bit, ready to operate.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- robovero.lpc17xx_i2s.I2S_Stop(I2Sx, TRMode)¶
I2S Stop.
Args:
- I2Sx: I2S peripheral selected, should be: LPC_I2S
- TRMode: Transmit/receive mode, should be:
- I2S_TX_MODE = 0: transmit mode
- I2S_RX_MODE = 1: receive mode
- robovero.lpc17xx_i2s.I2S_TXBITRATE(n)¶
Transmit Bit Rate registe.
- robovero.lpc17xx_i2s.I2S_TXMODE_CLKSEL(n)¶
I2S Transmit select clock source (2 bits).
- robovero.lpc17xx_i2s.I2S_TXRATE_X_DIVIDER(n)¶
I2S Transmit MCLK rate denominator.
- robovero.lpc17xx_i2s.I2S_TXRATE_Y_DIVIDER(n)¶
I2S Transmit MCLK rate denominator.
- robovero.lpc17xx_i2s.PARAM_I2S_4PIN(n)¶
Macro check I2S 4-pin mode.
- robovero.lpc17xx_i2s.PARAM_I2S_BITRATE(n)¶
Macro check I2S bit-rate value.
- robovero.lpc17xx_i2s.PARAM_I2S_CHANNEL(n)¶
Macro check I2S channel type.
- robovero.lpc17xx_i2s.PARAM_I2S_CLKSEL(n)¶
Macro check I2S clock select mode.
- robovero.lpc17xx_i2s.PARAM_I2S_DMA(n)¶
Macro check I2S DMA mode.
- robovero.lpc17xx_i2s.PARAM_I2S_DMA_DEPTH(n)¶
Macro check I2S DMA depth value.
- robovero.lpc17xx_i2s.PARAM_I2S_HALFPERIOD(n)¶
Macro check I2S half-period value.
- robovero.lpc17xx_i2s.PARAM_I2S_IRQ_LEVEL(n)¶
Macro check I2S irq level value.
- robovero.lpc17xx_i2s.PARAM_I2S_MCLK(n)¶
Macro check I2S MCLK mode.
- robovero.lpc17xx_i2s.PARAM_I2S_MUTE(n)¶
Macro check I2S reset mode.
- robovero.lpc17xx_i2s.PARAM_I2S_RESET(n)¶
Macro check I2S reset mode.
- robovero.lpc17xx_i2s.PARAM_I2S_STOP(n)¶
Macro check I2S stop mode.
- robovero.lpc17xx_i2s.PARAM_I2S_TRX(n)¶
Macro check I2S transmit/receive mode.
- robovero.lpc17xx_i2s.PARAM_I2S_WORDWIDTH(n)¶
Macro check I2S word width type.
- robovero.lpc17xx_i2s.PARAM_I2S_WS_SEL(n)¶
Macro check I2S master/slave mode.
- robovero.lpc17xx_i2s.PARAM_I2Sx(n)¶
Macro to determine if it is valid I2S peripheral.
- robovero.lpc17xx_i2s.PRAM_I2S_FREQ(freq)¶
Macro to check Data to send valid.