Closed GoogleCodeExporter closed 9 years ago
Bitlash user defined functions are able to accept string constant arguments.
In your user function, cast the result of getarg(n) to char* and off you go.
So ug8_text(22,33,"foo") would work just fine for text placement.
Original comment by bill....@palmeta.com
on 19 Apr 2012 at 1:48
Hi Bill
Thanks for clarification!
Original comment by olikr...@gmail.com
on 19 Apr 2012 at 2:44
If you like, it is pretty easy to get printf-formatted output using the
built-in bitlash printf() formatter via the func_printf_handler hook, something
like this:
//////////
//
// Send one byte of generated output to the text display system
// Used in func_xyprintf() below.
//
void display_put_char(byte) {
// call your function to display one byte of generated output
// do bookkeeping for the position of the next char here too
...
}
//////////
//
// xyprintf(): print formatted output at [x,y]
//
// Examples:
// xyprintf(0, 0, "Hello, world!");
// xyprintf(22, 5, "Time: %5d", millis);
//
numvar func_xyprintf(void) {
// call your function to save the text rendering position
// set_xy(getarg(0), getarg(1));
...
// generate formatted output
setOutputHandler(&display_put_char); // redirect output to handler above
func_printf_handler(3,4); // format=arg(3), optional args start at 4
resetOutputHandler(); // restore normal serial output
return 0;
}
Original comment by bill....@palmeta.com
on 19 Apr 2012 at 3:25
wow, but i guess i have to implement some basic functionailty first.
Original comment by olikr...@gmail.com
on 19 Apr 2012 at 3:46
i never found time to implement this :-(
Closing this for now...
Original comment by olikr...@gmail.com
on 22 Jan 2014 at 7:57
Original issue reported on code.google.com by
olikr...@gmail.com
on 16 Apr 2012 at 11:11