Optimize imports
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
//! High-level PN532 command driver.
|
||||
|
||||
use crate::commands::*;
|
||||
use crate::error::{Error};
|
||||
use crate::error::Error;
|
||||
use crate::interface::Interface;
|
||||
|
||||
pub(crate) const PACKET_BUFFER_SIZE: usize = 64;
|
||||
|
||||
@@ -4,11 +4,11 @@ use crate::driver::Pn532;
|
||||
use crate::error::{Error, StatusCode};
|
||||
use crate::interface::Interface;
|
||||
|
||||
use types::*;
|
||||
pub use types::Block as FelicaBlock;
|
||||
pub(crate) use types::AsBlock;
|
||||
use crate::commands::{FELICA_CMD_POLLING, FELICA_CMD_READ_WITHOUT_ENCRYPTION, FELICA_CMD_REQUEST_RESPONSE, FELICA_CMD_REQUEST_SERVICE, FELICA_CMD_REQUEST_SYSTEM_CODE, FELICA_CMD_WRITE_WITHOUT_ENCRYPTION, FELICA_READ_MAX_BLOCK_NUM, FELICA_READ_MAX_SERVICE_NUM, FELICA_REQ_SERVICE_MAX_NODE_NUM, FELICA_WRITE_MAX_BLOCK_NUM, FELICA_WRITE_MAX_SERVICE_NUM, PN532_COMMAND_INDATAEXCHANGE, PN532_COMMAND_INLISTPASSIVETARGET, PN532_COMMAND_INRELEASE};
|
||||
use crate::{BaudRate, FelicaPollingResponse};
|
||||
pub(crate) use types::AsBlock;
|
||||
pub use types::Block as FelicaBlock;
|
||||
use types::*;
|
||||
|
||||
impl<B: Interface> Pn532<B> {
|
||||
/// Poll for a FeliCa card.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{BaudRate, Error, Interface, Pn532, Uid};
|
||||
use crate::commands::{PN532_COMMAND_INDATAEXCHANGE, PN532_COMMAND_INLISTPASSIVETARGET, PN532_COMMAND_INRELEASE};
|
||||
use crate::error::StatusCode;
|
||||
use crate::{BaudRate, Error, Interface, Pn532, Uid};
|
||||
|
||||
impl<B: Interface> Pn532<B> {
|
||||
/// Wait for an ISO14443A target and read its UID.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{Error, Interface, Pn532};
|
||||
use crate::commands::{MIFARE_CMD_AUTH_A, MIFARE_CMD_AUTH_B, MIFARE_CMD_READ, MIFARE_CMD_WRITE, MIFARE_CMD_WRITE_ULTRALIGHT, PN532_COMMAND_INDATAEXCHANGE};
|
||||
use crate::error::StatusCode;
|
||||
use crate::{Error, Interface, Pn532};
|
||||
|
||||
impl<B: Interface> Pn532<B> {
|
||||
/// Whether the block number is the first block of a sector.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
use crate::{Error, Interface, Pn532, TargetInitStatus};
|
||||
use crate::commands::{PN532_COMMAND_TGGETDATA, PN532_COMMAND_TGINITASTARGET, PN532_COMMAND_TGSETDATA};
|
||||
use crate::error::StatusCode;
|
||||
use crate::{Error, Interface, Pn532, TargetInitStatus};
|
||||
|
||||
impl<B: Interface> Pn532<B> {
|
||||
/// Initialize the PN532 as a target using a raw command frame.
|
||||
|
||||
+8
-9
@@ -1,26 +1,25 @@
|
||||
use core::cell::RefCell;
|
||||
use crate::components::clock::Clock;
|
||||
use crate::components::lora::Lora;
|
||||
use core::sync::atomic::{AtomicBool, AtomicPtr, Ordering};
|
||||
use crossbeam::atomic::AtomicCell;
|
||||
use crate::components::{self, card_reader::CardReader, rom_storage::RomStorage};
|
||||
use crate::types::{AppData, LoraPubSub, SharedI2c};
|
||||
use core::cell::RefCell;
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex};
|
||||
use embassy_sync::mutex::Mutex;
|
||||
use embassy_sync::blocking_mutex::Mutex as BlockingMutex;
|
||||
use embassy_sync::mutex::Mutex;
|
||||
use embassy_sync::pubsub::PubSubChannel;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use esp_hal::gpio::{InputConfig, Level, Pull};
|
||||
use esp_hal::i2c::master::{I2c};
|
||||
use esp_hal::i2c::master::I2c;
|
||||
use esp_hal::interrupt::software::SoftwareInterruptControl;
|
||||
use esp_hal::peripherals::Peripherals;
|
||||
use esp_hal::rng::{Trng, TrngSource};
|
||||
use esp_hal::spi::master::{Config, Spi};
|
||||
use esp_hal::timer::timg::TimerGroup;
|
||||
use esp_hal::{gpio, Async, Blocking};
|
||||
use esp_hal::interrupt::software::SoftwareInterruptControl;
|
||||
use esp_hal::rng::{Trng, TrngSource};
|
||||
use static_cell::StaticCell;
|
||||
use crate::components::{ rom_storage::RomStorage, card_reader::CardReader, self };
|
||||
use crate::types::{AppData, LoraPayload, LoraPubSub, SharedI2c};
|
||||
|
||||
pub(crate) static LED_STATE: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::types::{LoraPublisher, SharedI2c};
|
||||
use core::sync::atomic::{AtomicPtr, Ordering};
|
||||
use defmt::Debug2Format;
|
||||
use embassy_sync::once_lock::OnceLock;
|
||||
@@ -7,7 +8,6 @@ use esp_hal::rng::Trng;
|
||||
use lorawan_device::RngCore;
|
||||
use pn532::felica::FelicaBlock;
|
||||
use pn532::Pn532;
|
||||
use crate::types::{LoraPublisher, SharedI2c};
|
||||
|
||||
static CARD_KEY: OnceLock<heapless::Vec<u8, 16>> = OnceLock::new();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use alloc::vec::Vec;
|
||||
use crate::types::{LoraPayload, LoraPublisher, LoraSubscriber, SharedAsyncSpi};
|
||||
use crate::timer::EmbassyTimer;
|
||||
use crate::types::{LoraPayload, LoraPublisher, LoraSubscriber, SharedAsyncSpi};
|
||||
use alloc::vec::Vec;
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use core::str::FromStr;
|
||||
use core::sync::atomic::{AtomicPtr, Ordering};
|
||||
@@ -17,8 +17,8 @@ use lora_phy::lorawan_radio::LorawanRadio;
|
||||
use lora_phy::mod_params::RadioError;
|
||||
use lora_phy::sx126x::{Sx1262, Sx126x, TcxoCtrlVoltage};
|
||||
use lora_phy::{sx126x, LoRa};
|
||||
use lorawan_device::async_device::Error as LoraDeviceError;
|
||||
use lorawan_device::async_device::Device;
|
||||
use lorawan_device::async_device::Error as LoraDeviceError;
|
||||
use lorawan_device::default_crypto::DefaultFactory;
|
||||
use lorawan_device::{region, AppEui, AppKey, DevEui, JoinMode};
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use crate::types::SharedI2c;
|
||||
use alloc::collections::BTreeMap;
|
||||
use core::any::{TypeId};
|
||||
use core::any::TypeId;
|
||||
use eeprom24x::{Eeprom24x, SlaveAddr};
|
||||
use embassy_embedded_hal::shared_bus::I2cDeviceError;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
use crate::types::SharedI2c;
|
||||
|
||||
const ADDR_SIZE: usize = 256;
|
||||
|
||||
|
||||
+2
-3
@@ -1,14 +1,13 @@
|
||||
use crate::components::clock::ClockError;
|
||||
use crate::components::lora::LoraError;
|
||||
use crate::components::rom_storage::StorageError;
|
||||
use core::convert::Infallible;
|
||||
use defmt::{Formatter};
|
||||
use defmt::Formatter;
|
||||
use embassy_embedded_hal::shared_bus::I2cDeviceError;
|
||||
use embassy_executor::SpawnError;
|
||||
use esp_hal::i2c::master::ConfigError as I2cConfigError;
|
||||
use esp_hal::i2c::master::Error as I2cError;
|
||||
use esp_hal::rng::TrngError;
|
||||
use esp_hal::spi::master::ConfigError as SpiConfigError;
|
||||
use crate::components::rom_storage::StorageError;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ mod components;
|
||||
mod types;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use {esp_backtrace as _, esp_println as _, esp_alloc as _};
|
||||
use {esp_alloc as _, esp_backtrace as _, esp_println as _};
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
use alloc::vec::Vec;
|
||||
use chrono::{DateTime, Utc};
|
||||
use core::fmt::{Display, Formatter};
|
||||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice;
|
||||
use embassy_embedded_hal::shared_bus::asynch::spi::SpiDevice;
|
||||
use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice;
|
||||
use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex, NoopRawMutex};
|
||||
use embassy_sync::pubsub::{PubSubChannel, Publisher, Subscriber};
|
||||
use esp_hal::i2c::master::I2c;
|
||||
|
||||
Reference in New Issue
Block a user