Skip to content

Commit 2928ffc

Browse files
committed
2 parents e6a8b30 + 4a9146e commit 2928ffc

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

README.md

+23-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
1-
### ⚠ **IMPORTANT**
1+
### **IMPORTANT**
22

33
> Please, before submitting a support request read carefully this README and check if an answer already exists among [previously answered questions](https://github.com/rlogiacco/MicroDebug/discussions): do not abuse of the Github issue tracker.
44
55
<!-- omit in toc -->
6-
MicroDebug [![Build Status][travis-status]][travis]
7-
=============
8-
[travis]: https://travis-ci.org/rlogiacco/MicroDebug
9-
[travis-status]: https://travis-ci.org/rlogiacco/MicroDebug.svg?branch=master
6+
<h1>
7+
MicroDebug
8+
<a href=https://github.com/rlogiacco/MicroDebug/stargazers><img alt="GitHub stars" src=https://img.shields.io/github/stars/rlogiacco/MicroDebug.svg?style=social&label=Star /></a>
9+
<a href=https://github.com/rlogiacco/MicroDebug/network><img alt="GitHub forks" src=https://img.shields.io/github/forks/rlogiacco/MicroDebug.svg?style=social&label=Fork /></a>
10+
<a href=https://twitter.com/intent/tweet?text=Debug%20your%20code%20on%20embedded%20devices%20easily!&url=https://github.com/rlogiacco/MicroDebug&hashtags=IoT,Arduino,ESP8266,ESP32><img alt="Tweet" src=https://img.shields.io/twitter/url/http/shields.io.svg?style=social /></a>
11+
</h1>
1012

13+
[![GitHub version](https://img.shields.io/github/release/rlogiacco/MicroDebug.svg)](https://github.com/rlogiacco/MicroDebug/releases)
14+
[![GitHub download](https://img.shields.io/github/downloads/rlogiacco/MicroDebug/total.svg)](https://github.com/rlogiacco/MicroDebug/releases/latest)
15+
[![GitHub stars](https://img.shields.io/github/stars/rlogiacco/MicroDebug.svg)](https://github.com/rlogiacco/MicroDebug/stargazers)
16+
[![GitHub issues](https://img.shields.io/github/issues/rlogiacco/MicroDebug.svg)](https://github.com/rlogiacco/MicroDebug/issues)
17+
[![Build Status](https://github.com/rlogiacco/MicroDebug/actions/workflows/main.yml/badge.svg)](https://github.com/rlogiacco/MicroDebug/actions/workflows/main.yml)
18+
[![License](https://img.shields.io/badge/license-LGPL%203-blue.svg)](https://github.com/rlogiacco/MicroDebug/blob/master/LICENSE)
1119

12-
Whenever you run your projects you want to have some feedback of what's happening on your board, but most of the times you don't want those *debug* instructions to get into your production code, especially considering the limits of the micro controller's memory capacity.
20+
Whenever you run your projects you want to have some feedback on what's happening on your board, but most of the times you don't want those *debug* instructions to get into your production code, especially considering the limits of the microcontroller's memory capacity.
1321

14-
This library provides some means of easily handle this situation, exposing some pre-processor macro directives you can easily turn off to completely remove debug statements and save program memory.
22+
This library provides some means of easily handling this situation, exposing some pre-processor macro directives you can easily turn off to completely remove debug statements and save program memory.
1523

1624
<!-- toc -->
1725
- [Serial interface](#serial-interface)
@@ -25,11 +33,11 @@ This library provides some means of easily handle this situation, exposing some
2533

2634
# Serial interface
2735

28-
The simplest and most used way of interfacing to Arduino or other microcontrollers is through the serial connection and I recommend to use this in every case where it is applicable.
36+
The simplest and most used way of interfacing with Arduino or other microcontrollers is through the serial connection and I recommend using this in every case where it is applicable.
2937

3038
There are two versions of this interface: a very basic one (`SerialDebug`) which uses a separator pattern and a more evolved one (`FormattingSerialDebug`) providing format capabilities through `printf` function. You should prefer the latter whenever you have access to `printf`, usually available through `stdio.h`.
3139

32-
Please also note both serial implementations support the use of the `F()` macro to reduce the RAM usage whenever necessary by using `PROGMEM` to store strings. To put it simple, the following two statements are both supported and produce the same output, but with different memory impact:
40+
Please also note both serial implementations support the use of the `F()` macro to reduce the RAM usage whenever necessary by using `PROGMEM` to store strings. To put it simply, the following two statements are both supported and produce the same output, but with different memory impacts:
3341

3442
```cpp
3543
DEBUG("elapsed time is %lums", millis()); // format string stored in RAM
@@ -41,10 +49,10 @@ Please also note both serial implementations support the use of the `F()` macro
4149
The usage is very simple: include the `SerialDebug.h` header and you get two macros.
4250
4351
- one, to include in your `setup()` function, is `SERIAL_DEBUG_SETUP` which activates the serial connection at a specific baud rate
44-
- another one is instead a set of macros, but for simplicity you can consider them like an overloaded method `DEBUG` capable of accepting 1 to 10 parameters, each one will be printed onto the serial connection
52+
- another one is instead a set of macros, but for simplicity, you can consider them like an overloaded method `DEBUG` capable of accepting 1 to 10 parameters, each one will be printed onto the serial connection
4553
4654
In addition, you get a couple of definitions you can override to customize the output:
47-
- `SERIAL_DEBUG` defaults to `true` and activated/deactivates the entire library
55+
- `SERIAL_DEBUG` defaults to `true` and activates/deactivates the entire library
4856
- `SERIAL_DEBUG_SEPARATOR` defaults to `" | "` (pipe character preceded and followed by space) which is used as a separator between each argument
4957
- `SERIAL_DEBUG_IMPL` defaults to `Serial` which is the underlying serial target
5058
@@ -67,13 +75,13 @@ void loop() {
6775

6876
## Formatting Serial
6977

70-
The formatting version has been modelled on the same usage model of the basic implementation: the two are almost completely swappable by just changing the include statement to `FormattingSerialDebug.h` header:
78+
The formatting version has been modeled on the same usage model of the basic implementation: the two are almost completely swappable by just changing the include statement to `FormattingSerialDebug.h` header:
7179

7280
- `SERIAL_DEBUG_SETUP`, which activates the serial connection at a specific baud rate, should be included in your `setup()`
7381
- `DEBUG` is capable of accepting 1 or more parameters, the first one being the formatting string in the `printf` [format](http://en.wikipedia.org/wiki/Printf_format_string)
7482

7583
As for the basic version you have library control through definitions:
76-
- `SERIAL_DEBUG` defaults to `true` and activated/deactivates the entire library
84+
- `SERIAL_DEBUG` defaults to `true` and activates/deactivates the entire library
7785
- `SERIAL_DEBUG_IMPL` defaults to `Serial` which is the underlying serial target
7886

7987
**NOTE** to deactivate the library for final release you must `#define SERIAL_DEBUG false` ***before*** including the `FormattingSerialDebug.h` header file.
@@ -96,7 +104,7 @@ void loop() {
96104

97105
### Supported notation
98106

99-
Due to memory limitation of the devices the general implementations of the `printf` function doesn't support floating point numbers, but in case you really need support for floating points then providing `-Wl,-u,vfprintf -lprintf_flt -lm` compilation options can enable it.
107+
Due to the memory limitation of the devices, the general implementations of the `printf` function don't support floating point numbers, but in case you really need support for floating points then providing `-Wl,-u,vfprintf -lprintf_flt -lm` compilation options can enable it.
100108

101109
Please refer to [this page](http://www.cplusplus.com/reference/cstdio/printf/) for a full reference of the accepted format string.
102110

@@ -108,7 +116,7 @@ In such cases, you can include the `LedDebug.h` header to get the `PULSE` macro:
108116

109117

110118
In addition, you get a couple of definitions you can override to customize the pulses:
111-
- `LED_DEBUG` defaults to `true` and activated/deactivates the entire library
119+
- `LED_DEBUG` defaults to `true` and activates/deactivates the entire library
112120
- `LED_DEBUG_PIN` defaults to the built-in LED pin on Arduino boards, usually digital pin 13
113121
- `LED_DEBUG_DELAY` defaults to 50 and indicates the default interval in milliseconds between each PULSE invocation
114122
- `LED_DEBUG_LENGHT` defaults to 125 and indicates the default duration in milliseconds of a blink

examples/SerialDebug/SerialDebug.ino

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
// Set the following if you wish to override the default
66
#define SERIAL_DEBUG_SEPARATOR ", "
77

8-
int free() {
9-
extern int __heap_start, *__brkval;
10-
int v;
11-
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
12-
}
8+
#ifndef A0 // esp32 doesn't define analog pins
9+
#define A0 32
10+
#endif
1311

1412
void setup() {
1513
SERIAL_DEBUG_SETUP(9600);
16-
DEBUG("Available memory", free());
1714
pinMode(A0, INPUT);
1815
}
1916

0 commit comments

Comments
 (0)