Compare code size between many different serial options available via PropGCC and PropWare
#define TEST_PROPWARE_UART
#if (defined TEST_PROPWARE_UART || defined TEST_PROPWARE_UART_PRINTF || \
defined TEST_PROPWARE_FDS || defined TEST_PROPWARE_FDS_PRINTF)
#else
int _cfg_rxpin = -1;
int _cfg_txpin = -1;
int _cfg_baudrate = -1;
#endif
#if (defined TEST_PROPWARE_FDS || defined TEST_PROPWARE_FDS_PRINTF)
#elif defined TEST_SIMPLE
#elif defined TEST_TINYSTREAM
#include <tinystream>
namespace std {
}
#elif defined TEST_TINYIO
#include <tinyio.h>
#elif defined TEST_FDSERIAL
#elif defined TEST_LIBPROPELLER
#include <libpropeller/serial/serial.h>
#endif
uint32_t i = 0;
#if defined TEST_PROPWARE_FDS || defined TEST_PROPWARE_FDS_PRINTF
#elif defined TEST_FDSERIAL
#elif defined TEST_LIBPROPELLER
serial.Start(_cfg_rxpin, _cfg_txpin, _cfg_baudrate);
#endif
while (1) {
#ifdef TEST_PROPWARE_UART
pwOut <<
"Hello, world! " << Printer::Format(3,
'0') << i <<
" 0x" << Printer::Format(2,
'0', 16) << i <<
'\n';
#elif defined TEST_PROPWARE_UART_PRINTF
#elif defined TEST_PROPWARE_FDS
printer << "Hello, world! " << Printer::Format(3, '0') << i << " 0x" << Printer::Format(2, '0', 16) << i << '\n';
#elif defined TEST_PROPWARE_FDS_PRINTF
printer.printf("Hello, world! %03d 0x%02X\n", i, i);
#elif defined TEST_SIMPLE
printi(
"Hello, world! %03d 0x%02x\n", i, i);
#elif defined TEST_TINYSTREAM
std::cout << "Hello, world! " << i << ' ' << i << std::endl;
#elif defined TEST_TINYIO
printf("Hello, world! %03d 0x%02x\n", i, i);
#elif defined TEST_FDSERIAL
#elif defined TEST_LIBPROPELLER
serial.PutFormatted(
"Hello, world! %03d 0x%02X\r\n", i, i);
#endif
i++;
}
}