STM32F0xx Standard Peripherals Firmware Library: USART_DataExchangeInterrupt

STM32F0xx Standard Peripherals Library

STM32F0xx Standard Peripherals Firmware Library
USART_DataExchangeInterrupt

Functions

static TestStatus Buffercmp (uint8_t *pBuffer1, uint8_t *pBuffer2, uint16_t BufferLength)
 Compares two buffers.
static void Fill_Buffer (uint8_t *pBuffer, uint16_t BufferLength)
 Fills buffer.
uint8_t GetVar_NbrOfData (void)
 Returns NbrOfData value.
void HardFault_Handler (void)
 This function handles Hard Fault exception.
int main (void)
 Main program.
void NMI_Handler (void)
 This function handles NMI exception.
void PendSV_Handler (void)
 This function handles PendSVC exception.
static JOYState_TypeDef Read_Joystick (void)
 Reads key from evaluation board.
void SVC_Handler (void)
 This function handles SVCall exception.
void SysTick_Handler (void)
 This function handles SysTick Handler.
static void SysTickConfig (void)
 Configure a SysTick Base time to 10 ms.
static void TimeOut_UserCallback (void)
 Basic management of the timeout situation.
static void USART_Config (void)
 Configures the USART Peripheral.
void USARTx_IRQHandler (void)
 This function handles USART interrupt request.

Variables

uint8_t AckBuffer []
uint8_t AckBuffer [0x02] = {0x00, 0x00}
uint8_t CmdBuffer []
uint8_t CmdBuffer [0x02] = {0x00, 0x00}
__IO uint8_t Counter = 0x00
__IO JOYState_TypeDef PressedButton = JOY_NONE
uint8_t RxBuffer [RXBUFFERSIZE]
uint8_t RxBuffer []
__IO uint8_t RxIndex = 0x00
__IO uint8_t RxIndex
__IO uint32_t TimeOut = 0x00
__IO uint32_t TimeOut
uint8_t TxBuffer [] = "USART Interrupt Example: Communication between two USART using Interrupt"
uint8_t TxBuffer []
__IO uint8_t TxIndex = 0x00
__IO uint8_t TxIndex
__IO uint8_t UsartMode = USART_MODE_TRANSMITTER
__IO uint8_t UsartMode
__IO uint8_t UsartTransactionType = USART_TRANSACTIONTYPE_CMD
__IO uint8_t UsartTransactionType

Function Documentation

static TestStatus Buffercmp ( uint8_t *  pBuffer1,
uint8_t *  pBuffer2,
uint16_t  BufferLength 
) [static]

Compares two buffers.

Parameters:
pBuffer1,pBuffer2,:buffers to be compared.
BufferLength,:buffer's length
Return values:
PASSED,:pBuffer1 identical to pBuffer2 FAILED: pBuffer1 differs from pBuffer2

Definition at line 484 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/main.c.

References FAILED, and PASSED.

Referenced by main().

static void Fill_Buffer ( uint8_t *  pBuffer,
uint16_t  BufferLength 
) [static]

Fills buffer.

Parameters:
pBuffer,:pointer on the Buffer to fill
BufferLength,:size of the buffer to fill
Return values:
None

Definition at line 513 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/main.c.

Referenced by main().

uint8_t GetVar_NbrOfData ( void  )

Returns NbrOfData value.

Returns NbrOfDataToTransfer value.

Parameters:
None
Return values:
TxBuffer Size (NbrOfDataToTransfer).

Definition at line 503 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/main.c.

References CmdBuffer, and DATA_SIZE.

void HardFault_Handler ( void  )

This function handles Hard Fault exception.

Parameters:
None
Return values:
None

Definition at line 80 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/stm32f0xx_it.c.

int main ( void  )

Main program.

Parameters:
None
Return values:
None

< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f0xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file

Definition at line 71 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/main.c.

References AckBuffer, Buffercmp(), CMD_DOWN, CMD_DOWN_SIZE, CMD_LEFT, CMD_LEFT_SIZE, CMD_RIGHT, CMD_RIGHT_SIZE, CMD_SEL, CMD_SEL_SIZE, CMD_UP, CMD_UP_SIZE, CmdBuffer, FAILED, Fill_Buffer(), GetVar_NbrOfData(), PressedButton, Read_Joystick(), RxBuffer, RxIndex, SysTickConfig(), TimeOut, TimeOut_UserCallback(), TxBuffer, TXBUFFERSIZE, TxIndex, USART_Config(), USART_MODE_RECEIVER, USART_MODE_TRANSMITTER, USART_TRANSACTIONTYPE_CMD, USART_TRANSACTIONTYPE_DATA, UsartMode, UsartTransactionType, USARTx, and USER_TIMEOUT.

void NMI_Handler ( void  )

This function handles NMI exception.

Parameters:
None
Return values:
None

Definition at line 71 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/stm32f0xx_it.c.

void PendSV_Handler ( void  )

This function handles PendSVC exception.

Parameters:
None
Return values:
None

Definition at line 102 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/stm32f0xx_it.c.

static JOYState_TypeDef Read_Joystick ( void  ) [static]

Reads key from evaluation board.

Parameters:
None
Return values:
ReturnJOY_RIGHT, JOY_LEFT, JOY_SEL, JOY_UP, JOY_DOWN or JOY_NONE

Definition at line 433 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/main.c.

Referenced by main().

void SVC_Handler ( void  )

This function handles SVCall exception.

Parameters:
None
Return values:
None

Definition at line 93 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/stm32f0xx_it.c.

void SysTick_Handler ( void  )

This function handles SysTick Handler.

Parameters:
None
Return values:
None

Definition at line 111 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/stm32f0xx_it.c.

References Counter, and TimeOut.

static void SysTickConfig ( void  ) [static]

Configure a SysTick Base time to 10 ms.

Parameters:
None
Return values:
None

Definition at line 416 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/main.c.

References SystemCoreClock.

Referenced by main().

static void TimeOut_UserCallback ( void  ) [static]

Basic management of the timeout situation.

Parameters:
None.
Return values:
None.

Definition at line 340 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/main.c.

Referenced by main().

void USARTx_IRQHandler ( void  )

This function handles USART interrupt request.

This function handles USRAT interrupt request.

Parameters:
None
Return values:
None

Definition at line 138 of file STM32F0xx_StdPeriph_Examples/USART/USART_TwoBoards/DataExchangeInterrupt/stm32f0xx_it.c.

References AckBuffer, CmdBuffer, ComputedCRC, GetVar_NbrOfData(), RxBuffer, RxIndex, TxBuffer, TxIndex, USART_MODE_TRANSMITTER, USART_TRANSACTIONTYPE_CMD, UsartMode, UsartTransactionType, and USARTx.


Variable Documentation

uint8_t AckBuffer[0x02] = {0x00, 0x00}
uint8_t CmdBuffer[0x02] = {0x00, 0x00}
__IO JOYState_TypeDef PressedButton = JOY_NONE
__IO uint8_t RxIndex
__IO uint32_t TimeOut
uint8_t TxBuffer[] = "USART Interrupt Example: Communication between two USART using Interrupt"
__IO uint8_t TxIndex
__IO uint8_t UsartMode = USART_MODE_TRANSMITTER
__IO uint8_t UsartTransactionType = USART_TRANSACTIONTYPE_CMD
STM32L1xx Standard Peripherals Library: Footer

 

 

 For complete documentation on STM32 Microcontrollers visit www.st.com/STM32