GithubHelp home page GithubHelp logo

dimpolo / esp-println Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esp-rs/esp-println

0.0 0.0 0.0 41 KB

Provides print! and println! implementations various Espressif devices

License: Apache License 2.0

Rust 100.00%

esp-println's Introduction

esp-println

Provides print!, println! and dbg! implementations for various Espressif devices.

  • Supports ESP32, ESP32-C2/C3/C6, ESP32-H2, ESP32-S2/S3, and ESP8266
  • Dependency free (not even depending on esp-hal, one optional dependency is log, another is critical-section)
  • Supports JTAG-Serial output where available
  • Supports RTT (lacking working RTT hosts besides probe-rs for ESP32-C3)
  • no-op features turns printing into a no-op

RTT on ESP32-C3 / ESP32-C6

The cli utility should work for flashing and showing RTT logs on ESP32-C3 by using it's run command. You need to use the direct-boot feature of the HAL to flash via probe-rs.

Usage

In your Cargo.toml, under [dependencies], add:

esp-println = { version = "0.3.1", features = ["esp32"] }

Choose a recent version and your chipset.

Then in your program:

use esp_println::println;

You can now println!("Hello world") as usual.

Logging

With the feature log activated you can initialize a simple logger like this

init_logger(log::LevelFilter::Info);

There is a default feature colors which enables colored log output.

Additionally you can use

init_logger_from_env();

In this case the following environment variables are used:

  • ESP_LOGLEVEL sets the log level, use values like trace, info etc.
  • ESP_LOGTARGETS if set you should provide the crate names of crates (optionally with a path e.g. esp_wifi::compat::common) which should get logged, separated by , and no additional whitespace between

If this simple logger implementation isn't sufficient for your needs you can implement your own logger on top of esp-println - see https://docs.rs/log/0.4.17/log/#implementing-a-logger

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

esp-println's People

Contributors

bjoernq avatar dimpolo avatar fotonick avatar jessebraham avatar sergiogasquez avatar thebutlah avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.