USART_Interrupt
[STM32F10x_StdPeriph_Examples]

Defines

#define countof(a)   (sizeof(a) / sizeof(*(a)))
#define RxBufferSize1   TxBufferSize2
#define RxBufferSize2   TxBufferSize1
#define TxBufferSize1   (countof(TxBuffer1) - 1)
#define TxBufferSize2   (countof(TxBuffer2) - 1)

Enumerations

enum  TestStatus {
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED,
  FAILED = 0, PASSED = !FAILED, FAILED = 0, PASSED = !FAILED
}

Functions

TestStatus Buffercmp (uint8_t *pBuffer1, uint8_t *pBuffer2, uint16_t BufferLength)
 Compares two buffers.
void BusFault_Handler (void)
 This function handles Bus Fault exception.
void DebugMon_Handler (void)
 This function handles Debug Monitor exception.
void GPIO_Configuration (void)
 Configures the different GPIO ports.
void HardFault_Handler (void)
 This function handles Hard Fault exception.
int main (void)
 Main program.
void MemManage_Handler (void)
 This function handles Memory Manage exception.
void NMI_Handler (void)
 This function handles NMI exception.
void NVIC_Configuration (void)
 Configures the nested vectored interrupt controller.
void PendSV_Handler (void)
 This function handles PendSV_Handler exception.
void RCC_Configuration (void)
 Configures the different system clocks.
void SVC_Handler (void)
 This function handles SVCall exception.
void SysTick_Handler (void)
 This function handles SysTick Handler.
void UsageFault_Handler (void)
 This function handles Usage Fault exception.
void USARTy_IRQHandler (void)
 This function handles USARTy global interrupt request.
void USARTz_IRQHandler (void)
 This function handles USARTz global interrupt request.

Variables

uint8_t NbrOfDataToRead1
uint8_t NbrOfDataToRead1 = RxBufferSize1
uint8_t NbrOfDataToRead2
uint8_t NbrOfDataToRead2 = RxBufferSize2
uint8_t NbrOfDataToTransfer1
uint8_t NbrOfDataToTransfer1 = TxBufferSize1
uint8_t NbrOfDataToTransfer2
uint8_t NbrOfDataToTransfer2 = TxBufferSize2
uint8_t RxBuffer1 []
uint8_t RxBuffer1 [RxBufferSize1]
uint8_t RxBuffer2 []
uint8_t RxBuffer2 [RxBufferSize2]
__IO uint8_t RxCounter1
__IO uint8_t RxCounter1 = 0x00
__IO uint8_t RxCounter2
__IO uint8_t RxCounter2 = 0x00
__IO TestStatus TransferStatus1 = FAILED
__IO TestStatus TransferStatus2 = FAILED
uint8_t TxBuffer1 []
uint8_t TxBuffer1 [] = "USART Interrupt Example: USARTy -> USARTz using Interrupt"
uint8_t TxBuffer2 []
uint8_t TxBuffer2 [] = "USART Interrupt Example: USARTz -> USARTy using Interrupt"
__IO uint8_t TxCounter1
__IO uint8_t TxCounter1 = 0x00
__IO uint8_t TxCounter2
__IO uint8_t TxCounter2 = 0x00
USART_InitTypeDef USART_InitStructure

Define Documentation

#define countof (  )     (sizeof(a) / sizeof(*(a)))
#define RxBufferSize1   TxBufferSize2

Definition at line 39 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/main.c.

Referenced by main().

#define RxBufferSize2   TxBufferSize1

Definition at line 40 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/main.c.

Referenced by main().

#define TxBufferSize1   (countof(TxBuffer1) - 1)
#define TxBufferSize2   (countof(TxBuffer2) - 1)

Enumeration Type Documentation

enum TestStatus
Enumerator:
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 
FAILED 
PASSED 

Definition at line 34 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/main.c.


Function Documentation

TestStatus Buffercmp ( uint8_t *  pBuffer1,
uint8_t *  pBuffer2,
uint16_t  BufferLength 
)

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 247 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/main.c.

References FAILED, and PASSED.

void BusFault_Handler ( void   ) 

This function handles Bus Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 99 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

void DebugMon_Handler ( void   ) 

This function handles Debug Monitor exception.

Parameters:
None 
Return values:
None 

Definition at line 134 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

void GPIO_Configuration ( void   ) 
void HardFault_Handler ( void   ) 

This function handles Hard Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 73 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_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_stm32f10x_xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f10x.c file

Definition at line 75 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/main.c.

References Buffercmp(), ENABLE, GPIO_Configuration(), NVIC_Configuration(), RCC_Configuration(), RxBuffer1, RxBuffer2, RxBufferSize1, RxBufferSize2, RxCounter1, RxCounter2, TransferStatus1, TransferStatus2, TxBuffer1, TxBuffer2, USART_InitTypeDef::USART_BaudRate, USART_Cmd(), USART_InitTypeDef::USART_HardwareFlowControl, USART_HardwareFlowControl_None, USART_Init(), USART_IT_RXNE, USART_IT_TXE, USART_ITConfig(), USART_InitTypeDef::USART_Mode, USART_Mode_Rx, USART_Mode_Tx, USART_InitTypeDef::USART_Parity, USART_Parity_No, USART_InitTypeDef::USART_StopBits, USART_StopBits_1, USART_InitTypeDef::USART_WordLength, and USART_WordLength_8b.

void MemManage_Handler ( void   ) 

This function handles Memory Manage exception.

Parameters:
None 
Return values:
None 

Definition at line 86 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

void NMI_Handler ( void   ) 

This function handles NMI exception.

Parameters:
None 
Return values:
None 

Definition at line 64 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

void NVIC_Configuration ( void   ) 
void PendSV_Handler ( void   ) 

This function handles PendSV_Handler exception.

Parameters:
None 
Return values:
None 

Definition at line 143 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

void RCC_Configuration ( void   ) 

Configures the different system clocks.

Parameters:
None 
Return values:
None 

Definition at line 159 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/main.c.

References ENABLE, RCC_APB1PeriphClockCmd(), RCC_APB2Periph_AFIO, and RCC_APB2PeriphClockCmd().

void SVC_Handler ( void   ) 

This function handles SVCall exception.

Parameters:
None 
Return values:
None 

Definition at line 125 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

void SysTick_Handler ( void   ) 

This function handles SysTick Handler.

Parameters:
None 
Return values:
None 

Definition at line 152 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

void UsageFault_Handler ( void   ) 

This function handles Usage Fault exception.

Parameters:
None 
Return values:
None 

Definition at line 112 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

void USARTy_IRQHandler ( void   ) 

This function handles USARTy global interrupt request.

Parameters:
None 
Return values:
None 

Definition at line 165 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

References DISABLE, NbrOfDataToRead1, NbrOfDataToTransfer1, RESET, RxBuffer1, RxCounter1, TxBuffer1, TxCounter1, USART_GetITStatus(), USART_IT_RXNE, USART_IT_TXE, USART_ITConfig(), USART_ReceiveData(), and USART_SendData().

void USARTz_IRQHandler ( void   ) 

This function handles USARTz global interrupt request.

Parameters:
None 
Return values:
None 

Definition at line 197 of file STM32F10x_StdPeriph_Examples/USART/Interrupt/stm32f10x_it.c.

References DISABLE, NbrOfDataToRead1, NbrOfDataToTransfer2, RESET, RxBuffer2, RxCounter2, TxBuffer2, TxCounter2, USART_GetITStatus(), USART_IT_RXNE, USART_IT_TXE, USART_ITConfig(), USART_ReceiveData(), and USART_SendData().


Variable Documentation

uint8_t NbrOfDataToRead1 = RxBufferSize1

Definition at line 50 of file STM32F10x_StdPeriph_Examples/USART/HalfDuplex/main.c.

Referenced by main().

uint8_t NbrOfDataToRead2 = RxBufferSize2
uint8_t NbrOfDataToTransfer1 = TxBufferSize1
uint8_t NbrOfDataToTransfer2 = TxBufferSize2
uint8_t RxBuffer1[]
uint8_t RxBuffer1[RxBufferSize1]
uint8_t RxBuffer2[]
uint8_t RxBuffer2[RxBufferSize2]
__IO uint8_t RxCounter1

Definition at line 51 of file STM32F10x_StdPeriph_Examples/USART/HalfDuplex/main.c.

Referenced by main(), and USARTy_IRQHandler().

__IO uint8_t RxCounter1 = 0x00
__IO uint8_t RxCounter2

Definition at line 52 of file STM32F10x_StdPeriph_Examples/USART/HalfDuplex/main.c.

Referenced by main(), and USARTz_IRQHandler().

__IO uint8_t RxCounter2 = 0x00
__IO TestStatus TransferStatus1 = FAILED
__IO TestStatus TransferStatus2 = FAILED
uint8_t TxBuffer1[]
uint8_t TxBuffer1[] = "USART Interrupt Example: USARTy -> USARTz using Interrupt"
uint8_t TxBuffer2[]
uint8_t TxBuffer2[] = "USART Interrupt Example: USARTz -> USARTy using Interrupt"
__IO uint8_t TxCounter1

Definition at line 51 of file STM32F10x_StdPeriph_Examples/USART/HalfDuplex/main.c.

Referenced by main(), and USARTy_IRQHandler().

__IO uint8_t TxCounter1 = 0x00
__IO uint8_t TxCounter2

Definition at line 52 of file STM32F10x_StdPeriph_Examples/USART/HalfDuplex/main.c.

Referenced by main(), and USARTz_IRQHandler().

__IO uint8_t TxCounter2 = 0x00
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32