30 #include <mraa/gpio.h>
35 #define SIZE_PAYLOAD 18 // maximum payload size of I2C packet
36 #define SIZE_PACKET (SIZE_PAYLOAD + 2) // total I2C packet size, including length uint8_t and checksum
65 uint8_t m_Data[SIZE_PACKET];
67 uint8_t m_TagNumber[7];
76 static const uint8_t MIFARE_ULTRALIGHT = 1;
77 static const uint8_t MIFARE_1K = 2;
78 static const uint8_t MIFARE_4K = 3;
80 static const uint8_t CMD_RESET = 0x80;
81 static const uint8_t CMD_VERSION = 0x81;
82 static const uint8_t CMD_SEEK_TAG = 0x82;
83 static const uint8_t CMD_SELECT_TAG = 0x83;
84 static const uint8_t CMD_AUTHENTICATE = 0x85;
85 static const uint8_t CMD_READ16 = 0x86;
86 static const uint8_t CMD_READ_VALUE = 0x87;
87 static const uint8_t CMD_WRITE16 = 0x89;
88 static const uint8_t CMD_WRITE_VALUE = 0x8a;
89 static const uint8_t CMD_WRITE4 = 0x8b;
90 static const uint8_t CMD_WRITE_KEY = 0x8c;
91 static const uint8_t CMD_INC_VALUE = 0x8d;
92 static const uint8_t CMD_DEC_VALUE = 0x8e;
93 static const uint8_t CMD_ANTENNA_POWER = 0x90;
94 static const uint8_t CMD_READ_PORT = 0x91;
95 static const uint8_t CMD_WRITE_PORT = 0x92;
96 static const uint8_t CMD_HALT_TAG = 0x93;
97 static const uint8_t CMD_SET_BAUD = 0x94;
98 static const uint8_t CMD_SLEEP = 0x96;
106 SM130 (
int bus,
int devAddr,
int rst,
int dready);
147 mraa_gpio_context m_resetPinCtx;
148 mraa_gpio_context m_dataReadyPinCtx;
152 mraa_i2c_context m_i2Ctx;
154 void arrayToHex (
char *s, uint8_t array[], uint8_t len);
155 char toHex (uint8_t b);
157 uint16_t i2cRecievePacket (uint32_t len);
158 mraa_result_t i2cTransmitPacket (uint32_t len);
159 mraa_result_t sendCommand (uint8_t cmd);
std::string name()
Definition: sm130.h:141
const char * getFirmwareVersion()
Definition: sm130.cxx:96
~SM130()
Definition: sm130.cxx:78
uint8_t available()
Definition: sm130.cxx:109
uint8_t getCommand()
Definition: sm130.h:136
SM130(int bus, int devAddr, int rst, int dready)
Definition: sm130.cxx:42
uint8_t getPacketLength()
Definition: sm130.h:131
C++ API for SM130 RFID reader module.
Definition: sm130.h:63