aboutsummaryrefslogtreecommitdiffstats
path: root/src/wiring/Print.cpp
diff options
context:
space:
mode:
authoriperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123>2009-12-19 10:53:07 +0000
committeriperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123>2009-12-19 10:53:07 +0000
commitacf59b1abb346998c492b93fee4a680a32f538d5 (patch)
treec49dd57f489769608095736457a0db9350868a47 /src/wiring/Print.cpp
parentaf4c4985cef82b80b936584d686c80d9538082b6 (diff)
downloadlibrambutan-acf59b1abb346998c492b93fee4a680a32f538d5.tar.gz
librambutan-acf59b1abb346998c492b93fee4a680a32f538d5.zip
Added licensing. Moved lots of header files around. Added HardwareSerial reads, writes. Tweaked some of the util and assert functions. Added various useful routines for printing stuff to the serial port. Continued moving out stm32lib. Slightly more consistent naming, this will come in another change.
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@74 749a229e-a60e-11de-b98f-4500b42dc123
Diffstat (limited to 'src/wiring/Print.cpp')
-rw-r--r--src/wiring/Print.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/wiring/Print.cpp b/src/wiring/Print.cpp
index 20f5e40..c7e0cc6 100644
--- a/src/wiring/Print.cpp
+++ b/src/wiring/Print.cpp
@@ -98,14 +98,14 @@ void Print::print(double n)
void Print::println(void)
{
- print('\r');
- print('\n');
+// print('\r');
+ print('\n');
}
void Print::println(char c)
{
print(c);
- println();
+ println();
}
void Print::println(const char c[])
@@ -135,13 +135,13 @@ void Print::println(unsigned int n)
void Print::println(long n)
{
print(n);
- println();
+ println();
}
void Print::println(unsigned long n)
{
print(n);
- println();
+ println();
}
void Print::println(long n, int base)
@@ -160,13 +160,13 @@ void Print::println(double n)
void Print::printNumber(unsigned long n, uint8_t base)
{
- unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
+ unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
unsigned long i = 0;
if (n == 0) {
print('0');
return;
- }
+ }
while (n > 0) {
buf[i++] = n % base;
@@ -179,8 +179,8 @@ void Print::printNumber(unsigned long n, uint8_t base)
'A' + buf[i - 1] - 10));
}
-void Print::printFloat(double number, uint8_t digits)
-{
+void Print::printFloat(double number, uint8_t digits)
+{
// Handle negative numbers
if (number < 0.0)
{
@@ -192,7 +192,7 @@ void Print::printFloat(double number, uint8_t digits)
double rounding = 0.5;
for (uint8_t i=0; i<digits; ++i)
rounding /= 10.0;
-
+
number += rounding;
// Extract the integer part of the number and print it
@@ -202,7 +202,7 @@ void Print::printFloat(double number, uint8_t digits)
// Print the decimal point, but only if there are digits beyond
if (digits > 0)
- print(".");
+ print(".");
// Extract digits from the remainder one at a time
while (digits-- > 0)
@@ -210,6 +210,6 @@ void Print::printFloat(double number, uint8_t digits)
remainder *= 10.0;
int toPrint = int(remainder);
print(toPrint);
- remainder -= toPrint;
- }
+ remainder -= toPrint;
+ }
}