LibDriver EM4100
Loading...
Searching...
No Matches
driver_em4100.h
Go to the documentation of this file.
1
36
37#ifndef DRIVER_EM4100_H
38#define DRIVER_EM4100_H
39
40#include <stdio.h>
41#include <stdint.h>
42#include <string.h>
43
44#ifdef __cplusplus
45extern "C"{
46#endif
47
53
58
62typedef struct em4100_handle_s
63{
64 uint8_t (*contactless_init)(void);
65 uint8_t (*contactless_deinit)(void);
66 uint8_t (*contactless_read)(uint32_t clock_div, uint8_t *buf, uint16_t len);
67 void (*delay_ms)(uint32_t ms);
68 void (*debug_print)(const char *const fmt, ...);
69 uint8_t buf[256];
70 uint8_t manchester_buf[128];
71 uint8_t raw_buf[64];
72 uint8_t inited;
74
90
94
101
108#define DRIVER_EM4100_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
109
116#define DRIVER_EM4100_LINK_CONTACTLESS_INIT(HANDLE, FUC) (HANDLE)->contactless_init = FUC
117
124#define DRIVER_EM4100_LINK_CONTACTLESS_DEINIT(HANDLE, FUC) (HANDLE)->contactless_deinit = FUC
125
132#define DRIVER_EM4100_LINK_CONTACTLESS_READ(HANDLE, FUC) (HANDLE)->contactless_read = FUC
133
140#define DRIVER_EM4100_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
141
148#define DRIVER_EM4100_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
149
153
160
169uint8_t em4100_info(em4100_info_t *info);
170
181uint8_t em4100_init(em4100_handle_t *handle);
182
193uint8_t em4100_deinit(em4100_handle_t *handle);
194
209uint8_t em4100_read(em4100_handle_t *handle, uint8_t id[5]);
210
221uint8_t em4100_print(em4100_handle_t *handle, uint8_t buf[5]);
222
226
230
231#ifdef __cplusplus
232}
233#endif
234
235#endif
uint8_t em4100_deinit(em4100_handle_t *handle)
close the chip
struct em4100_info_s em4100_info_t
em4100 information structure definition
uint8_t em4100_info(em4100_info_t *info)
get chip's information
uint8_t em4100_init(em4100_handle_t *handle)
initialize the chip
struct em4100_handle_s em4100_handle_t
em4100 handle structure definition
uint8_t em4100_print(em4100_handle_t *handle, uint8_t buf[5])
print id
uint8_t em4100_read(em4100_handle_t *handle, uint8_t id[5])
read data
em4100 handle structure definition
uint8_t buf[256]
uint8_t manchester_buf[128]
void(* delay_ms)(uint32_t ms)
uint8_t raw_buf[64]
void(* debug_print)(const char *const fmt,...)
uint8_t(* contactless_deinit)(void)
uint8_t(* contactless_read)(uint32_t clock_div, uint8_t *buf, uint16_t len)
uint8_t(* contactless_init)(void)
em4100 information structure definition
float temperature_max
float supply_voltage_max_v
uint32_t driver_version
float temperature_min
char manufacturer_name[32]
float supply_voltage_min_v
char interface[8]
char chip_name[32]