MODSERIAL with support for KL25Z + RTOS (beta, putc + puts currently)
Fork of MODSERIAL by
Diff: MODSERIAL.h
- Revision:
- 30:913b04338760
- Parent:
- 28:76793a84f9e5
--- a/MODSERIAL.h Fri Jul 12 15:56:20 2013 +0000 +++ b/MODSERIAL.h Tue Jul 16 14:00:58 2013 +0000 @@ -43,6 +43,8 @@ #include "mbed.h" #include "serial_api.h" +//#include <cstdarg> + namespace AjK { @@ -729,19 +731,56 @@ return move(s, max, auto_detect_char); } - #if 0 // Inhereted from Serial/Stream, for documentation only - /** + /** * Function: putc * * Write a character - * Inhereted from Serial/Stream * * @see http://mbed.org/projects/libraries/api/mbed/trunk/Serial#Serial.putc * @ingroup API * @param c The character to write to the serial port */ - int putc(int c); - #endif + int putc(int c) { + _putc(c); + return c; + } + + /** + * Function: puts + * + * Write a string + * + * @ingroup API + * @param s The string to write to the serial port + */ + int puts(char *string) { + int i = 0; + while (string[i]!='\0') { + putc(string[i]); + i++; + } + return 1; + } + + /** + * Function: printf + * + * Write a formatted string + * + * @ingroup API + * @param --- + * + int printf(const char* format, ...) { + std::va_list arg; + va_start(arg, format); + char buffer[30]; + int r = snprintf(buffer, 30, format, arg); + va_end(arg); + puts(buffer); + return r; + + } +*/ #if 0 // Inhereted from Serial/Stream, for documentation only /**