PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TestPrint.h 574B

3 years ago
123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * A print class for testing the encoder
  3. */
  4. class TestPrint : public Print {
  5. private:
  6. //a small test buffer
  7. uint8_t buffer[64];
  8. //pointer to the current write spot
  9. int bufferPointer;
  10. public:
  11. TestPrint(){
  12. bufferPointer = 0;
  13. }
  14. size_t write(uint8_t character) {
  15. buffer[bufferPointer++] = character;
  16. return character;
  17. }
  18. int size(){
  19. return bufferPointer;
  20. }
  21. uint8_t at(int index){
  22. return buffer[index];
  23. }
  24. void clear(){
  25. bufferPointer = 0;
  26. }
  27. };