STM8S/A Standard Peripherals Firmware Library: main.c File Reference

STM8S/A

STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c File Reference

This file contains the main function for UART1 in Half-Duplex mode example. More...

#include "stm8s.h"

Go to the source code of this file.

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.
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

Detailed Description

This file contains the main function for UART1 in Half-Duplex mode example.

Author:
MCD Application Team
Version:
V2.2.0
Date:
30-September-2014
Attention:

© COPYRIGHT 2014 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file STM8S_StdPeriph_Examples/UART1/UART1_HalfDuplex/main.c.

STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com