PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Macros | Functions
serial.h File Reference

Provides definitions for some low level serial port routines. More...

#include <compiler.h>
+ Include dependency graph for serial.h:

Go to the source code of this file.

Macros

#define _DEFAULT_SERIAL_PUTCHAR   _WEAK int putchar(int c) { return _serial_putchar(c); }
 Define a default putchar which will use the serial port. More...
 

Functions

int _serial_tx (int c, unsigned int txmask, unsigned int bitcycles)
 Transmit a byte out a pin. More...
 
int _serial_putchar (int c)
 Transmit a byte out the serial port. More...
 

Detailed Description

Provides definitions for some low level serial port routines.

Copyright (c) 2015 by Total Spectrum Software Inc. MIT Licensed

Definition in file serial.h.

Macro Definition Documentation

◆ _DEFAULT_SERIAL_PUTCHAR

#define _DEFAULT_SERIAL_PUTCHAR   _WEAK int putchar(int c) { return _serial_putchar(c); }

Define a default putchar which will use the serial port.

This macro defines a default for putchar which will use _serial_putchar. The definition is "weak", so multiple uses of it are harmless, and will be overridden by any "strong" (normal) definition for putchar()

Definition at line 45 of file serial.h.

Function Documentation

◆ _serial_putchar()

int _serial_putchar ( int  c)

Transmit a byte out the serial port.

This function transmits a single byte using _serial_tx. The pin and baud rate are selected from the defaults that can be changed by the loader.

Parameters
cThe 8-bit character to transmit (upper 24 bits are ignored).

◆ _serial_tx()

int _serial_tx ( int  c,
unsigned int  txmask,
unsigned int  bitcycles 
)

Transmit a byte out a pin.

This function transmits a single byte. The transmission is half-duplex (i.e. no bytes can be received while it is happening) and uses the current cog.

Parameters
cThe 8-bit character to transmit (upper 24 bits must be 0).
txmaskA bit mask with a 1 set to indicate the pin to use, 0 elsewhere.
bitcyclesTime (in CNT cycles) to wait between transmitting bits.