Last active
August 29, 2015 13:55
-
-
Save mugifly/8689329 to your computer and use it in GitHub Desktop.
Please refer to: http://masanoriprog.blogspot.jp/2014/01/arduino-pro-mini-felica-plug-type3-rw-from-android.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
ArduinoProMini_FelicaPlug_Type3_RW.ino | |
Felica PlugのArduino向けライブラリに付属されているサンプルを基に改変 | |
(ライブラリ: http://blog.felicalauncher.com/sdk_for_air/?page_id=2419) | |
**/ | |
#define CONFIG_FELICA_PLUG_EEPROM | |
#include <EEPROM.h> | |
#include <FeliCaPlug.h> | |
#include <inttypes.h> | |
#define FELICA_PLUG_NO_RF_SUSPEND_TIME 10000 | |
// ピン定義 (一部、ライブラリの初期設定から変更するため) | |
#define _FELICA_PLUG_RFDET_PIN 3 | |
#define _FELICA_PLUG_SW_PIN 9 | |
#define _FELICA_PLUG_IRQ_PIN 2 | |
#define _FELICA_PLUG_SEL_PIN 4 | |
#define _FELICA_PLUG_DATA_PIN 5 | |
#define _FELICA_PLUG_SPICLK_PIN 6 | |
// FelicaPlug オブジェクト | |
FeliCaPlug plug; | |
// 初期のブロックデータ | |
uint8_t blockData[16 * 12] = { | |
0x10, 0x0c, 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x35 | |
}; | |
void setup() { | |
// スイッチサイエンスから購入したモジュール向けのデータフォーマットコード : 0x00 0x1c | |
uint8_t dfc[2] = {0x00, 0x1c}; | |
// 通信内容を識別するためのパラメータ (何でもいいはず) | |
uint8_t userParam[4] = {0x00, 0x11, 0x22, 0x33}; | |
// ピン(ポート)の設定 | |
plug.initPort(_FELICA_PLUG_SW_PIN, _FELICA_PLUG_SEL_PIN, _FELICA_PLUG_DATA_PIN, | |
_FELICA_PLUG_SPICLK_PIN, _FELICA_PLUG_IRQ_PIN, _FELICA_PLUG_RFDET_PIN); | |
// パラメータおよびコードの設定 | |
plug.setParam(FELICA_PLUG_MODE_TYPE3, dfc, userParam); // Type3のFTモードとして設定 | |
// 伝搬波検出を表すLEDの設定 | |
plug.setLEDPin(FELICA_PLUG_LED_PIN); // 13ピン | |
// ブロックデータの設定 (0, 0 : readOnly=false, syncWithEEPROM=false) | |
plug.setBlockData(blockData, FELICA_PLUG_EEPROM_MAX_NUM_OF_BLOCKS, 0, 0); | |
} | |
void loop() { | |
// ループ処理の実行 | |
plug.doLoop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can you tell me what this program does ?