26. lpc17xx_ssp Module¶
Synchronous serial port client library functions. Find implementation details in LPC17xx CMSIS-Compliant Standard Peripheral Firmware Driver Library documentation.
- class robovero.lpc17xx_ssp.SSP_CFG_Type(**kwargs)¶
Bases: robovero.internals.cstruct
SSP configuration structure.
Databit: Databit number, should be SSP_DATABIT_x, where x is in range from 4 - 16
CPHA: Clock phase, should be:
- SSP_CPHA_FIRST: first clock edge
- SSP_CPHA_SECOND: second clock edge
CPOL: Clock polarity, should be:
- SSP_CPOL_HI: high level
- SSP_CPOL_LO: low level
Mode: SSP mode, should be:
- SSP_MASTER_MODE: Master mode
- SSP_SLAVE_MODE: Slave mode
FrameFormat: Frame Format:
- SSP_FRAME_SPI: Motorola SPI frame format
- SSP_FRAME_TI: TI frame format
- SSP_FRAME_MICROWIRE: National Microwire frame format
ClockRate: Clock rate,in Hz
- ptr: LPC1769 memory address where structure is stored. Use this in place of
the C reference operator (&).
- robovero.lpc17xx_ssp.SSP_CR0_DSS(n)¶
SSP data size select, must be 4 bits to 16 bits.
- robovero.lpc17xx_ssp.SSP_ClearIntPending(SSPx, IntType)¶
Clear specified interrupt pending in SSP peripheral.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- IntType: IntType Interrupt pending to clear, should be:
- SSP_INTCLR_ROR: clears the “frame was received when RxFIFO was full” interrupt.
- SSP_INTCLR_RT: clears the “Rx FIFO was not empty and has not been read for a timeout period” interrupt.
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_Cmd(SSPx, NewState)¶
Enable or disable SSP peripheral’s operation.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- NewState: New State of SSPx peripheral’s operation
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_ConfigStructInit(SSP_InitStruct)¶
Fills each SSP_InitStruct member with its default value.
- CPHA = SSP_CPHA_FIRST
- CPOL = SSP_CPOL_HI
- ClockRate = 1000000
- Databit = SSP_DATABIT_8
- Mode = SSP_MASTER_MODE
- FrameFormat = SSP_FRAME_SSP.
Args:
- SSP_InitStruct: Pointer to a SSP_CFG_Type structure which will be initialized
- class robovero.lpc17xx_ssp.SSP_DATA_SETUP_Type(**kwargs)¶
Bases: robovero.internals.cstruct
SPI Data configuration structure definitions.
tx_data: Pointer to transmit data
tx_cnt: Transmit counter
rx_data: Pointer to transmit data
rx_cnt: Receive counter
length: Length of transfer data
status: Current status of SSP activity
- ptr: LPC1769 memory address where structure is stored. Use this in place of
the C reference operator (&).
- robovero.lpc17xx_ssp.SSP_DMACmd(SSPx, DMAMode, NewState)¶
Enable/Disable DMA function for SSP peripheral.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- DMAMode: Type of DMA, should be:
- SSP_DMA_TX: DMA for the transmit FIFO
- SSP_DMA_RX: DMA for the Receive FIFO
- NewState: New State of DMA function on SSP peripheral, should be:
- ENABLE: Enable this function
- DISABLE: Disable this function
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_DeInit(SSPx)¶
De-initializes the SSPx peripheral registers to their default reset values.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_GetDataSize(SSPx)¶
Get data size bit selected.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
Return:
- Data size, could be:
- SSP_DATABIT_4: 4 bit transfer
- SSP_DATABIT_5: 5 bit transfer
- ...
- SSP_DATABIT_16: 16 bit transfer
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_GetIntStatus(SSPx, IntType)¶
Check whether the specified interrupt status flag is set or not.
Enabling/Disabling specified interrupt in SSP peripheral effects the Interrupt Status flag.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- IntType: Raw Interrupt Type, should be:
- SSP_INTSTAT_ROR: Receive Overrun interrupt
- SSP_INTSTAT_RT: Receive Time out interrupt
- SSP_INTSTAT_RX: RX FIFO is at least half full interrupt
- SSP_INTSTAT_TX: TX FIFO is at least half empty interrupt
Return: New State of specified interrupt status flag in SSP peripheral
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_GetRawIntStatus(SSPx, RawIntType)¶
Check whether the specified Raw interrupt status flag is set or not.
Enabling/Disabling specified interrupt in SSP peripheral does not effect the Raw Interrupt Status flag.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- RawIntType: Raw Interrupt Type, should be:
- SSP_INTSTAT_RAW_ROR: Receive Overrun interrupt
- SSP_INTSTAT_RAW_RT: Receive Time out interrupt
- SSP_INTSTAT_RAW_RX: RX FIFO is at least half full interrupt
- SSP_INTSTAT_RAW_TX: TX FIFO is at least half empty interrupt
Return:
- New State of specified Raw interrupt status flag in SSP peripheral
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_GetRawIntStatusReg(SSPx)¶
Get Raw Interrupt Status register.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
Return: Raw Interrupt Status (RIS) register value
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_GetStatus(SSPx, FlagType)¶
Checks whether the specified SSP status flag is set or not.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- FlagType: Type of flag to check status, should be one of following:
- SSP_STAT_TXFIFO_EMPTY: TX FIFO is empty
- SSP_STAT_TXFIFO_NOTFULL: TX FIFO is not full
- SSP_STAT_RXFIFO_NOTEMPTY: RX FIFO is not empty
- SSP_STAT_RXFIFO_FULL: RX FIFO is full
- SSP_STAT_BUSY: SSP peripheral is busy
Return: New State of specified SSP status flag
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_Init(SSPx, SSP_ConfigStruct)¶
Initializes the SSPx peripheral according to the specified parameters in the SSP_ConfigStruct.
Args:
SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- SSP_ConfigStruct: Pointer to a SSP_CFG_Type structure that contains the
configuration information for the specified SSP peripheral.
- robovero.lpc17xx_ssp.SSP_IntConfig(SSPx, IntType, NewState)¶
Enable or disable specified interrupt type in SSP peripheral.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- IntType: Interrupt type in SSP peripheral, should be:
- SSP_INTCFG_ROR: Receive Overrun interrupt
- SSP_INTCFG_RT: Receive Time out interrupt
- SSP_INTCFG_RX: RX FIFO is at least half full interrupt
- SSP_INTCFG_TX: TX FIFO is at least half empty interrupt
- NewState: New State of specified interrupt type, should be:
- ENABLE: Enable this interrupt type
- DISABLE: Disable this interrupt type
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_LoopBackCmd(SSPx, NewState)¶
Enable or disable Loop Back mode function in SSP peripheral.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- NewState: New State of Loop Back mode, should be:
- ENABLE: Enable this function
- DISABLE: Disable this function
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_ReadWrite(SSPx, dataCfg, xfType)¶
SSP Read write data function.
This function can be used in both master and slave mode.
Args:
SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- dataCfg: Pointer to a SSP_DATA_SETUP_Type structure that contains specified
information about transmit data configuration.
xfType: xfType Transfer type, should be:
- SSP_TRANSFER_POLLING: Polling mode
- SSP_TRANSFER_INTERRUPT: Interrupt mode
- Return: Actual Data length has been transferred in polling mode. In interrupt
- mode, always return (0). Return (-1) if error.
- robovero.lpc17xx_ssp.SSP_ReceiveData(SSPx)¶
Receive a single word from SSPx peripheral.
Args:
- SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
Return: Data received (16-bit long)
- SSPx: SSP peripheral selected, should be:
- robovero.lpc17xx_ssp.SSP_SendData(SSPx, Data)¶
Transmit a single word or byte through SSPx peripheral.
Args:
SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
- Data: Data to transmit (must be 16 or 8-bit long, depends on SSP data bit
number configuration)
- robovero.lpc17xx_ssp.SSP_SlaveOutputCmd(SSPx, NewState)¶
Enable or disable Slave Output function in SSP peripheral.
This function is available when SSP peripheral in Slave mode
Args:
SSPx: SSP peripheral selected, should be:
- LPC_SSP0: SSP0 peripheral
- LPC_SSP1: SSP1 peripheral
NewState: New State of Slave Output function, should be:
ENABLE: Slave Output in normal operation
- DISABLE: Slave Output is disabled. This blocks SSP controller from
driving the transmit data line (MISO)