aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/Print.cpp
Commit message (Collapse)AuthorAgeFilesLines
* wirish/Print: explicit double-width constantsbryan newbold2015-03-011-6/+6
| | | | | | | | | These are to prevent implicit constant conversions from floats to doubles and squelch -Wdouble-promotion warnings. Normally gcc will start by using doubles to represent floating point constants. On 32-bit MCUs with a floating point unit, it is more likely that floats are desired, unless explicitly annotated otherwise.
* Assert LeafLabs copyright in wirish/Print.cpp.Marti Bolivar2012-05-311-0/+1
| | | | | | | | This should get replaced with a clean-room MIT licensed version, but pieces of it are ours (notably the bugfixes to the floating point printing routines), so might as well do the copyright thing. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move public headers to include directories; related cleanups.Marti Bolivar2012-04-111-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move libmaple/*.h to (new) libmaple/include/libmaple/. The new accepted way to include a libmaple header foo.h is with: #include <libmaple/foo.h> This is more polite in terms of the include namespace. It also allows us to e.g. implement the Arduino SPI library at all (which has header SPI.h; providing it was previously impossible on case-insensitive filesystems due to libmaple's spi.h). Similarly for Wirish. The old include style (#include "header.h") is now deprecated. libmaple/*.h: - Change include guard #defines from _FOO_H_ to _LIBMAPLE_FOO_H_. - Add license headers where they're missing - Add conditional extern "C" { ... } blocks where they're missing (they aren't always necessary, but we might was well do it against the future, while we're at it.). - Change includes from #include "foo.h" to #include <libmaple/foo.h>. - Move includes after extern "C". - Remove extra trailing newlines Note that this doesn't include the headers under libmaple/usb/ or libmaple/usb/usb_lib. These will get fixed later. libmaple/*.c: - Change includes from #include "foo.h" to #include <libmaple/foo.h>. Makefile: - Add I$(LIBMAPLE_PATH)/include/libmaple to GLOBAL_FLAGS. This allows for users (including Wirish) to migrate their code, but should go away ASAP, since it slows down compilation. Wirish: - Move wirish/**/*.h to (new) wirish/include/wirish/. This ignores the USB headers, which, as usual, are getting handled after everything else. - Similarly generify wirish/boards/ structure. For each supported board "foo", move wirish/boards/foo.h and wirish/boards/foo.cpp to wirish/boards/foo/include/board/board.h and wirish/boards/foo/board.cpp, respectively. Also remove the #ifdef hacks around the .cpp files. - wirish/rules.mk: put wirish/boards/foo/include in the include path (and add wirish/boards/foo/board.cpp to the list of sources to be compiled). This allows saying: #include <board/board.h> instead of the hack currently in place. We can allow the user to override this setting later to make adding custom board definitions easier. - Disable -Werror in libmaple/rules.mk, as the current USB warnings don't let the olimex_stm32_h103 board compile. We can re-enable -Werror once we've moved the board-specific bits out of libmaple proper. libraries, examples: - Update includes accordingly. - Miscellaneous cosmetic fixups. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Update Print to match Arduino master.Marti Bolivar2011-06-081-42/+35
| | | | | | | | | Add base argument to integral Print methods, defaulting to DEC so as not to break backwards compatibility. Add precision argument to floating-point Print methods. These changes increase compatibility with the Arduino Print implementation.
* SerialUSB fixups.Marti Bolivar2011-05-041-1/+1
|
* Minor Print cleanups.Marti Bolivar2011-04-251-4/+4
|
* Compromise Print implementation.Marti Bolivar2011-04-121-25/+94
| | | | | | | | | | | The users really hated the code size requirements for an snprintf()-based Print implementation, but I really hated how bad the old implementation was. Revised version fixes bugs related to printing 64-bit values and has some improved behavior when it comes to printing doubles. Now, instead of happily printing garbage values when large doubles are printed, we try printing "<large double>" or "-<large double>" (depending on sign) when the argument is too big for the old strategy to accommodate.
* Reverting "Rewrote Print class."Marti Bolivar2011-04-121-141/+104
| | | | This reverts commit 8bd3cebbee62e2dd7e961b149cc8bb0e980eaf88.
* Rewrote Print class.Marti Bolivar2011-02-241-104/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | The old Print class couldn't print uint64 values, and featured hand-hacked functionality better handled by snprintf(). Redid it using snprintf(), using "[u]int[8,16,32,64]" types for more clarity, and eliminated some private methods in favor of auxiliary functions in Print.cpp. Breaking compatibility with original implementation in three ways: - Print::print(double) is now accurate to 6 digits, rather than 2; this is consistent with the default behavior of the %f format specifier, and if you're using floating point, it's slow enough that you probably want the increased accuracy. - The only bases you can print a number to are 2, 8, 10, and 16. 8, 10, and 16 already have format specifiers, and 2 is an important special case; others complicate matters unnecessarily. - Printing numbers in bases other than 10 treats them as unsigned quantities (i.e., won't print '-' characters). This is more consistent with C++'s behavior for hexadecimal and octal literals (e.g., 0xFFFFFFFF has type uint32). Updated HardwareSerial and USBSerial class documentation to reflect the new behavior.
* wirish reformatted and code-styledMarti Bolivar2010-09-261-165/+142
|
* Preliminary wirish USBSerial implementation.Perry Hung2010-06-041-3/+5
| | | | | | -updated examples -removed HardwareUSB -cleaned up a handful of includes
* Refactoring:Perry Hung2010-04-251-0/+211
The 'core' directory has now been renamed to 'wirish.' Wirish is our version of the Arduino Wiring language.