diff --git a/Cargo.toml b/Cargo.toml index 1bcf860..17f464b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,13 +11,14 @@ repository = "https://github.com/esp-rs/esp-println" license = "MIT OR Apache-2.0" [dependencies] -log = { version = "0.4.17", optional = true } +log = { version = "0.4.17", optional = true } [features] default = ["uart"] # You must enable exactly 1 of the below features to support the correct chip: esp32 = [] +esp32c2 = [] esp32c3 = [] esp32s2 = [] esp32s3 = [] diff --git a/build.rs b/build.rs index 081b294..4eb4b61 100644 --- a/build.rs +++ b/build.rs @@ -2,6 +2,7 @@ fn main() { // Ensure that only a single chip is specified let chip_features = [ cfg!(feature = "esp32"), + cfg!(feature = "esp32c2"), cfg!(feature = "esp32c3"), cfg!(feature = "esp32s2"), cfg!(feature = "esp32s3"), @@ -29,9 +30,7 @@ fn main() { // Ensure that, if the `jtag_serial` communication method feature is // enabled, either the `esp32c3` or `esp32s3` chip feature is enabled. - if cfg!(feature = "jtag_serial") - && (cfg!(feature = "esp32") || cfg!(feature = "esp32s2") || cfg!(feature = "esp8266")) - { + if cfg!(feature = "jtag_serial") && !(cfg!(feature = "esp32c3") || cfg!(feature = "esp32s3")) { panic!("The `jtag_serial` feature is only supported by the ESP32-C3 and ESP32-S3"); } } diff --git a/src/lib.rs b/src/lib.rs index dc39328..566d0c0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ #![no_std] -#![allow(dead_code)] #[macro_export] macro_rules! println { @@ -26,6 +25,8 @@ pub mod logger; #[cfg(feature = "esp32")] const UART_TX_ONE_CHAR: usize = 0x40009200; +#[cfg(feature = "esp32c2")] +const UART_TX_ONE_CHAR: usize = 0x40000058; #[cfg(feature = "esp32c3")] const UART_TX_ONE_CHAR: usize = 0x40000068; #[cfg(feature = "esp32s3")]