mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.4.0 PrintCharArray
This commit is contained in:
parent
8b7f30980a
commit
50372e006c
2
libraries/PrintCharArray/.github/FUNDING.yml
vendored
2
libraries/PrintCharArray/.github/FUNDING.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: RobTillaart
|
github: RobTillaart
|
||||||
|
custom: "https://www.paypal.me/robtillaart"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
|
||||||
name: Arduino-lint
|
name: Arduino-lint
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: arduino/arduino-lint-action@v1
|
- uses: arduino/arduino-lint-action@v1
|
||||||
with:
|
with:
|
||||||
library-manager: update
|
library-manager: update
|
||||||
compliance: strict
|
compliance: strict
|
@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
name: Arduino CI
|
name: Arduino CI
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
@ -6,12 +5,14 @@ on: [push, pull_request]
|
|||||||
jobs:
|
jobs:
|
||||||
runTest:
|
runTest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 2.6
|
ruby-version: 2.6
|
||||||
- run: |
|
- run: |
|
||||||
|
sudo sysctl vm.mmap_rnd_bits=28
|
||||||
gem install arduino_ci
|
gem install arduino_ci
|
||||||
arduino_ci.rb
|
arduino_ci.rb
|
||||||
|
@ -9,10 +9,10 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: json-syntax-check
|
- name: json-syntax-check
|
||||||
uses: limitusus/json-syntax-check@v1
|
uses: limitusus/json-syntax-check@v2
|
||||||
with:
|
with:
|
||||||
pattern: "\\.json$"
|
pattern: "\\.json$"
|
||||||
|
|
@ -6,11 +6,19 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
## [0.4.0] - 2024-04-11
|
||||||
|
- add template class version - thanks to me21
|
||||||
|
- update readme.md
|
||||||
|
- update GitHub actions
|
||||||
|
- update examples
|
||||||
|
- minor edits
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## [0.3.4] - 2023-11-15
|
## [0.3.4] - 2023-11-15
|
||||||
- update readme.md
|
- update readme.md
|
||||||
- update changelog.md
|
- update changelog.md
|
||||||
|
|
||||||
|
|
||||||
## [0.3.3] - 2022-11-22
|
## [0.3.3] - 2022-11-22
|
||||||
- add changelog.md
|
- add changelog.md
|
||||||
- add RP2040 to build-CI
|
- add RP2040 to build-CI
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2017-2023 Rob Tillaart
|
Copyright (c) 2017-2024 Rob Tillaart
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: PrintCharArray.h
|
// FILE: PrintCharArray.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.3.4
|
// VERSION: 0.4.0
|
||||||
// PURPOSE: Class that captures prints into a char array
|
// PURPOSE: Class that captures prints into a char array
|
||||||
// DATE: 2017-12-07
|
// DATE: 2017-12-07
|
||||||
// URL: https://github.com/RobTillaart/PrintCharArray
|
// URL: https://github.com/RobTillaart/PrintCharArray
|
||||||
@ -12,7 +12,7 @@
|
|||||||
#include "Print.h"
|
#include "Print.h"
|
||||||
|
|
||||||
|
|
||||||
#define PRINTCHARARRAY_VERSION (F("0.3.4"))
|
#define PRINTCHARARRAY_VERSION (F("0.4.0"))
|
||||||
|
|
||||||
#ifndef PRINTCHARARRAY_MAX_BUFFER_SIZE
|
#ifndef PRINTCHARARRAY_MAX_BUFFER_SIZE
|
||||||
#define PRINTCHARARRAY_MAX_BUFFER_SIZE 250
|
#define PRINTCHARARRAY_MAX_BUFFER_SIZE 250
|
||||||
@ -67,14 +67,14 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
int available()
|
int available()
|
||||||
{
|
{
|
||||||
return (_bufSize - _index);
|
return (_bufSize - _index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// int length() { return _index; }; // better as size()?
|
// int length() { return _index; }; // better as size()?
|
||||||
int size()
|
int size()
|
||||||
{
|
{
|
||||||
return _index;
|
return _index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,10 +85,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char * getBuffer()
|
char * getBuffer()
|
||||||
{
|
{
|
||||||
_buffer[_index] = '\0';
|
_buffer[_index] = '\0';
|
||||||
return _buffer;
|
return _buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -99,5 +99,72 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
template<int BUFSIZE>
|
||||||
|
class PrintCharArrayT: public Print
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
size_t write(uint8_t c)
|
||||||
|
{
|
||||||
|
if (_index < BUFSIZE - 1)
|
||||||
|
{
|
||||||
|
_buffer[_index++] = c;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t write(uint8_t * str, uint8_t length)
|
||||||
|
{
|
||||||
|
if ( (int(_index) + length) >= BUFSIZE) return 0; // does not fit.
|
||||||
|
|
||||||
|
uint8_t len = length;
|
||||||
|
uint8_t i = 0;
|
||||||
|
while (len--)
|
||||||
|
{
|
||||||
|
_buffer[_index++] = str[i++];
|
||||||
|
}
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int available()
|
||||||
|
{
|
||||||
|
return (BUFSIZE - _index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int size()
|
||||||
|
{
|
||||||
|
return _index;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int bufSize()
|
||||||
|
{
|
||||||
|
return BUFSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char * getBuffer()
|
||||||
|
{
|
||||||
|
_buffer[_index] = '\0';
|
||||||
|
return _buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
char _buffer[BUFSIZE];
|
||||||
|
uint8_t _index = 0;
|
||||||
|
};
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ void setup()
|
|||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println(__FILE__);
|
Serial.println(__FILE__);
|
||||||
|
Serial.print("PRINTCHARARRAY_VERSION: ");
|
||||||
|
Serial.println(PRINTCHARARRAY_VERSION);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
Serial.println(ps.available());
|
Serial.println(ps.available());
|
||||||
ps.println("Hello World");
|
ps.println("Hello World");
|
||||||
@ -34,5 +37,4 @@ void loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ void setup()
|
|||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println(__FILE__);
|
Serial.println(__FILE__);
|
||||||
|
Serial.print("PRINTCHARARRAY_VERSION: ");
|
||||||
|
Serial.println(PRINTCHARARRAY_VERSION);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
Serial.println("Determine length of 10 random numbers and right ");
|
Serial.println("Determine length of 10 random numbers and right ");
|
||||||
Serial.println("align the numbers in a table with their sum.");
|
Serial.println("align the numbers in a table with their sum.");
|
||||||
@ -53,4 +56,4 @@ void printSpaces(int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
//
|
||||||
|
// FILE: printCharArray2_template.ino
|
||||||
|
// AUTHOR: Rob Tillaart
|
||||||
|
// PURPOSE: demo right alignment
|
||||||
|
// URL: https://github.com/RobTillaart/PrintCharArray
|
||||||
|
|
||||||
|
|
||||||
|
#include "PrintCharArray.h"
|
||||||
|
|
||||||
|
PrintCharArrayT<40> ps;
|
||||||
|
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial.println(__FILE__);
|
||||||
|
Serial.print("PRINTCHARARRAY_VERSION: ");
|
||||||
|
Serial.println(PRINTCHARARRAY_VERSION);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
Serial.println("Determine length of 10 random numbers and right ");
|
||||||
|
Serial.println("align the numbers in a table with their sum.");
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
uint32_t sum = 0;
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
uint32_t rn = random(100000000);
|
||||||
|
ps.clear();
|
||||||
|
ps.println(rn);
|
||||||
|
printSpaces(15 - ps.size());
|
||||||
|
sum += rn;
|
||||||
|
Serial.print(ps.getBuffer());
|
||||||
|
}
|
||||||
|
Serial.print("================ +\n");
|
||||||
|
ps.clear();
|
||||||
|
ps.println(sum);
|
||||||
|
printSpaces(15 - ps.size());
|
||||||
|
Serial.println(sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void printSpaces(int n)
|
||||||
|
{
|
||||||
|
if (n <= 0) return;
|
||||||
|
while (n)
|
||||||
|
{
|
||||||
|
Serial.print(' ');
|
||||||
|
n--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- END OF FILE --
|
@ -3,11 +3,12 @@
|
|||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// PURPOSE: demo with XML writer
|
// PURPOSE: demo with XML writer
|
||||||
// URL: https://github.com/RobTillaart/PrintCharArray
|
// URL: https://github.com/RobTillaart/PrintCharArray
|
||||||
|
// https://github.com/RobTillaart/XMLWriter
|
||||||
|
|
||||||
|
|
||||||
#include "PrintCharArray.h"
|
#include "PrintCharArray.h"
|
||||||
|
|
||||||
#include "XMLWriter.h" // https://github.com/RobTillaart/XMLWriter
|
#include "XMLWriter.h" // https://github.com/RobTillaart/XMLWriter
|
||||||
|
|
||||||
PrintCharArray ps(250);
|
PrintCharArray ps(250);
|
||||||
XMLWriter XML(&ps);
|
XMLWriter XML(&ps);
|
||||||
@ -17,6 +18,9 @@ void setup()
|
|||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println(__FILE__);
|
Serial.println(__FILE__);
|
||||||
|
Serial.print("PRINTCHARARRAY_VERSION: ");
|
||||||
|
Serial.println(PRINTCHARARRAY_VERSION);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
ps.clear();
|
ps.clear();
|
||||||
|
|
||||||
@ -32,7 +36,7 @@ void setup()
|
|||||||
XML.tagClose();
|
XML.tagClose();
|
||||||
XML.flush();
|
XML.flush();
|
||||||
|
|
||||||
// write the XML generated in one call
|
// write the XML generated in one call
|
||||||
Serial.println(ps.getBuffer());
|
Serial.println(ps.getBuffer());
|
||||||
Serial.println(ps.available());
|
Serial.println(ps.available());
|
||||||
}
|
}
|
||||||
@ -43,5 +47,5 @@ void loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
printCharArray4.ino
|
||||||
|
PRINTCHARARRAY_VERSION: 0.4.0
|
||||||
|
|
||||||
|
Using direct print
|
||||||
|
1000
|
||||||
|
1001
|
||||||
|
1002
|
||||||
|
1003
|
||||||
|
1004
|
||||||
|
1005
|
||||||
|
1006
|
||||||
|
1007
|
||||||
|
1008
|
||||||
|
1009
|
||||||
|
|
||||||
|
2312
|
||||||
|
|
||||||
|
Using printCharArray
|
||||||
|
1000
|
||||||
|
1001
|
||||||
|
1002
|
||||||
|
1003
|
||||||
|
1004
|
||||||
|
1005
|
||||||
|
1006
|
||||||
|
1007
|
||||||
|
1008
|
||||||
|
1009
|
||||||
|
|
||||||
|
2384
|
||||||
|
|
||||||
|
print PrintCharArray buffer again
|
||||||
|
1000
|
||||||
|
1001
|
||||||
|
1002
|
||||||
|
1003
|
||||||
|
1004
|
||||||
|
1005
|
||||||
|
1006
|
||||||
|
1007
|
||||||
|
1008
|
||||||
|
1009
|
||||||
|
|
||||||
|
488
|
||||||
|
|
||||||
|
FREE: 140
|
@ -16,18 +16,25 @@ void setup()
|
|||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println(__FILE__);
|
Serial.println(__FILE__);
|
||||||
|
Serial.print("PRINTCHARARRAY_VERSION: ");
|
||||||
|
Serial.println(PRINTCHARARRAY_VERSION);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
Serial.println("Using direct print");
|
Serial.println("Using direct print");
|
||||||
|
delay(100);
|
||||||
start = micros();
|
start = micros();
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
Serial.println(1000 + i);
|
Serial.println(1000 + i);
|
||||||
}
|
}
|
||||||
stop = micros();
|
stop = micros();
|
||||||
|
Serial.println();
|
||||||
Serial.println(stop - start);
|
Serial.println(stop - start);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
Serial.println("Using printCharArray");
|
Serial.println("Using printCharArray");
|
||||||
|
delay(100);
|
||||||
|
|
||||||
start = micros();
|
start = micros();
|
||||||
ps.clear();
|
ps.clear();
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
@ -39,7 +46,9 @@ void setup()
|
|||||||
Serial.println(stop - start);
|
Serial.println(stop - start);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
Serial.println("print PrintCharArray again");
|
Serial.println("print PrintCharArray buffer again");
|
||||||
|
delay(100);
|
||||||
|
|
||||||
start = micros();
|
start = micros();
|
||||||
Serial.println(ps.getBuffer());
|
Serial.println(ps.getBuffer());
|
||||||
stop = micros();
|
stop = micros();
|
||||||
@ -56,5 +65,4 @@ void loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
printCharArray4.ino
|
||||||
|
PRINTCHARARRAY_VERSION: 0.4.0
|
||||||
|
|
||||||
|
Using direct print
|
||||||
|
1000
|
||||||
|
1001
|
||||||
|
1002
|
||||||
|
1003
|
||||||
|
1004
|
||||||
|
1005
|
||||||
|
1006
|
||||||
|
1007
|
||||||
|
1008
|
||||||
|
1009
|
||||||
|
|
||||||
|
2312
|
||||||
|
|
||||||
|
Using printCharArray
|
||||||
|
1000
|
||||||
|
1001
|
||||||
|
1002
|
||||||
|
1003
|
||||||
|
1004
|
||||||
|
1005
|
||||||
|
1006
|
||||||
|
1007
|
||||||
|
1008
|
||||||
|
1009
|
||||||
|
|
||||||
|
2384
|
||||||
|
|
||||||
|
print PrintCharArray buffer again
|
||||||
|
1000
|
||||||
|
1001
|
||||||
|
1002
|
||||||
|
1003
|
||||||
|
1004
|
||||||
|
1005
|
||||||
|
1006
|
||||||
|
1007
|
||||||
|
1008
|
||||||
|
1009
|
||||||
|
|
||||||
|
488
|
||||||
|
|
||||||
|
FREE: 140
|
@ -0,0 +1,68 @@
|
|||||||
|
//
|
||||||
|
// FILE: printCharArray4_template.ino
|
||||||
|
// AUTHOR: Rob Tillaart
|
||||||
|
// PURPOSE: demo it takes less time to send data out.
|
||||||
|
// URL: https://github.com/RobTillaart/PrintCharArray
|
||||||
|
|
||||||
|
|
||||||
|
#include "PrintCharArray.h"
|
||||||
|
|
||||||
|
PrintCharArrayT<200> ps;
|
||||||
|
|
||||||
|
uint32_t start, stop;
|
||||||
|
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial.println(__FILE__);
|
||||||
|
Serial.print("PRINTCHARARRAY_VERSION: ");
|
||||||
|
Serial.println(PRINTCHARARRAY_VERSION);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
Serial.println("Using direct print");
|
||||||
|
delay(100);
|
||||||
|
start = micros();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
Serial.println(1000 + i);
|
||||||
|
}
|
||||||
|
stop = micros();
|
||||||
|
Serial.println();
|
||||||
|
Serial.println(stop - start);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
Serial.println("Using printCharArray");
|
||||||
|
delay(100);
|
||||||
|
|
||||||
|
start = micros();
|
||||||
|
ps.clear();
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
ps.println(1000 + i);
|
||||||
|
}
|
||||||
|
Serial.println(ps.getBuffer());
|
||||||
|
stop = micros();
|
||||||
|
Serial.println(stop - start);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
Serial.println("print PrintCharArray buffer again");
|
||||||
|
delay(100);
|
||||||
|
|
||||||
|
start = micros();
|
||||||
|
Serial.println(ps.getBuffer());
|
||||||
|
stop = micros();
|
||||||
|
Serial.println(stop - start);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
Serial.print("FREE: ");
|
||||||
|
Serial.println(ps.available());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- END OF FILE --
|
@ -7,13 +7,16 @@
|
|||||||
|
|
||||||
#include "PrintCharArray.h"
|
#include "PrintCharArray.h"
|
||||||
|
|
||||||
PrintCharArray ps(100);
|
PrintCharArray ps(50);
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println(__FILE__);
|
Serial.println(__FILE__);
|
||||||
|
Serial.print("PRINTCHARARRAY_VERSION: ");
|
||||||
|
Serial.println(PRINTCHARARRAY_VERSION);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
Serial.println(ps.available());
|
Serial.println(ps.available());
|
||||||
ps.println("Hello World");
|
ps.println("Hello World");
|
||||||
@ -34,5 +37,5 @@ void loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# Data types (KEYWORD1)
|
# Data types (KEYWORD1)
|
||||||
PrintCharArray KEYWORD1
|
PrintCharArray KEYWORD1
|
||||||
|
PrintCharArrayT KEYWORD1
|
||||||
|
|
||||||
|
|
||||||
# Methods and Functions (KEYWORD2)
|
# Methods and Functions (KEYWORD2)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/PrintCharArray.git"
|
"url": "https://github.com/RobTillaart/PrintCharArray.git"
|
||||||
},
|
},
|
||||||
"version": "0.3.4",
|
"version": "0.4.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "*",
|
"frameworks": "*",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=PrintCharArray
|
name=PrintCharArray
|
||||||
version=0.3.4
|
version=0.4.0
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Library to capture prints into a char array.
|
sentence=Library to capture prints into a char array.
|
||||||
|
@ -29,12 +29,30 @@ Applications
|
|||||||
- use to prevent "display line overflow" (e.g. floats).
|
- use to prevent "display line overflow" (e.g. floats).
|
||||||
- use to right align output (see examples).
|
- use to right align output (see examples).
|
||||||
|
|
||||||
|
#### Template class
|
||||||
|
|
||||||
|
Since 0.4.0 the library has a template class too - Thanks to me21.
|
||||||
|
See also issue #7.
|
||||||
|
|
||||||
|
This template class is called PrintCharArrayT for now.
|
||||||
|
|
||||||
|
The interface and functionality is similar (except constructor).
|
||||||
|
Performance is similar, footprint is smaller on AVR (no malloc lib).
|
||||||
|
The space needed will not be dynamically allocated (stack iso heap).
|
||||||
|
|
||||||
|
```
|
||||||
|
printCharArray4.ino = 3532 bytes. global var use 422 bytes.
|
||||||
|
printCharArray4_template.ino = 2840 bytes. global var use 627 bytes.
|
||||||
|
```
|
||||||
|
|
||||||
|
This template version needs more testing, so labelled **experimental** for now.
|
||||||
|
|
||||||
|
|
||||||
#### Related
|
#### Related
|
||||||
|
|
||||||
- https://github.com/RobTillaart/PrintCharArray (captures data in a char buffer)
|
- https://github.com/RobTillaart/PrintCharArray captures data in a char array buffer.
|
||||||
- https://github.com/RobTillaart/PrintSize (counts length of a number of print commands)
|
- https://github.com/RobTillaart/PrintSize counts length of a number of print commands.
|
||||||
- https://github.com/RobTillaart/PrintString (captures data in a String)
|
- https://github.com/RobTillaart/PrintString captures data in a String.
|
||||||
|
|
||||||
|
|
||||||
## Interface
|
## Interface
|
||||||
@ -55,6 +73,13 @@ Recall that a char array must have a '\0' delimiter.
|
|||||||
- **char \* getBuffer()** to access the buffer.
|
- **char \* getBuffer()** to access the buffer.
|
||||||
|
|
||||||
|
|
||||||
|
## Interface template version
|
||||||
|
|
||||||
|
- **PrintCharArrayT<int BUFSIZE>** constructor, no default size.
|
||||||
|
|
||||||
|
Remaining interface is identical.
|
||||||
|
|
||||||
|
|
||||||
## Operation
|
## Operation
|
||||||
|
|
||||||
See examples.
|
See examples.
|
||||||
@ -68,22 +93,26 @@ See examples.
|
|||||||
|
|
||||||
#### Should
|
#### Should
|
||||||
|
|
||||||
- move code to .cpp file
|
|
||||||
- testing
|
- testing
|
||||||
|
- platforms
|
||||||
|
- template version
|
||||||
|
|
||||||
#### Could
|
#### Could
|
||||||
|
|
||||||
- examples
|
- examples
|
||||||
- inject spaces in "middle align" example? possible?
|
- inject spaces in "middle align" example? possible?
|
||||||
- rename some
|
- rename size() => length()
|
||||||
|
- rename bufSize() => size() ? ambiguous renaming.
|
||||||
- add real live examples.
|
- add real live examples.
|
||||||
- add functions like **repeat(char c)** to inject e.g. 7 spaces etc.
|
- **size_t repeat(uint8_t length, uint8_t c)** convenience function for alignment.
|
||||||
- add error flag
|
- add error flag
|
||||||
- PRINTCHARARRAY_LIB_VERSION
|
|
||||||
|
|
||||||
|
|
||||||
#### Wont
|
#### Wont
|
||||||
|
|
||||||
|
- move code to .cpp file
|
||||||
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
If you appreciate my libraries, you can support the development and maintenance.
|
If you appreciate my libraries, you can support the development and maintenance.
|
||||||
|
Loading…
Reference in New Issue
Block a user