diff --git a/Cargo.toml b/Cargo.toml index 1d68317..4b9a578 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,6 @@ esp32h2 = [] esp32p4 = [] esp32s2 = [] esp32s3 = [] -esp8266 = [] # You must enable exactly 1 of the below features to enable to intended # communication method (note that "uart" is enabled by default): diff --git a/README.md b/README.md index 165918a..d59c68e 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,12 @@ A library that provides `print!`, `println!`, `dbg!` implementations and logging capabilities for Espressif devices. + - Supports all Espressif devices. - Supports different communication methods: - - UART (Default) - - JTAG-Serial (Only available in ESP32-C3, ESP32-C6, ESP32-H2, ESP32-S3) - - No-op: Turns printing into a no-op + - UART (Default) + - JTAG-Serial (Only available in ESP32-C3, ESP32-C6, ESP32-H2, ESP32-S3) + - No-op: Turns printing into a no-op - Supports [`defmt`] backend # Usage @@ -14,6 +15,7 @@ logging capabilities for Espressif devices. ```toml esp-println = { version = "0.8.0", features = ["esp32c2"] } ``` + or `cargo add esp-println --features esp32c2` It's important to specify your target device as feature. @@ -28,18 +30,18 @@ You can now `println!("Hello world")` as usual. # Features - There is one feature for each supported target: `esp32`, `esp32c2`, - `esp32c3`, `esp32c6`, `esp32h2`, `esp32s2`, `esp32s3` and `esp8266`. - - One of these features must be enabled. - - Only one of these features can be enabled at a time. + `esp32c3`, `esp32c6`, `esp32h2`, `esp32s2`, and `esp32s3`. + - One of these features must be enabled. + - Only one of these features can be enabled at a time. - There is one feature for each supported communication method: `uart`, `jtag-serial` and `no-op`. - - Only one of these features can be enabled at a time. + - Only one of these features can be enabled at a time. - `log`: Enables logging using [`log` crate]. - `colors` enable colored logging. - - Only effective when using the `log` feature. + - Only effective when using the `log` feature. - `critical-section` enables critical sections. - `defmt-espflash`: This is intended to be used with [`espflash`], see `-L/--log-format` argument - of `flash` or `monitor` subcommands of `espflash` and `cargo-espflash`. Uses [rzCOBS] encoding - and adds framing. + of `flash` or `monitor` subcommands of `espflash` and `cargo-espflash`. Uses [rzCOBS] encoding + and adds framing. ## Default Features @@ -52,6 +54,7 @@ one, we need to [disable the default features]. ## Logging With the feature `log` activated you can initialize a simple logger like this + ```rust init_logger(log::LevelFilter::Info); ``` @@ -59,11 +62,13 @@ init_logger(log::LevelFilter::Info); There is a default feature `colors` which enables colored log output. Additionally, you can use + ```rust 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 @@ -89,7 +94,7 @@ set up `defmt`. Remember, the global logger is already installed for you by `esp # Troubleshooting linker errors -If you experience linker errors, make sure you have *some* reference to `esp_println` in your code. +If you experience linker errors, make sure you have _some_ reference to `esp_println` in your code. If you don't use `esp_println` directly, you'll need to add e.g. `use esp_println as _;` to your import statements. This ensures that the global logger will not be removed by the compiler. diff --git a/build.rs b/build.rs index 0f9e3bc..19e5a62 100644 --- a/build.rs +++ b/build.rs @@ -9,7 +9,6 @@ fn main() { cfg!(feature = "esp32p4"), cfg!(feature = "esp32s2"), cfg!(feature = "esp32s3"), - cfg!(feature = "esp8266"), ]; match chip_features.iter().filter(|&&f| f).count() { diff --git a/src/lib.rs b/src/lib.rs index 244022d..514ea84 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -192,7 +192,7 @@ mod serial_jtag_printer { } } -#[cfg(all(feature = "uart", any(feature = "esp32", feature = "esp8266")))] +#[cfg(all(feature = "uart", feature = "esp32"))] mod uart_printer { const UART_TX_ONE_CHAR: usize = 0x4000_9200; impl super::Printer { @@ -237,10 +237,7 @@ mod uart_printer { } } -#[cfg(all( - feature = "uart", - not(any(feature = "esp32", feature = "esp32s2", feature = "esp8266")) -))] +#[cfg(all(feature = "uart", not(any(feature = "esp32", feature = "esp32s2"))))] mod uart_printer { trait Functions { const TX_ONE_CHAR: usize;