mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-09-28 12:50:53 +00:00
Clean up imports/exports, normalize/update examples
This commit is contained in:
parent
8081977fcf
commit
a9cf53a001
@ -1,23 +1,23 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use esp32_hal::{gpio::IO, pac, prelude::*, Timer};
|
||||
use esp32_hal::{gpio::IO, pac::Peripherals, prelude::*, Timer};
|
||||
use nb::block;
|
||||
use panic_halt as _;
|
||||
use xtensa_lx_rt::entry;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
let peripherals = pac::Peripherals::take().unwrap();
|
||||
let peripherals = Peripherals::take().unwrap();
|
||||
|
||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||
let mut led = io.pins.gpio15.into_push_pull_output();
|
||||
let mut timer0 = Timer::new(peripherals.TIMG0);
|
||||
|
||||
// Disable watchdog timer
|
||||
timer0.disable();
|
||||
|
||||
let mut led = io.pins.gpio15.into_push_pull_output();
|
||||
led.set_high().unwrap();
|
||||
|
||||
timer0.start(10_000_000u64);
|
||||
|
||||
loop {
|
||||
|
@ -3,19 +3,21 @@
|
||||
|
||||
use core::fmt::Write;
|
||||
|
||||
use esp32_hal::{pac, prelude::*, Serial, Timer};
|
||||
use esp32_hal::{pac::Peripherals, prelude::*, Serial, Timer};
|
||||
use nb::block;
|
||||
use panic_halt as _;
|
||||
use xtensa_lx_rt::entry;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
let peripherals = pac::Peripherals::take().unwrap();
|
||||
let peripherals = Peripherals::take().unwrap();
|
||||
|
||||
let mut timer0 = Timer::new(peripherals.TIMG0);
|
||||
let mut serial0 = Serial::new(peripherals.UART0).unwrap();
|
||||
|
||||
// Disable watchdog timer
|
||||
timer0.disable();
|
||||
|
||||
timer0.start(10_000_000u64);
|
||||
|
||||
loop {
|
@ -1,6 +1,4 @@
|
||||
use esp_hal_common::gpio::gpio;
|
||||
|
||||
use crate::hal_gpio::*;
|
||||
use esp_hal_common::gpio::*;
|
||||
|
||||
type OutputSignalType = u16;
|
||||
const OUTPUT_SIGNAL_MAX: u16 = 548;
|
||||
|
@ -1,7 +1,9 @@
|
||||
#![no_std]
|
||||
|
||||
pub use embedded_hal as ehal;
|
||||
pub use esp_hal_common::{gpio as hal_gpio, pac, prelude, Serial, Timer};
|
||||
pub use esp_hal_common::{pac, prelude, Serial, Timer};
|
||||
|
||||
pub use self::gpio::IO;
|
||||
|
||||
pub mod gpio;
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use esp32c3_hal::{gpio::IO, pac, prelude::*, RtcCntl, Timer};
|
||||
use esp32c3_hal::{gpio::IO, pac::Peripherals, prelude::*, RtcCntl, Timer};
|
||||
use nb::block;
|
||||
use panic_halt as _;
|
||||
use riscv_rt::entry;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
let peripherals = pac::Peripherals::take().unwrap();
|
||||
let peripherals = Peripherals::take().unwrap();
|
||||
|
||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||
let mut led = io.pins.gpio5.into_push_pull_output();
|
||||
let rtc_cntl = RtcCntl::new(peripherals.RTC_CNTL);
|
||||
let mut timer0 = Timer::new(peripherals.TIMG0);
|
||||
let mut timer1 = Timer::new(peripherals.TIMG1);
|
||||
|
||||
// Disable watchdog timers
|
||||
rtc_cntl.set_super_wdt_enable(false);
|
||||
rtc_cntl.set_wdt_enable(false);
|
||||
timer0.disable();
|
||||
timer1.disable();
|
||||
|
||||
let mut led = io.pins.gpio5.into_push_pull_output();
|
||||
led.set_high().unwrap();
|
||||
|
||||
timer0.start(10_000_000u64);
|
||||
|
||||
loop {
|
||||
|
@ -3,22 +3,25 @@
|
||||
|
||||
use core::fmt::Write;
|
||||
|
||||
use esp32c3_hal::{pac, prelude::*, RtcCntl, Serial, Timer};
|
||||
use esp32c3_hal::{pac::Peripherals, prelude::*, RtcCntl, Serial, Timer};
|
||||
use nb::block;
|
||||
use panic_halt as _;
|
||||
use riscv_rt::entry;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
let peripherals = pac::Peripherals::take().unwrap();
|
||||
let peripherals = Peripherals::take().unwrap();
|
||||
|
||||
let rtc_cntl = RtcCntl::new(peripherals.RTC_CNTL);
|
||||
let mut timer0 = Timer::new(peripherals.TIMG0);
|
||||
let mut serial0 = Serial::new(peripherals.UART0).unwrap();
|
||||
let mut timer0 = Timer::new(peripherals.TIMG0);
|
||||
let mut timer1 = Timer::new(peripherals.TIMG1);
|
||||
|
||||
// Disable watchdog timers
|
||||
rtc_cntl.set_super_wdt_enable(false);
|
||||
rtc_cntl.set_wdt_enable(false);
|
||||
timer0.disable();
|
||||
timer1.disable();
|
||||
|
||||
timer0.start(10_000_000u64);
|
||||
|
@ -1,25 +0,0 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use esp32c3_hal::{pac, prelude::*, RtcCntl, Serial, Timer};
|
||||
use nb::block;
|
||||
use panic_halt as _;
|
||||
use riscv_rt::entry;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
let peripherals = pac::Peripherals::take().unwrap();
|
||||
|
||||
let rtccntl = RtcCntl::new(peripherals.RTC_CNTL);
|
||||
let mut serial0 = Serial::new(peripherals.UART0).unwrap();
|
||||
let mut timer0 = Timer::new(peripherals.TIMG0);
|
||||
|
||||
rtccntl.set_super_wdt_enable(false);
|
||||
rtccntl.set_wdt_enable(false);
|
||||
timer0.disable();
|
||||
|
||||
loop {
|
||||
let byte = block!(serial0.read()).unwrap();
|
||||
block!(serial0.write(byte)).unwrap();
|
||||
}
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
use esp_hal_common::gpio::gpio;
|
||||
|
||||
use crate::hal_gpio::*;
|
||||
use esp_hal_common::gpio::*;
|
||||
|
||||
type OutputSignalType = u8;
|
||||
const OUTPUT_SIGNAL_MAX: u8 = 128;
|
||||
|
@ -1,10 +1,9 @@
|
||||
#![no_std]
|
||||
|
||||
pub use embedded_hal as ehal;
|
||||
pub use esp_hal_common::{gpio as hal_gpio, pac, prelude, Serial, Timer};
|
||||
|
||||
pub mod rtc_cntl;
|
||||
pub use esp_hal_common::{pac, prelude, Serial, Timer};
|
||||
|
||||
pub mod gpio;
|
||||
pub mod rtc_cntl;
|
||||
|
||||
pub use rtc_cntl::RtcCntl;
|
||||
pub use self::{gpio::IO, rtc_cntl::RtcCntl};
|
||||
|
Loading…
x
Reference in New Issue
Block a user