NUC200LE3AN_Card/lib/pn512/include/pn512.h

46 lines
1.1 KiB
C

#ifndef PN512_H
#define PN512_H
#include <stdint.h>
typedef enum pn512_ret {
PN512_OK,
PN512_FAIL,
} pn512_ret_t;
typedef pn512_ret_t (*pn512_read_ops_t)(void *handle, uint8_t reg, uint8_t *data, uint16_t len);
typedef pn512_ret_t (*pn512_write_ops_t)(void *handle, uint8_t reg, uint8_t *data, uint16_t len);
typedef pn512_ret_t (*pn512_poll_irq_ops_t)(void *handle, uint32_t max_timeout);
typedef pn512_ret_t (*pn512_delay_ops_t)(void *handle, uint32_t msec);
typedef pn512_ret_t (*pn512_reset_ops_t)(void *handle);
typedef struct pn512_if_ops {
pn512_read_ops_t read;
pn512_write_ops_t write;
pn512_poll_irq_ops_t poll_irq;
pn512_delay_ops_t delay;
pn512_reset_ops_t reset;
} pn512_if_ops_t;
typedef struct pn512_app_cb {
} pn512_app_cb_t;
typedef struct pn512_info {
uint8_t version;
uint8_t current_page;
} pn512_info_t;
typedef struct pn512 {
pn512_if_ops_t ops;
void *ops_handle;
pn512_app_cb_t cb;
void *cb_data;
pn512_info_t info;
} pn512_t;
pn512_ret_t pn512_init(pn512_t *nfc);
#endif // PN512_H