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

Commit

Permalink
Use latest versions of all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham committed Oct 11, 2024
1 parent a229584 commit 8fe9eb4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ runner = "espflash flash --monitor"


[env]
ESP_LOGLEVEL="INFO"
ESP_LOG="info"

[build]
rustflags = [
Expand Down
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dependencies]
esp-backtrace = { version = "0.14.0", features = [
esp-backtrace = { version = "0.14.2", features = [
"{{ mcu }}",
"exception-handler",
"panic-handler",
"println",
] }
esp-hal = { version = "0.20.1", features = [ "{{ mcu }}" ] }
esp-println = { version = "0.11.0", features = ["{{ mcu }}", "log"] }
log = { version = "0.4.21" }
esp-hal = { version = "0.21.0", features = [ "{{ mcu }}" ] }
esp-println = { version = "0.12.0", features = ["{{ mcu }}", "log"] }
log = { version = "0.4.22" }
{% if alloc -%}
esp-alloc = { version = "0.4.0" }
esp-alloc = { version = "0.5.0" }
{% endif -%}
{% if wifi -%}
embedded-io = "0.6.1"
esp-wifi = { version = "0.8.0", features = [
esp-wifi = { version = "0.10.1", features = [
"{{ mcu }}",
"phy-enable-usb",
"utils",
Expand Down
14 changes: 7 additions & 7 deletions pre-script.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,29 @@ variable::set("alloc_snippet",
extern crate alloc;
use core::mem::MaybeUninit;

#[global_allocator]
static ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();

fn init_heap() {
const HEAP_SIZE: usize = 32 * 1024;
static mut HEAP: MaybeUninit<[u8; HEAP_SIZE]> = MaybeUninit::uninit();

unsafe {
ALLOCATOR.init(HEAP.as_mut_ptr() as *mut u8, HEAP_SIZE);
esp_alloc::HEAP.add_region(esp_alloc::HeapRegion::new(
HEAP.as_mut_ptr() as *mut u8,
HEAP_SIZE,
esp_alloc::MemoryCapability::Internal.into(),
));
}
}
`);

// depends on: `peripherals` being in scope
variable::set("esp_wifi_snippet",
`
let timg0 = esp_hal::timer::timg::TimerGroup::new(peripherals.TIMG0, &clocks);
let _init = esp_wifi::initialize(
let timg0 = esp_hal::timer::timg::TimerGroup::new(peripherals.TIMG0);
let _init = esp_wifi::init(
esp_wifi::EspWifiInitFor::${meta.esp_wifi_init},
timg0.timer0,
esp_hal::rng::Rng::new(peripherals.RNG),
peripherals.RADIO_CLK,
&clocks,
)
.unwrap();
`
Expand Down
12 changes: 4 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@
#![no_main]

use esp_backtrace as _;
use esp_hal::{
clock::ClockControl, delay::Delay, peripherals::Peripherals, prelude::*, system::SystemControl,
};
use esp_hal::{delay::Delay, prelude::*};

{% if alloc -%}
{{ alloc_snippet }}
{% endif -%}

#[entry]
fn main() -> ! {
let peripherals = Peripherals::take();
let system = SystemControl::new(peripherals.SYSTEM);

let clocks = ClockControl::max(system.clock_control).freeze();
let delay = Delay::new(&clocks);
#[allow(unused)]
let peripherals = esp_hal::init(esp_hal::Config::default());
let delay = Delay::new();

{%- if alloc %}
init_heap();
Expand Down

0 comments on commit 8fe9eb4

Please sign in to comment.