MicrOS
micros_serial.c File Reference
#include "micros_serial.h"

Functions

void micros_serial_init (unsigned int port, unsigned int baud_rate, unsigned int data_bits, unsigned int stop_bits, unsigned int parity)
 Inits serial port. More...
 
bool micros_serial_is_busy (unsigned int port)
 Checks if the specified serial port is busy. More...
 
bool micros_serial_is_queue_empty (unsigned int port)
 Checks if the specified serial port queue is empty. More...
 
void micros_serial_send (unsigned int port, char c)
 Sends a char on the specified serial port. More...
 
void micros_serial_send_string (unsigned int port, char *str)
 Sends a string on the specified serial port. More...
 
char micros_serial_receive (unsigned int port)
 Reads a char on the specified serial port. More...
 

Function Documentation

◆ micros_serial_init()

void micros_serial_init ( unsigned int  port,
unsigned int  baud_rate,
unsigned int  data_bits,
unsigned int  stop_bits,
unsigned int  parity 
)

Inits serial port.

Inits serial port with the specified parameters

Parameters
portSerial port ID (MICROS_COMx_PORT).
baud_rateSpeed of the serial port in bauds.
data_bitsData length (set 8 for default).
stop_bitsStop bits for the single message (set 1 for default).
parityParity of the message (set MICROS_PARITY_NONE for default).

◆ micros_serial_is_busy()

bool micros_serial_is_busy ( unsigned int  port)

Checks if the specified serial port is busy.

Checks if the specified serial port is busy.

Parameters
portSerial port ID (MICROS_COMx_PORT).
Returns
True if the specified serial port is busy, otherwise false.

◆ micros_serial_is_queue_empty()

bool micros_serial_is_queue_empty ( unsigned int  port)

Checks if the specified serial port queue is empty.

Checks if the specified serial port queue is empty.

Parameters
portSerial port ID (MICROS_COMx_PORT).
Returns
True if the specified serial port queue is empty, otherwise false.

◆ micros_serial_receive()

char micros_serial_receive ( unsigned int  port)

Reads a char on the specified serial port.

Reads a char on the specified serial port.

Parameters
portSerial port ID (MICROS_COMx_PORT).
Returns
True if the specified serial port queue is empty, otherwise false.

◆ micros_serial_send()

void micros_serial_send ( unsigned int  port,
char  c 
)

Sends a char on the specified serial port.

Sends a char on the specified serial port.

Parameters
portSerial port ID (MICROS_COMx_PORT).
cChar to send.

◆ micros_serial_send_string()

void micros_serial_send_string ( unsigned int  port,
char *  str 
)

Sends a string on the specified serial port.

Sends a string on the specified serial port.

Parameters
portSerial port ID (MICROS_COMx_PORT).
stringString to send.