- readme and readme added

This commit is contained in:
Wiesner András 2025-07-24 17:39:07 +02:00
parent 1a5a433188
commit 78d8aa404a
2 changed files with 57 additions and 0 deletions

21
LICENSE.txt Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022-2025 András Wiesner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

36
README.md Normal file
View File

@ -0,0 +1,36 @@
# EmbFmt
A lightweight formatted printer (`printf()`) implementation for embedded systems with CMake support.
## Formatting codes
The library supports the following type designators:
| Designator | Type | Description |
| --------------- | -------------- | ------------------------------------------------------------ |
| `%c` | `char` | Character |
| `%s` | `char *` | Null-terminated string |
| `%d`, `%i` | `int` | Signed decimal integer |
| `%u` | `unsigned int` | Unsigned decimal integer |
| `%x`, `%p`/`%X` | `unsigned int` | Unsigned hexadecimal integer with lowercase/UPPERcase digits |
| `%f`/`%k` | `double` | Floating point with rounding/truncation |
| `%e` | `double` | Floating point using scientific notation |
| `%%` | - | '%' character |
## Length modifier
By default, 32-bit integers are assumed (e.g.: `%u` - `uint32_t`), the `l` modifier always extends integer fields to 64 bits (e.g. `%lu` - `uint64_t`).
## Precision modifier
The library supports the precision modifiers, e.g. `%.4f` - four digits in the fractional part. The least significant digit is either determined by rounding (`%.3f`: 1.2345 -> 1.235), or by truncation (`%.3k`: 1.2345 -> 1.234).
## Leading digits
The library provides support for specifying the number and the type of leading character for numerical fields. The filling characters can be either `0` or spaces. (e.g. `%05u`: 12 -> 00012, `% 5u`: 12 -> ␣␣␣12)
The length of a field can be also passed as a parameter with the `*` modifier.
# License
The EmbFmt library has been released under the MIT License. Developer and main contributor: [Epagris](https://github.com/epagris)