1
0
mirror of https://github.com/whowechina/aic_pico.git synced 2025-02-17 19:09:24 +01:00

Feli and mifare and reset works

This commit is contained in:
whowechina 2023-11-28 22:10:49 +08:00
parent 4d175076d5
commit b2c59ff817
2 changed files with 8 additions and 5 deletions

View File

@ -256,12 +256,15 @@ static void handle_pninv()
uint8_t cmd[] = {0x06, 0x01, 0x00};
pn5180_send_data(cmd, 3, 0);
sleep_ms(10);
for (int i = 0; i < 10; i++) {
printf("irq: %08lx rx: %08lx\n", pn5180_read_reg(PN5180_REG_IRQ_STATUS),
pn5180_read_reg(PN5180_REG_RX_STATUS));
sleep_ms(2);
sleep_ms(1);
}
uint32_t rxstatus = pn5180_read_reg(PN5180_REG_RX_STATUS);
int len = rxstatus & 0x1ff;
uint8_t buf[len];

View File

@ -187,11 +187,11 @@ void pn5180_rf_off()
void pn5180_reset()
{
gpio_put(spi.rst, 0);
sleep_ms(10);
sleep_us(20);
gpio_put(spi.rst, 1);
sleep_ms(10);
while (pn5180_read_reg(PN5180_REG_IRQ_STATUS) & (1 << 2)) {
printf("irq: %08lx\n", pn5180_read_reg(PN5180_REG_IRQ_STATUS));
sleep_ms(1);
while ((pn5180_read_reg(PN5180_REG_IRQ_STATUS) & (1 << 2)) == 0) {
sleep_ms(1);
}
pn5180_write_reg(PN5180_REG_IRQ_CLEAR, 0xffffffff); // clear all flags