retargetserial.c File Reference

Provide stdio retargeting to USART/UART or LEUART.

License

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

Definition in file retargetserial.c.

#include <stdio.h>
#include "em_device.h"
#include "em_cmu.h"
#include "em_core.h"
#include "em_gpio.h"
#include "retargetserial.h"
#include "retargetserialconfig.h"

Macros

#define _GENERIC_UART_STATUS_IDLE   LEUART_STATUS_TXC
 
#define RXBUFSIZE   8
 

Functions

static void disableRxInterrupt ()
 Disable RX interrupt.
 
static void enableRxInterrupt ()
 Enable RX interrupt.
 
void RETARGET_IRQ_NAME (void)
 UART/LEUART IRQ Handler.
 
int RETARGET_ReadChar (void)
 Receive a byte from USART/LEUART and put into global buffer.
 
void RETARGET_SerialCrLf (int on)
 UART/LEUART toggle LF to CRLF conversion.
 
bool RETARGET_SerialEnableFlowControl (void)
 Enable hardware flow control. (RTS + CTS)
 
void RETARGET_SerialFlush (void)
 Flush UART/LEUART.
 
void RETARGET_SerialInit (void)
 Intializes UART/LEUART.
 
int RETARGET_WriteChar (char c)
 Transmit single byte to USART/LEUART.
 

Variables

static bool initialized = false
 
static uint8_t LFtoCRLF = 0
 
static volatile uint8_t rxBuffer [RXBUFSIZE]
 
static volatile int rxCount = 0
 
static volatile int rxReadIndex = 0
 
static volatile int rxWriteIndex = 0