fx2debug.h

The fx2debug.h header contains templated debug serial port bitbang routines for the Cypress FX2 series implemented in assembly. This header is the complete implementation of the debug serial port and does not have a corresponding library.

Reference

Defines

DEFINE_DEBUG_FN(name, tx, baud)

This macro defines a function void name(uint8_t c) that implements a robust blocking serial transmitter for debug output. The tx parameter may point to any pin, and is defined in the format Pxn. The serial format is fixed at 8 data bits, no parity, 1 stop bit, and the baud rate is configurable, up to 230400 at 48 MHz, up to 115200 at 24 MHz, and up to 57600 at 12 MHz.

For example, invoking the macro as DEFINE_DEBUG_FN(tx_byte, PA0, 57600) defines a routine void tx_byte(uint8_t c) that assumes an UART receiver’s RX pin is connected to A0.

DEFINE_DEBUG_PUTCHAR_FN(tx, baud)

Same as DEFINE_DEBUG_FN(), but defines an int putchar(int c) routine that can be used with the printf family of functions. (The C standard requires putchar to have the specified signature).