to colorize a colorful pixel with a simple touch using nfc technology
Dependencies: Chainable_RGB_LED mbed
use Arch, NFC Shield and Grove - Chainable RGB LED to DIY a touch pixel. Then use an Android with NFC support to colorize it.
The project is on https://github.com/Seeed-Studio/TouchPixel
nfc/mac_link.cpp@0:88960f3eeb2c, 2013-12-27 (annotated)
- Committer:
- yihui
- Date:
- Fri Dec 27 01:46:32 2013 +0000
- Revision:
- 0:88960f3eeb2c
initial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 0:88960f3eeb2c | 1 | |
yihui | 0:88960f3eeb2c | 2 | #include "mac_link.h" |
yihui | 0:88960f3eeb2c | 3 | #include "PN532_debug.h" |
yihui | 0:88960f3eeb2c | 4 | |
yihui | 0:88960f3eeb2c | 5 | int8_t MACLink::activateAsTarget(uint16_t timeout) |
yihui | 0:88960f3eeb2c | 6 | { |
yihui | 0:88960f3eeb2c | 7 | pn532.begin(); |
yihui | 0:88960f3eeb2c | 8 | pn532.SAMConfig(); |
yihui | 0:88960f3eeb2c | 9 | return pn532.tgInitAsTarget(timeout); |
yihui | 0:88960f3eeb2c | 10 | } |
yihui | 0:88960f3eeb2c | 11 | |
yihui | 0:88960f3eeb2c | 12 | bool MACLink::write(const uint8_t *header, uint8_t hlen, const uint8_t *body, uint8_t blen) |
yihui | 0:88960f3eeb2c | 13 | { |
yihui | 0:88960f3eeb2c | 14 | return pn532.tgSetData(header, hlen, body, blen); |
yihui | 0:88960f3eeb2c | 15 | } |
yihui | 0:88960f3eeb2c | 16 | |
yihui | 0:88960f3eeb2c | 17 | int16_t MACLink::read(uint8_t *buf, uint8_t len) |
yihui | 0:88960f3eeb2c | 18 | { |
yihui | 0:88960f3eeb2c | 19 | return pn532.tgGetData(buf, len); |
yihui | 0:88960f3eeb2c | 20 | } |