Cargo Features
[dependencies]
esp-println = { version = "0.16.1", default-features = false, features = ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32s2", "esp32s3", "critical-section", "timestamp", "auto", "jtag-serial", "uart", "no-op", "log-04", "defmt-espflash", "colors"] }
- default = auto, colors, critical-section
-
These default features are set whenever
esp-printlnis added withoutsomewhere in the dependency tree.default-features = false - esp32
-
Enables esp32 of esp-metadata-generated and optional esp-sync
esp-sync:
Unstable dependencies that are not (strictly) part of the public API
- esp32c2
-
Enables esp32c2 of esp-metadata-generated and optional esp-sync
- esp32c3
-
Enables esp32c3 of esp-metadata-generated and optional esp-sync
- esp32c6
-
Enables esp32c6 of esp-metadata-generated and optional esp-sync
- esp32h2
-
Enables esp32h2 of esp-metadata-generated and optional esp-sync
- esp32s2
-
Enables esp32s2 of esp-metadata-generated and optional esp-sync
- esp32s3
-
Enables esp32s3 of esp-metadata-generated and optional esp-sync
- critical-section default
-
Use a critical section around print calls. This ensures that the output is consistent.
Enables esp-sync
- timestamp
-
Prints the timestamp in the log message.
This option requires the following function to be implemented:
extern "Rust" { fn _esp_println_timestamp() -> u64; }This function should return the current timestamp in milliseconds since power on. When using
esp_hal, you can define this function as follows:#[unsafe(no_mangle)] pub extern "Rust" fn _esp_println_timestamp() -> u64 { esp_hal::time::Instant::now() .duration_since_epoch() .as_millis() } - auto default
-
Output interfaces
You must enable exactly 1 of the below features to enable to intended communication method.
Note: some boards, such as Waveshare's ESP32-C6-DEV-KIT-N8, come with a USB hub. This can confuse the
autofeature. If you experience no log output, try selecting an output interface instead of relying onauto.Automatically select the best output interface for the target.
Enables portable-atomic
Optional dependencies
- jtag-serial
-
Use the
USB_SERIAL_JTAGinterface for printing. Available on ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4, and ESP32-S3.Enables portable-atomic
- uart
-
Use the
UART0peripheral for printing. Available on all devices. - no-op
-
Don't print anything
- log-04
-
Logging framework features
Enables using the
logcrate for logging.Enables log
Affects
esp-println::logger… - defmt-espflash
-
Enables printing using
defmt.defmt-encoded output can only be read using espflash. With esp_hal, this works out of the box. Without esp_hal, you need to set the
--log-format defmtargument for espflash.Enables encoding-rzcobs of defmt
Logging interfaces, they are mutually exclusive so they need to be behind separate features.
Affects
esp-println::defmt… - colors default
-
log-specific featuresColors the message severity in the terminal.