Created
November 2, 2019 05:47
-
-
Save kuon/73bd63cfca013ad3b3435e848831ad11 to your computer and use it in GitHub Desktop.
nfc test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
#![no_main] | |
#[allow(unused_imports)] | |
use panic_semihosting; | |
use embedded_hal::blocking::delay::DelayMs; | |
use embedded_hal::digital::v2::OutputPin; | |
use nrf52840_hal as hal; | |
use nrf52840_hal::nrf52840_pac as pac; | |
use cortex_m_rt::entry; | |
use hal::gpio::Level; | |
use hal::prelude::GpioExt; | |
use cortex_m_semihosting::dbg; | |
use rtfm::app; | |
#[app(device = nrf52840_hal::target)] | |
const APP: () = { | |
static NFC: pac::NFCT = (); | |
#[init] | |
fn init() -> init::LateResources { | |
device.NFCT.tasks_activate.write(|w| w.tasks_activate().set_bit()); | |
device.NFCT.inten.write(|w| w.fielddetected().enabled()); | |
init::LateResources { NFC: device.NFCT } | |
} | |
#[idle] | |
fn idle() -> ! { | |
loop {} | |
} | |
#[interrupt(resources = [NFC])] | |
fn NFCT() { | |
//let p = pac::Peripherals::take().unwrap(); | |
if (resources.NFC.events_fielddetected.read().events_fielddetected().bit_is_set()) { | |
dbg!("hello NFC 2"); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment