96#define SPI_BAUD_RATE_DIV(x) ((x)?(x):(256))
170 tmpreg |= SPI_CR1_SSE_Msk;
185 tmpreg &= ~SPI_CR1_SSE_Msk;
200 if(tmpreg & SPI_CR1_SSE_Msk)
214 uint32_t tmpreg = 0x00;
216 tmpreg = SPIx->DMACR;
217 tmpreg |= SPI_DMACR_TDMAE_Msk;
218 SPIx->DMACR = tmpreg;
229 uint32_t tmpreg = 0x00;
231 tmpreg = SPIx->DMACR;
232 tmpreg &= ~SPI_DMACR_TDMAE_Msk;
233 SPIx->DMACR = tmpreg;
244 uint32_t tmpreg = 0x00;
246 tmpreg = SPIx->DMACR;
247 if(tmpreg & SPI_DMACR_TDMAE_Msk)
261 uint32_t tmpreg = 0x00;
263 tmpreg = SPIx->DMACR;
264 tmpreg |= SPI_DMACR_RDMAE_Msk;
265 SPIx->DMACR = tmpreg;
276 uint32_t tmpreg = 0x00;
278 tmpreg = SPIx->DMACR;
279 tmpreg &= ~SPI_DMACR_RDMAE_Msk;
280 SPIx->DMACR = tmpreg;
291 uint32_t tmpreg = 0x00;
293 tmpreg = SPIx->DMACR;
294 if(tmpreg & SPI_DMACR_RDMAE_Msk)
336 uint32_t tmpreg = 0x00;
357 uint32_t tmpreg = 0x00;
400 uint32_t tmpreg = 0x00;
422 uint32_t tmpreg = 0x00;
445 uint32_t tmpreg = 0x00;
465 uint32_t tmpreg = 0x00;
484 uint32_t tmpreg = 0x00;
500 uint32_t tmpreg = 0x00;
503 if(tmpreg & SPI_SR_TFE_Msk)
516 uint32_t tmpreg = 0x00;
520 if(tmpreg & SPI_SR_TFNF_Msk)
533 uint32_t tmpreg = 0x00;
537 if(tmpreg & SPI_SR_RFNE_Msk)
551 uint32_t tmpreg = 0x00;
555 if(tmpreg & SPI_SR_RFF_Msk)
569 uint32_t tmpreg = 0x00;
572 if(tmpreg & SPI_SR_BUSY_Msk)
586 (enable) ? (SPIx->CR1 |= SPI_CR1_TX_LSB_EN_Msk) : (SPIx->CR1 &= ~SPI_CR1_TX_LSB_EN_Msk);
597 (enable) ? (SPIx->CR1 |= SPI_CR1_RX_LSB_EN_Msk) : (SPIx->CR1 &= ~SPI_CR1_RX_LSB_EN_Msk);
enum SPI_BaudRateDiv SPI_BaudRateDivDef
SPI_BaudRateDiv
Definition: pan_spi.h:77
@ SPI_BaudRateDiv_192
Definition: pan_spi.h:89
@ SPI_BaudRateDiv_4
Definition: pan_spi.h:79
@ SPI_BaudRateDiv_96
Definition: pan_spi.h:86
@ SPI_BaudRateDiv_250
Definition: pan_spi.h:92
@ SPI_BaudRateDiv_32
Definition: pan_spi.h:83
@ SPI_BaudRateDiv_64
Definition: pan_spi.h:85
@ SPI_BaudRateDiv_16
Definition: pan_spi.h:82
@ SPI_BaudRateDiv_240
Definition: pan_spi.h:91
@ SPI_BaudRateDiv_8
Definition: pan_spi.h:81
@ SPI_BaudRateDiv_48
Definition: pan_spi.h:84
@ SPI_BaudRateDiv_2
Definition: pan_spi.h:78
@ SPI_BaudRateDiv_6
Definition: pan_spi.h:80
@ SPI_BaudRateDiv_128
Definition: pan_spi.h:87
@ SPI_BaudRateDiv_224
Definition: pan_spi.h:90
@ SPI_BaudRateDiv_160
Definition: pan_spi.h:88
enum SPI_DataFrameSize SPI_DataFrameSizeDef
SPI_DataFrameSize
Definition: pan_spi.h:56
@ SPI_DataFrame_10b
Definition: pan_spi.h:63
@ SPI_DataFrame_15b
Definition: pan_spi.h:68
@ SPI_DataFrame_13b
Definition: pan_spi.h:66
@ SPI_DataFrame_7b
Definition: pan_spi.h:60
@ SPI_DataFrame_14b
Definition: pan_spi.h:67
@ SPI_DataFrame_8b
Definition: pan_spi.h:61
@ SPI_DataFrame_16b
Definition: pan_spi.h:69
@ SPI_DataFrame_9b
Definition: pan_spi.h:62
@ SPI_DataFrame_11b
Definition: pan_spi.h:64
@ SPI_DataFrame_5b
Definition: pan_spi.h:58
@ SPI_DataFrame_4b
Definition: pan_spi.h:57
@ SPI_DataFrame_12b
Definition: pan_spi.h:65
@ SPI_DataFrame_6b
Definition: pan_spi.h:59
enum SPI_FrameFormat SPI_FrameFormatDef
SPI_FrameFormat
Definition: pan_spi.h:124
@ SPI_FormatMicrowire
Definition: pan_spi.h:127
@ SPI_FormatTi
Definition: pan_spi.h:126
@ SPI_FormatMotorola
Definition: pan_spi.h:125
SPI_Irq
Definition: pan_spi.h:32
@ SPI_IRQ_RX_OVERRUN
Definition: pan_spi.h:36
@ SPI_IRQ_RX_HALF_FULL
Definition: pan_spi.h:34
@ SPI_IRQ_TX_HALF_EMPTY
Definition: pan_spi.h:33
@ SPI_IRQ_RX_TIMEOUT
Definition: pan_spi.h:35
@ SPI_IRQ_ALL
Definition: pan_spi.h:37
SPI_ClockPhase
Definition: pan_spi.h:114
enum SPI_ClockPhase SPI_ClockPhaseDef
@ SPI_ClockPhaseSecondEdge
Definition: pan_spi.h:116
@ SPI_ClockPhaseFirstEdge
Definition: pan_spi.h:115
SPI_ClockPol
Definition: pan_spi.h:104
enum SPI_ClockPol SPI_ClockPolDef
@ SPI_ClockPolarityHigh
Definition: pan_spi.h:106
@ SPI_ClockPolarityLow
Definition: pan_spi.h:105
enum SPI_Role SPI_RoleDef
SPI_Role
Definition: pan_spi.h:45
@ SPI_RoleMaster
Definition: pan_spi.h:46
@ SPI_RoleSlave
Definition: pan_spi.h:47
__STATIC_INLINE void SPI_EnableDmaTx(SPI_T *SPIx)
DMA for the transmit FIFO is enabled.
Definition: pan_spi.h:212
__STATIC_INLINE bool SPI_IsRxFifoFull(SPI_T *SPIx)
Get Tx FIFO full status.
Definition: pan_spi.h:549
__STATIC_INLINE bool SPI_IsIrqEnabled(SPI_T *SPIx, SPI_IrqDef irq)
Get Interruput mask status.
Definition: pan_spi.h:376
__STATIC_INLINE void SPI_DisableIrq(SPI_T *SPIx, SPI_IrqDef irq)
Interruput mask Disable.
Definition: pan_spi.h:355
__STATIC_INLINE void SPI_EnableDmaRx(SPI_T *SPIx)
DMA for the receive FIFO is enabled.
Definition: pan_spi.h:259
__STATIC_INLINE SPI_IrqDef SPI_GetRawActiveIrq(SPI_T *SPIx)
Get Raw Interruput status.
Definition: pan_spi.h:482
__STATIC_INLINE bool SPI_IsTxFifoFull(SPI_T *SPIx)
Get Tx FIFO full status.
Definition: pan_spi.h:514
__STATIC_INLINE void SPI_TxLsbEnable(SPI_T *SPIx, bool enable)
Tx Lsb Send function control.
Definition: pan_spi.h:584
__STATIC_INLINE void SPI_RxLsbEnable(SPI_T *SPIx, bool enable)
Rx Lsb Send function control.
Definition: pan_spi.h:595
__STATIC_INLINE void SPI_DisableDmaTx(SPI_T *SPIx)
DMA for the transmit FIFO is disabled.
Definition: pan_spi.h:227
__STATIC_INLINE void SPI_DisableDmaRx(SPI_T *SPIx)
DMA for the receive FIFO is disabled.
Definition: pan_spi.h:274
__STATIC_INLINE bool SPI_IsBusy(SPI_T *SPIx)
Get Synchronous serial port busy status.
Definition: pan_spi.h:567
__STATIC_INLINE uint32_t SPI_ReceiveData(SPI_T *SPIx)
Receive data,DR is the data register and is 16-bits wide.
Definition: pan_spi.h:317
__STATIC_INLINE SPI_IrqDef SPI_GetMskedActiveIrq(SPI_T *SPIx)
Get Masked Interruput status.
Definition: pan_spi.h:398
__STATIC_INLINE void SPI_ClearIrq(SPI_T *SPIx, SPI_IrqDef irq)
clear Interruput status
Definition: pan_spi.h:463
__STATIC_INLINE void SPI_EnableSpi(SPI_T *SPIx)
Synchronous serial port enable.
Definition: pan_spi.h:165
__STATIC_INLINE bool SPI_IsDmaTxEnabled(SPI_T *SPIx)
get DMA for the transmit FIFO status
Definition: pan_spi.h:242
__STATIC_INLINE void SPI_DisableSpi(SPI_T *SPIx)
Synchronous serial port disable.
Definition: pan_spi.h:180
__STATIC_INLINE bool SPI_IsSpiEnabled(SPI_T *SPIx)
get synchronous serial port status
Definition: pan_spi.h:195
__STATIC_INLINE void SPI_EnableIrq(SPI_T *SPIx, SPI_IrqDef irq)
Interruput mask Enable.
Definition: pan_spi.h:334
__STATIC_INLINE bool SPI_IsTxFifoEmpty(SPI_T *SPIx)
Get Tx FIFO empty status.
Definition: pan_spi.h:498
__STATIC_INLINE bool SPI_IsRawIrqActive(SPI_T *SPIx, SPI_IrqDef irq)
Get raw Interruput status.
Definition: pan_spi.h:443
__STATIC_INLINE void SPI_SendData(SPI_T *SPIx, uint32_t Data)
Send data,DR is the data register and is 16-bits wide.
Definition: pan_spi.h:306
__STATIC_INLINE bool SPI_IsDmaRxEnabled(SPI_T *SPIx)
get DMA for the receive FIFO status
Definition: pan_spi.h:289
__STATIC_INLINE bool SPI_IsRxFifoEmpty(SPI_T *SPIx)
Get Tx FIFO empty status.
Definition: pan_spi.h:531
void SPI_Init(SPI_T *SPIx, SPI_InitTypeDef *SPI_InitStruct)
Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct .
__STATIC_INLINE bool SPI_IsIrqActive(SPI_T *SPIx, SPI_IrqDef irq)
Get Masked Interruput status.
Definition: pan_spi.h:420
SPI Init Structure definition.
Definition: pan_spi.h:148
SPI_FrameFormatDef SPI_format
Definition: pan_spi.h:154
SPI_RoleDef SPI_role
Definition: pan_spi.h:149
SPI_DataFrameSizeDef SPI_dataFrameSize
Definition: pan_spi.h:150
SPI_ClockPolDef SPI_CPOL
Definition: pan_spi.h:151
SPI_ClockPhaseDef SPI_CPHA
Definition: pan_spi.h:152
uint16_t SPI_baudRateDiv
Definition: pan_spi.h:153