Skip to content

Commit

Permalink
timer10
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemKhel committed Dec 6, 2024
1 parent b1c8e7a commit 8c83daa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ports/xtensa_esp32/hardware_timer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use esp_hal::peripherals::*;
use esp_hal::timer::timg::{Timer, Timer0, Timer1, TimerGroup};
use esp_hal::timer::timg::{Timer, Timer0, TimerGroup};

use crate::timer::TickType;

// TODO: initialize peripherals in separate mod
pub static mut TIMER00: Option<Timer<Timer0<TIMG0>, esp_hal::Blocking>> = None;
pub static mut TIMER01: Option<Timer<Timer1<TIMG0>, esp_hal::Blocking>> = None;
pub static mut TIMER10: Option<Timer<Timer0<TIMG1>, esp_hal::Blocking>> = None;
pub static mut PERIFERALS_RNG: Option<RNG> = None;
pub static mut PERIFERALS_RADIO_CLK: Option<RADIO_CLK> = None;
pub static mut PERIFERALS_WIFI: Option<WIFI> = None;
Expand All @@ -14,13 +14,14 @@ pub static mut PERIFERALS_WIFI: Option<WIFI> = None;
pub fn setup_hardware_timer() {
let peripherals = esp_hal::init(esp_hal::Config::default());
let timer_group0 = TimerGroup::new(peripherals.TIMG0);
let timer_group1 = TimerGroup::new(peripherals.TIMG1);

let timer00 = timer_group0.timer0;
let timer01 = timer_group0.timer1;
let timer10 = timer_group1.timer0;

unsafe {
TIMER00 = Some(timer00);
TIMER01 = Some(timer01);
TIMER10 = Some(timer10);
PERIFERALS_RNG = Some(peripherals.RNG);
PERIFERALS_RADIO_CLK = Some(peripherals.RADIO_CLK);
PERIFERALS_WIFI = Some(peripherals.WIFI);
Expand Down

0 comments on commit 8c83daa

Please sign in to comment.