Interplan IM920 library, 920MHz module
Dependents: IM920_sample IM920_SDlog IM920_sample IM920_sample3 ... more
IM920 ライブラリ
データモード、低速、長距離 の設定で通信するライブラリです。
920MHz無線モジュール
- mbedとモジュールとは、シリアル(TX,RX)、BUSY、RESET端子を接続します。
- モジュールはあらかじめ、コマンドでノード番号などを設定しておきます。
IM920_util.cpp
- Committer:
- okini3939
- Date:
- 2014-12-26
- Revision:
- 0:d3ab05ed8142
- Child:
- 4:ba939555ed35
File content as of revision 0:d3ab05ed8142:
#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; }