diff options
-rw-r--r-- | main.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -22,7 +22,6 @@ desc_t conf_desc_p = {sizeof(conf_desc), (void*)&conf_desc}; USB_l0 usb(USB, dev_desc_p, conf_desc_p); - Pin nfc_sck = GPIOB[3]; Pin nfc_miso = GPIOB[4]; Pin nfc_mosi = GPIOB[5]; @@ -30,6 +29,9 @@ Pin nfc_ss = GPIOB[6]; Pin nfc_irq_out = GPIOB[7]; Pin nfc_irq_in = GPIOC[13]; +Pin button = GPIOA[3]; +Pin led = GPIOA[4]; + class CR95HF { private: SPI_t& spi; @@ -474,6 +476,8 @@ int main() { RCC.enable(RCC.GPIOB); RCC.enable(RCC.GPIOC); + led.set_mode(Pin::Output); + RCC.enable(RCC.USB); usb.init(); @@ -516,6 +520,8 @@ int main() { if(Time::time() < nfc_delay_until) { // Just do nothing. } else if(!cmd_sent) { + led.off(); + cr95hf.send_cmd(0x04, 3, (uint8_t*)"\x26\x01\x00"); // INVENTORY cmd_sent = true; } else if(!nfc_irq_out.get()) { @@ -523,6 +529,8 @@ int main() { cmd_sent = false; if(buf[0] == 128 && buf[14] == 0) { + led.on(); + USB.reg.BCDR &= ~(1 << 15); uint8_t* id_raw = &buf[11]; uint8_t* id_ascii = sectors[4]; |