Browse Source

Support both char * and uintu_t * in Print & Stream (Matthijs Kooijman)

teensy4-core
PaulStoffregen 11 years ago
parent
commit
645b709750
2 changed files with 7 additions and 0 deletions
  1. +1
    -0
      teensy/Print.h
  2. +6
    -0
      teensy/Stream.h

+ 1
- 0
teensy/Print.h View File

virtual size_t write(uint8_t b); virtual size_t write(uint8_t b);
size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); } size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
virtual size_t write(const uint8_t *buffer, size_t size); virtual size_t write(const uint8_t *buffer, size_t size);
size_t write(const char *buffer, size_t size) { return write((const uint8_t *)buffer, size); }
size_t print(const String &s); size_t print(const String &s);
size_t print(char c) { return write((uint8_t)c); } size_t print(char c) { return write((uint8_t)c); }
size_t print(const char s[]) { return write(s); } size_t print(const char s[]) { return write(s); }

+ 6
- 0
teensy/Stream.h View File



void setTimeout(unsigned long timeout); void setTimeout(unsigned long timeout);
bool find(char *target); bool find(char *target);
bool find(uint8_t *target) { return find ((char *)target); }
bool find(char *target, size_t length); bool find(char *target, size_t length);
bool find(uint8_t *target, size_t length) { return find ((char *)target, length); }
bool findUntil(char *target, char *terminator); bool findUntil(char *target, char *terminator);
bool findUntil(uint8_t *target, char *terminator) { return findUntil((char *)target, terminator); }
bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen);
bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) {return findUntil((char *)target, targetLen, terminate, termLen); }
long parseInt(); long parseInt();
long parseInt(char skipChar); long parseInt(char skipChar);
float parseFloat(); float parseFloat();
float parseFloat(char skipChar); float parseFloat(char skipChar);
size_t readBytes(char *buffer, size_t length); size_t readBytes(char *buffer, size_t length);
size_t readBytes( uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); }
size_t readBytesUntil(char terminator, char *buffer, size_t length); size_t readBytesUntil(char terminator, char *buffer, size_t length);
size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length) { return readBytesUntil(terminator, (char *)buffer, length); }
String readString(size_t max = 120); String readString(size_t max = 120);
String readStringUntil(char terminator, size_t max = 120); String readStringUntil(char terminator, size_t max = 120);
int getReadError() { return read_error; } int getReadError() { return read_error; }

Loading…
Cancel
Save