to colorize a colorful pixel with a simple touch using nfc technology
Dependencies: Chainable_RGB_LED mbed
PN532Interface.h
00001 00002 00003 #ifndef __PN532_INTERFACE_H__ 00004 #define __PN532_INTERFACE_H__ 00005 00006 #include <stdint.h> 00007 00008 #define PN532_PREAMBLE (0x00) 00009 #define PN532_STARTCODE1 (0x00) 00010 #define PN532_STARTCODE2 (0xFF) 00011 #define PN532_POSTAMBLE (0x00) 00012 00013 #define PN532_HOSTTOPN532 (0xD4) 00014 #define PN532_PN532TOHOST (0xD5) 00015 00016 #define PN532_ACK_WAIT_TIME (10) // ms, timeout of waiting for ACK 00017 00018 #define PN532_INVALID_ACK (-1) 00019 #define PN532_TIMEOUT (-2) 00020 #define PN532_INVALID_FRAME (-3) 00021 #define PN532_NO_SPACE (-4) 00022 00023 #define REVERSE_BITS_ORDER(b) b = (b & 0xF0) >> 4 | (b & 0x0F) << 4; \ 00024 b = (b & 0xCC) >> 2 | (b & 0x33) << 2; \ 00025 b = (b & 0xAA) >> 1 | (b & 0x55) << 1 00026 00027 class PN532Interface 00028 { 00029 public: 00030 virtual void begin() = 0; 00031 virtual void wakeup() = 0; 00032 00033 /** 00034 * @brief write a command and check ack 00035 * @param header packet header 00036 * @param hlen length of header 00037 * @param body packet body 00038 * @param blen length of body 00039 * @return 0 success 00040 * not 0 failed 00041 */ 00042 virtual int8_t writeCommand(const uint8_t *header, uint8_t hlen, const uint8_t *body = 0, uint8_t blen = 0) = 0; 00043 00044 /** 00045 * @brief read the response of a command, strip prefix and suffix 00046 * @param buf to contain the response data 00047 * @param len lenght to read 00048 * @param timeout max time to wait, 0 means no timeout 00049 * @return >=0 length of response without prefix and suffix 00050 * <0 failed to read response 00051 */ 00052 virtual int16_t readResponse(uint8_t buf[], uint8_t len, uint16_t timeout = 1000) = 0; 00053 }; 00054 00055 #endif 00056
Generated on Fri Jul 15 2022 06:47:11 by 1.7.2