mirror of
https://github.com/stakwork/sphinx-key.git
synced 2025-12-20 00:34:33 +01:00
Rename SyncLazy to LazyLock
This commit is contained in:
@@ -8,7 +8,7 @@ use librumqttd::{
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::{lazy::SyncLazy, sync::Mutex};
|
use std::sync::{LazyLock, Mutex};
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use tokio::time::timeout;
|
use tokio::time::timeout;
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ const PASSWORD: &str = "sphinx-key-pass";
|
|||||||
// must get a reply within this time, or disconnects
|
// must get a reply within this time, or disconnects
|
||||||
const REPLY_TIMEOUT_MS: u64 = 10000;
|
const REPLY_TIMEOUT_MS: u64 = 10000;
|
||||||
|
|
||||||
static CONNECTED: SyncLazy<Mutex<bool>> = SyncLazy::new(|| Mutex::new(false));
|
static CONNECTED: LazyLock<Mutex<bool>> = LazyLock::new(|| Mutex::new(false));
|
||||||
fn set_connected(b: bool) {
|
fn set_connected(b: bool) {
|
||||||
*CONNECTED.lock().unwrap() = b;
|
*CONNECTED.lock().unwrap() = b;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ use esp_idf_hal::peripherals::Peripherals;
|
|||||||
use esp_idf_hal::rmt::config::TransmitConfig;
|
use esp_idf_hal::rmt::config::TransmitConfig;
|
||||||
use esp_idf_hal::rmt::{FixedLengthSignal, PinState, Pulse, Transmit};
|
use esp_idf_hal::rmt::{FixedLengthSignal, PinState, Pulse, Transmit};
|
||||||
|
|
||||||
use std::lazy::SyncLazy;
|
use std::sync::{LazyLock, Mutex};
|
||||||
use std::sync::Mutex;
|
|
||||||
|
|
||||||
static TX: SyncLazy<Mutex<Transmit<Gpio8<esp_idf_hal::gpio::Output>, esp_idf_hal::rmt::CHANNEL0>>> = SyncLazy::new(|| {
|
static TX: LazyLock<Mutex<Transmit<Gpio8<esp_idf_hal::gpio::Output>, esp_idf_hal::rmt::CHANNEL0>>> = LazyLock::new(|| {
|
||||||
let peripherals = Peripherals::take().unwrap();
|
let peripherals = Peripherals::take().unwrap();
|
||||||
let led = peripherals.pins.gpio8.into_output().unwrap();
|
let led = peripherals.pins.gpio8.into_output().unwrap();
|
||||||
let channel = peripherals.rmt.channel0;
|
let channel = peripherals.rmt.channel0;
|
||||||
|
|||||||
Reference in New Issue
Block a user