STM8S/A Standard Peripherals Firmware Library
|
Defines | |
#define | countof(a) (sizeof(a) / sizeof(*(a))) |
#define | receiver |
#define | transmitter |
#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 } |
Functions | |
TestStatus | Buffercmp (uint8_t *pBuffer1, uint8_t *pBuffer2, uint16_t BufferLength) |
Compares two buffers. | |
static void | CLK_Config (void) |
Configure system clock to run at 16Mhz. | |
static void | GPIO_Config (void) |
Configure UART1 Tx pin as Output open-drain high-impedance level. | |
INTERRUPT_HANDLER (TLI_IRQHandler, 0) | |
Top Level Interrupt routine. | |
INTERRUPT_HANDLER (AWU_IRQHandler, 1) | |
Auto Wake Up Interrupt routine. | |
INTERRUPT_HANDLER (CLK_IRQHandler, 2) | |
Clock Controller Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTA_IRQHandler, 3) | |
External Interrupt PORTA Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTB_IRQHandler, 4) | |
External Interrupt PORTB Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTC_IRQHandler, 5) | |
External Interrupt PORTC Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTD_IRQHandler, 6) | |
External Interrupt PORTD Interrupt routine. | |
INTERRUPT_HANDLER (EXTI_PORTE_IRQHandler, 7) | |
External Interrupt PORTE Interrupt routine. | |
INTERRUPT_HANDLER (SPI_IRQHandler, 10) | |
SPI Interrupt routine. | |
INTERRUPT_HANDLER (TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11) | |
Timer1 Update/Overflow/Trigger/Break Interrupt routine. | |
INTERRUPT_HANDLER (TIM1_CAP_COM_IRQHandler, 12) | |
Timer1 Capture/Compare Interrupt routine. | |
INTERRUPT_HANDLER (TIM2_UPD_OVF_BRK_IRQHandler, 13) | |
Timer2 Update/Overflow/Break Interrupt routine. | |
INTERRUPT_HANDLER (TIM2_CAP_COM_IRQHandler, 14) | |
Timer2 Capture/Compare Interrupt routine. | |
INTERRUPT_HANDLER (I2C_IRQHandler, 19) | |
I2C Interrupt routine. | |
INTERRUPT_HANDLER (ADC1_IRQHandler, 22) | |
ADC1 interrupt routine. | |
INTERRUPT_HANDLER (TIM4_UPD_OVF_IRQHandler, 23) | |
Timer4 Update/Overflow Interrupt routine. | |
INTERRUPT_HANDLER (EEPROM_EEC_IRQHandler, 24) | |
Eeprom EEC Interrupt routine. | |
INTERRUPT_HANDLER_TRAP (TRAP_IRQHandler) | |
TRAP interrupt routine. | |
void | main (void) |
Main program. | |
static void | UART_Config (void) |
UART1 and UART3 Configuration for half duplex communication. | |
Variables | |
uint8_t | NbrOfDataToRead1 = TxBufferSize2 |
uint8_t | NbrOfDataToRead2 = TxBufferSize1 |
uint8_t | RxBuffer1 [TxBufferSize2] = {0} |
uint8_t | RxBuffer2 [TxBufferSize1] = {0} |
uint8_t | RxCounter1 = 0 |
uint8_t | RxCounter2 = 0 |
__IO TestStatus | TransferStatus1 = FAILED |
__IO TestStatus | TransferStatus2 = FAILED |
uint8_t | TxBuffer1 [] = "HalfDuplex Example: UART1 -> UART3 using HalfDuplex mode" |
uint8_t | TxBuffer2 [] = "HalfDuplex Example: UART3 -> UART1 using HalfDuplex mode" |
uint8_t | TxCounter1 = 0 |
uint8_t | TxCounter2 = 0 |
Define Documentation
#define countof | ( | a | ) | (sizeof(a) / sizeof(*(a))) |
Definition at line 43 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
#define receiver |
Definition at line 50 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
#define transmitter |
Definition at line 46 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
#define TxBufferSize1 (countof(TxBuffer1) - 1) |
Definition at line 40 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Referenced by main().
#define TxBufferSize2 (countof(TxBuffer2) - 1) |
Definition at line 41 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Referenced by main().
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
Definition at line 37 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Function Documentation
TestStatus Buffercmp | ( | uint8_t * | pBuffer1, |
uint8_t * | pBuffer2, | ||
uint16_t | BufferLength | ||
) |
Compares two buffers.
- Parameters:
-
pBuffer1 First buffer to be compared. pBuffer2 Second buffer to be compared. BufferLength Buffer's length
- Return values:
-
TestStatus Status of buffer comparison - PASSED: pBuffer1 identical to pBuffer2
- FAILED: pBuffer1 differs from pBuffer2
- Required preconditions:
- None
static void CLK_Config | ( | void | ) | [static] |
Configure system clock to run at 16Mhz.
- Parameters:
-
None
- Return values:
-
None
static void GPIO_Config | ( | void | ) | [static] |
Configure UART1 Tx pin as Output open-drain high-impedance level.
- Parameters:
-
None
- Return values:
-
None
INTERRUPT_HANDLER | ( | TLI_IRQHandler | , |
0 | |||
) |
Top Level Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 87 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | AWU_IRQHandler | , |
1 | |||
) |
Auto Wake Up Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 100 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | CLK_IRQHandler | , |
2 | |||
) |
Clock Controller Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 113 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTA_IRQHandler | , |
3 | |||
) |
External Interrupt PORTA Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 126 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTB_IRQHandler | , |
4 | |||
) |
External Interrupt PORTB Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 138 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTC_IRQHandler | , |
5 | |||
) |
External Interrupt PORTC Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 151 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTD_IRQHandler | , |
6 | |||
) |
External Interrupt PORTD Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 164 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | EXTI_PORTE_IRQHandler | , |
7 | |||
) |
External Interrupt PORTE Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 177 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | SPI_IRQHandler | , |
10 | |||
) |
SPI Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 232 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM1_UPD_OVF_TRG_BRK_IRQHandler | , |
11 | |||
) |
Timer1 Update/Overflow/Trigger/Break Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 245 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM1_CAP_COM_IRQHandler | , |
12 | |||
) |
Timer1 Capture/Compare Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 258 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM2_UPD_OVF_BRK_IRQHandler | , |
13 | |||
) |
Timer2 Update/Overflow/Break Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 298 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM2_CAP_COM_IRQHandler | , |
14 | |||
) |
Timer2 Capture/Compare Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 311 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | I2C_IRQHandler | , |
19 | |||
) |
I2C Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 383 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | ADC1_IRQHandler | , |
22 | |||
) |
ADC1 interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 465 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | TIM4_UPD_OVF_IRQHandler | , |
23 | |||
) |
Timer4 Update/Overflow Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 493 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER | ( | EEPROM_EEC_IRQHandler | , |
24 | |||
) |
Eeprom EEC Interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 507 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
INTERRUPT_HANDLER_TRAP | ( | TRAP_IRQHandler | ) |
TRAP interrupt routine.
- Parameters:
-
None
- Return values:
-
None
Definition at line 73 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/stm8s_it.c.
void main | ( | void | ) |
Main program.
- Parameters:
-
None
- Return values:
-
None
Definition at line 74 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
References Buffercmp(), CLK_Config(), GPIO_Config(), NbrOfDataToRead1, NbrOfDataToRead2, RESET, RxBuffer1, RxBuffer2, RxCounter1, RxCounter2, TransferStatus1, TransferStatus2, TxBuffer1, TxBuffer2, TxBufferSize1, TxBufferSize2, TxCounter1, TxCounter2, UART1_FLAG_RXNE, UART1_FLAG_TXE, UART1_GetFlagStatus(), UART1_ReceiveData8(), UART1_SendData8(), UART3_FLAG_RXNE, UART3_FLAG_TXE, UART3_GetFlagStatus(), UART3_ReceiveData8(), UART3_SendData8(), and UART_Config().
static void UART_Config | ( | void | ) | [static] |
UART1 and UART3 Configuration for half duplex communication.
- Parameters:
-
None
- Return values:
-
None
Definition at line 171 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
References ENABLE, UART1_DeInit(), UART1_HalfDuplexCmd(), UART1_Init(), UART1_MODE_TXRX_ENABLE, UART1_PARITY_NO, UART1_STOPBITS_1, UART1_SYNCMODE_CLOCK_DISABLE, UART1_WORDLENGTH_8D, UART3_DeInit(), UART3_Init(), UART3_MODE_TXRX_ENABLE, UART3_PARITY_NO, UART3_STOPBITS_1, and UART3_WORDLENGTH_8D.
Referenced by main().
Variable Documentation
uint8_t NbrOfDataToRead1 = TxBufferSize2 |
Definition at line 56 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Referenced by GetVar_NbrOfDataToRead1(), and main().
uint8_t NbrOfDataToRead2 = TxBufferSize1 |
Definition at line 57 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Referenced by GetVar_NbrOfDataToRead2(), and main().
Definition at line 54 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Definition at line 55 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
uint8_t RxCounter1 = 0 |
Definition at line 58 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Referenced by GetVar_RxCounter1(), IncrementVar_RxCounter1(), and main().
uint8_t RxCounter2 = 0 |
Definition at line 59 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Referenced by GetVar_RxCounter2(), IncrementVar_RxCounter2(), and main().
__IO TestStatus TransferStatus1 = FAILED |
Definition at line 60 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
__IO TestStatus TransferStatus2 = FAILED |
Definition at line 60 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Definition at line 52 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Definition at line 53 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
uint8_t TxCounter1 = 0 |
Definition at line 58 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Referenced by GetVar_TxCounter1(), IncrementVar_TxCounter1(), and main().
uint8_t TxCounter2 = 0 |
Definition at line 59 of file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.
Referenced by GetVar_TxCounter2(), IncrementVar_TxCounter2(), and main().