Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

SERIAL - Procedure for serial usage


Files

file  otSerial.h
 Serial Library for BF51x.

Modules

 Version History
 Serial - Code example

Enumerations

enum  UartId { UART0, UART1, UART2, UART3 }

Functions

void UartEnableSignals (int uart)
 Enable uart signals Set the related port to enable and expose uart signals (txd, rxd).
void UartSetBaud (int uart, int baudRate)
 Init serial port "uart" with specified baudRate. As default serial port is used as standard input/output.
printf and _scanf allow the access to this i/o channel.
Serial defaults are: 8 bit, no parity, one stop bit.
void UartPutChar (int uart, unsigned char c)
 Send a character on specified serial port.
void UartPutBytes (int uart, unsigned char *buf, unsigned int size)
 Send a buffer of bytes on serial port.
void UartPutString (int uart, const char *s)
 Send a C string on serial port.
unsigned char UartGetChar (int uart)
 Wait a character from serial port.
unsigned char UartChar (int uart)
 Read uart data register Read the uart data register without any controls.
bool UartCheckChar (int uart)
 Check if a character is available from serial port.
void UartReceiveService (int uart, int baudRate, void(*pCallback)())
 Set interrupt handler for specific uart. Specify a C procedure used to handle a protocol on received characters from the serial port.

Enumeration Type Documentation

enum UartId
 

Enumeration values:
UART0  Uart 0.
UART1  Uart 1.
UART2  Not available.
UART3  Not available.


Function Documentation

unsigned char UartChar (  int  uart  ) 
 

Parameters:
uart Uart index, see UartId enum.

bool UartCheckChar (  int  uart  ) 
 

Parameters:
uart Uart index, see UartId enum.
Returns:
true = Char available, false = No char available.
See also:

void UartEnableSignals (  int  uart  ) 
 

Parameters:
uart Uart index, see UartId enum.

unsigned char UartGetChar (  int  uart  ) 
 

Parameters:
uart Uart index, see UartId enum.
Returns:
Character from serial port.
See also:

void UartPutBytes (  int  uart,
unsigned char *  buf,
unsigned int  size
) 
 

Parameters:
uart Uart index, see UartId enum.
buf Data pointer.
size Number of byte to send.
See also:

void UartPutChar (  int  uart,
unsigned char  c
) 
 

Parameters:
uart Uart index, see UartId enum.
c Character to send.
See also:

void UartPutString (  int  uart,
const char *  s
) 
 

Parameters:
uart Uart index, see UartId enum.
s Pointer to the string.
See also:

void UartReceiveService (  int  uart,
int  baudRate,
void(*)()  pCallback
) 
 

Parameters:
uart Uart index, see UartId enum.
baudRate Speed of bit data.
pCallback Address of C procedure. It's called at every received char from the uart.

void UartSetBaud (  int  uart,
int  baudRate
) 
 

Parameters:
uart Uart index, see UartId enum.
baudRate Speed of bit data, (115200 suggested).
footer

otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0