Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Remove support for the ESP8266 (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham authored Feb 5, 2024
1 parent b1b1033 commit 8198346
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

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

```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.

Expand All @@ -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

Expand All @@ -52,18 +54,21 @@ 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);
```

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

Expand All @@ -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.

Expand Down
1 change: 0 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
7 changes: 2 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8198346

Please sign in to comment.