https://github.com/conorpp/small-printing
This is a very lightweight (~150 lines) of printing routines in C intended for small embedded applications
https://github.com/conorpp/small-printing
Last synced: 12 months ago
JSON representation
This is a very lightweight (~150 lines) of printing routines in C intended for small embedded applications
- Host: GitHub
- URL: https://github.com/conorpp/small-printing
- Owner: conorpp
- Created: 2016-10-03T04:09:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-03T04:22:28.000Z (almost 10 years ago)
- Last Synced: 2025-06-04T13:41:49.134Z (about 1 year ago)
- Language: C
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
It should work with most compilers and I don't think it has any endianness issues.
It's optimized solely for being lightweight, i.e. having a small program size. On a 32 bit micro, it should be about 1.7KB optimized.
Initially pulled from my [U2F Zero](https://github.com/conorpp/u2f-zero) project and
realized I'll probably re-use this accross different projects.
## How to install
Just put platform dependent code in `putf` for sending one character through your interface.
## How to use
You can probably figure it out from reading the [header file](https://github.com/conorpp/small-printing/blob/master/small_printing.h).
But for example, to print a string:
```
s_prints("this is a string\r\n");
```
To print uint type in decimal format:
```
s_printd("here are 3 integers: ", 3, 11, 22, 33);
# or with no string
putd(1234);
```
In hexadecimal:
```
s_printx("here are 3 integers: ", 3, 11, 22, 33);
# or with no string
putx(0x1234);
```
And similar for bytes, long ints.