|
PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
|
14 void scanner(
int repeat);
15 void dumpstack(
int vaddr);
25 float fval = 355/113.0;
27 float e = 2.71828184590;
28 char bigtext[] =
"abcdefghijklmnopqrstuvwxyz";
39 putln(
"Hello, world!");
56 for(f = 5.0; f > -5.0; f -= 1.0) {
58 print(
"f = %02.2f, fproblem = %02.2f\n", f, fproblem);
60 for(f = 5.0; f > -5.0; f -= 1.0) {
65 for(f = 5.0; f > -5.0; f -= 1.0) {
66 fproblem = atan(0.0/f);
67 print(
"f = %02.2f, fproblem = %02.2f\n", f, fproblem);
69 for(f = 5.0; f > -5.0; f -= 1.0) {
70 fproblem = atan(0.0/-f);
91 for(
int n = 0; n <
sizeof sval; n++)
93 if(sval[n] >=
' ' && sval[n] <=
'z')
100 t->
txChar(t, sval[n] +
'0');
102 if(sval[n] == 0)
break;
114 putStr(
"\nscan - Type float, then string, then enter: ");
115 scan(
"%f %s", &fval, sval);
116 print(
"%f %s\n", fval, sval);
121 putStr(
"\nsscan - Type float, then string, then enter: ");
124 sscan(buffer,
"%f %s", &fval, sval);
125 sprint(buffer,
"%f %s", fval, sval);
141 sprint(buffer,
"%2d %4d %6d %8d %10d %15d", 2, 4, 6, 8, 10, 15);
144 sprint(buffer,
"%2x %4x %6x %8x %10x %15x", 2, 4, 6, 8, 10, 15);
147 sprint(buffer,
"%2b %4b %6b %8b %10b %15b", 2, 4, 6, 8, 10, 15);
150 sprint(buffer,
"%2.0f %4.1f %6.2f %8.3f %10.4f %15.6f\n", e, e, e, e, e, e);
153 for(n = 0; n < 1; n++) {
155 putStr(
"\nEnter two floating point numbers");
161 sscan(buffer,
"%f %f", &f, &fval2);
167 putStr(
"\nEnter a floating point number: ");
171 putStr(
"\nClose default console.\n");
176 writeStr(text,
"SimpleSerial Started.\n");
179 sprint(buffer,
"Hello, world! Again!\n");
184 writeStr(text,
"\ndscan - Type float, then string, then enter: ");
185 dscan(text,
"%f %s", &fval, sval);
186 dprint(text,
"%f %s\n", fval, sval);
214 writeStr(text,
"\nEnter a decimal number: ");
216 writeStr(text,
"\nEnter a hexadecimal number: ");
218 writeStr(text,
"\nEnter a binary number: ");
220 writeStr(text,
"\nEnter a floating point number: ");
223 writeStr(text,
"\nEnter values as: decimal hex float float string\n");
226 sscan(buffer,
"%d %x %f %f %s", &ival, &xval, &fval, &fval2, sval);
227 sprint(buffer,
"%s %d %x %f %f\n", sval, ival, xval, fval, fval2);
240 void scanner(
int repeat)
253 putStr(
"\nEnter chars: ");
261 putStr(
"\nEnter chars: ");
262 scan(
"%c %c %2s", &c1, &c2, buf);
274 void dumpstack(
int vaddr)
276 extern int _stack_end;
279 printi(
"vaddr *%x = %x\n", &vaddr, vaddr);
280 for(; n < &_stack_end; n+=4)
282 printi(
"stk[%x] %x\n", n, *(
unsigned int*)n);
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.
int putln(const char *str)
Print string + new line on the transmit debug port.
terminal * simpleterm_reopen(int rxpin, int txpin, int mode, int baud)
Closes and the simple terminal connection, and reopens it in the calling cog. Depending on the parame...
int(* txChar)(struct text_struct *p, int ch)
void writeBinLen(text_t *device, int value, int digits)
Print string representation of a binary number to output with a fixed number of digits.
terminal * simpleterm_pointer(void)
Get default device pointer to SimpleIDE Terminal.
int putStrLen(char *str, int width)
Send a string with a certain number of characters.
int writeLine(text_t *device, char *str)
Send a string + new line to the device.
This library supports creating and managing one or more half duplex serial connections with periphera...
int int dscan(text_t *device, const char *fmt,...) __attribute__((format(printf
Convert formatted device input to the "..." args. The input is limited to 256 bytes.
void putFloat(float value)
Print string representation of a 32 bit floating point number to the debug port.
int dprint(text_t *device, const char *format,...) __attribute__((format(printf
Print format "..." args to the device The output is limited to 256 bytes.
int putLine(const char *str)
Print string + new line on the transmit debug port. This is an alias of putln.
void putDec(int value)
Print string representation of a decimal number to the debug port.
char * getStr(char *buffer, int max)
Get string of chars from the debug port.
void serial_close(serial *device)
Close 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.
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
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 simpleterm_close(void)
Closes the SimpleIDE Terminal connection in one cog so that it can be opened in another cog with simp...
float getFloat(void)
Get floating point number from the debug port.
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.
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 putChar(char c)
Print a char to the debug port.
int int scan(const char *fmt,...) __attribute__((format(printf
Convert formatted simple terminal input to the "..." args. The input is limited to 256 bytes.
Structure that contains data used by simple text device libraries.
float readFloat(text_t *device)
Get floating point number from the device.
serial * serial_open(int rxpin, int txpin, int mode, int baudrate)
Open a simple (half duplex) serial connection.
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 putStr(const char *str)
Print string to the debug port.
int readHex(text_t *device)
Get hexadecimal number from the device.
int writeStrLen(text_t *device, char *str, int width)
Send a string to the device.
int printi(const char *format,...) __attribute__((format(printf
Print integer and char only format "..." args to the default simple terminal 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.