Interplan IM920 library, 920MHz module

Dependents:   IM920_sample IM920_SDlog IM920_sample IM920_sample3 ... more

IM920 ライブラリ

データモード、低速、長距離 の設定で通信するライブラリです。

920MHz無線モジュール

http://www.interplan.co.jp/images/contents/solution/im920.png IM920 (インタープラン製)

  • mbedとモジュールとは、シリアル(TX,RX)、BUSY、RESET端子を接続します。
  • モジュールはあらかじめ、コマンドでノード番号などを設定しておきます。

NECの920MHz近距離無線モジュールもおすすめ

Revision:
0:d3ab05ed8142
Child:
4:ba939555ed35
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IM920_util.cpp	Fri Dec 26 15:35:20 2014 +0000
@@ -0,0 +1,50 @@
+#include "IM920.h"
+
+int IM920::setCh (int ch) {
+    if (ch < 1 || ch > 15) return false;
+    return cmdSTCH(ch);
+}
+
+int IM920::getRssi () {
+    cmdRDRS();
+    return _state.rssi;
+}
+
+int IM920::sleep () {
+    if (_state.status != STAT_NONE) return -1;
+
+    _state.status = STAT_SLEEP;
+    return cmdDSRX();
+}
+
+int IM920::wakeup () {
+    if (_state.status != STAT_SLEEP) return -1;
+
+    putUart('\r');
+    putUart('\n');
+    return cmdENRX();
+}
+
+
+int IM920::x2i (char c) {
+    if (c >= '0' && c <= '9') {
+        return c - '0';
+    } else
+    if (c >= 'A' && c <= 'F') {
+        return c - 'A' + 10;
+    } else
+    if (c >= 'a' && c <= 'f') {
+        return c - 'a' + 10;
+    }
+    return 0;
+}
+
+char IM920::i2x (int i) {
+    if (i >= 0 && i <= 9) {
+        return i + '0';
+    } else
+    if (i >= 10 && i <= 15) {
+        return i - 10 + 'A';
+    }
+    return 0;
+}