summaryrefslogtreecommitdiffstats
path: root/src/bin/main.rs
blob: 52eafa501de13a3ce009c207cf59754fa631e1bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#![no_std]
#![no_main]

use esp_backtrace as _;
use esp_hal::clock::CpuClock;
use esp_hal::delay::Delay;
use esp_hal::main;
use esp_hal::timer::timg::TimerGroup;
use log::info;

extern crate alloc;

#[main]
fn main() -> ! {
  let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
  let peripherals = esp_hal::init(config);
  esp_println::logger::init_logger_from_env();

  esp_alloc::heap_allocator!(72 * 1024);

  let timg0 = TimerGroup::new(peripherals.TIMG0);
  let _init = esp_wifi::init(
    timg0.timer0,
    esp_hal::rng::Rng::new(peripherals.RNG),
    peripherals.RADIO_CLK,
  )
  .unwrap();

  let delay = Delay::new();
  loop {
    info!("Hello world!");
    delay.delay_millis(500);
  }

  // for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/v0.23.1/examples/src/bin
}