|
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
22 float fval = 355/113.0;
24 float e = 2.71828184590;
30 writeStr(term,
"Hello fdserial!\n\n");
32 writeStr(term,
"Press keys for 10 seconds to enter chars in buffer.");
47 sprint(buffer,
"%2d %4d %6d %8d %10d %15d", 2, 4, 6, 8, 10, 15);
50 sprint(buffer,
"%2x %4x %6x %8x %10x %15x", 2, 4, 6, 8, 10, 15);
53 sprint(buffer,
"%2b %4b %6b %8b %10b %15b", 2, 4, 6, 8, 10, 15);
56 sprint(buffer,
"%2.0f %4.1f %6.2f %8.3f %10.4f %15.6f\n", e, e, e, e, e, e);
59 for(n = 0; n < 2; n++) {
61 writeStr(term,
"\nEnter two floating point numbers");
67 sscan(buffer,
"%f %f", &f, &fval2);
73 writeStr(term,
"\nEnter a floating point number: ");
76 sprint(buffer,
"\nHello again!\n");
108 writeStr(term,
"\nfdserial RX Ready? ");
110 writeStr(term,
"\nPress any key: ");
127 writeStr(term,
"\nEnter a decimal number: ");
129 writeStr(term,
"\nEnter a hexadecimal number: ");
131 writeStr(term,
"\nEnter a binary number: ");
133 writeStr(term,
"\nEnter a floating point number: ");
136 writeStr(term,
"\nEnter values as: decimal hex float float string\n");
139 sscan(buffer,
"%d %x %f %f %s", &ival, &xval, &fval, &fval2, sval);
140 sprint(buffer,
"%s %d %x %f %f\n", sval, ival, xval, fval, fval2);
int fdserial_rxReady(fdserial *term)
Check if a byte is ready in the receive buffer.
void writeDecLen(text_t *device, int value, int width)
Print string representation of a decimal number to output device with a fixed number of digits.
void writeHexLen(text_t *device, int value, int digits)
Print string representation of a hexadecimal number to output device with a fixed number of digits.
void writeBinLen(text_t *device, int value, int digits)
Print string representation of a binary number to output with a fixed number of digits.
int writeLine(text_t *device, char *str)
Send a string + new line to the device.
fdserial * fdserial_open(int rxpin, int txpin, int mode, int baudrate)
Open a full duplex serial connection.
void writeDec(text_t *device, int value)
Print string representation of a decimal number to output.
char * readStr(text_t *device, char *buffer, int max)
Get string of chars from the device.
void writeFloatPrecision(text_t *device, float value, int width, int precision)
Print string representation of a 32 bit floating point number to device with a certain number of deci...
int readDec(text_t *device)
Get decimal number from the device.
void writeFloat(text_t *device, float value)
Print string representation of a 32 bit floating point number to device.
int readChar(text_t *device)
Get char from the device.
#define CLKFREQ
Returns the current clock frequency.
int fdserial_rxCount(fdserial *term)
Get number of bytes available in the receive buffer without receiving any. NOTE: This function is not...
void writeHex(text_t *device, int value)
Print string representation of a hexadecimal number to output device.
void writeChar(text_t *device, char c)
Send a character to the device.
void fdserial_rxFlush(fdserial *term)
Empties the receive buffer.
Structure that contains data used by simple text device libraries.
#define waitcnt(a)
Wait until system counter reaches a value.
float readFloat(text_t *device)
Get floating point number from the device.
#define CNT
The system clock count.
int int int sprint(char *buffer, const char *format,...) __attribute__((format(printf
Print format "..." args to the output buffer. The output buffer must be big enough for the output.
int writeStr(text_t *device, char *str)
Send a string to the device.
void writeBin(text_t *device, int value)
Print string representation of a binary number to the receive device.
int readHex(text_t *device)
Get hexadecimal number from the device.
This library supports creating and managing one or more full duplex serial connections with periphera...
int writeStrLen(text_t *device, char *str, int width)
Send a string to the device.
int int int int sscan(const char *buffer, const char *fmt,...) __attribute__((format(printf
Convert formatted buffer to the "..." args.
int readBin(text_t *device)
Get binary number from the device.