![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test program for RFM69 library. Listens and prints packets from "RFM69_Sender" nodes
Diff: Listener.cpp
- Revision:
- 1:7bc722e656a5
- Parent:
- 0:52becca880bd
- Child:
- 2:08246d6498ce
--- a/Listener.cpp Thu Feb 26 04:21:40 2015 +0000 +++ b/Listener.cpp Thu Feb 26 14:52:03 2015 +0000 @@ -24,24 +24,32 @@ // 1-byte NODEID + 4-bytes for time + 1-byte for temp in C + 2-bytes for vcc(mV) uint8_t msgBuf[MSGBUFSIZE]; InterruptIn mybutton(USER_BUTTON); -DigitalOut myled(D9); -//Serial pc(SERIAL_TX, SERIAL_RX); +#ifdef TARGET_NUCLEO_F401RE +Serial pc(USBTX, USBRX); +DigitalOut myled(D9); //"Moteino Half Shield" has LED on D9 +//RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) +RFM69 radio(D11,D12,D13,D10,D8); +#elif defined(TARGET_NUCLEO_L152RE) Serial pc(USBTX, USBRX); -//RFM69::RFM69(PinName mosi, PinName miso, PinName sclk,PinName slaveSelectPin,PinName interrupt) +DigitalOut myled(D9); //"Moteino Half Shield" has LED on D9 +//RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) RFM69 radio(D11,D12,D13,D10,D8); +#elif defined(TARGET_LPC1114) +Serial pc(USBTX, USBRX); +DigitalOut myled(LED1); +//RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) +RFM69 radio(dp2,dp1,dp6,dp4,dp9); +#elif defined(TARGET_LPC1768) +Serial pc(USBTX, USBRX); +DigitalOut myled(D9); //"Moteino Half Shield" has LED on D9 +//RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) +RFM69 radio(D11,D12,D13,D10,D8); // Seeedstudio Arch Pro +//RFM69 radio(p5, p6, p7, p10, p9,p8) // Mbed 1768 ? +#endif bool promiscuousMode = false; // set 'true' to sniff all packets on the same network bool requestACK=false; Timer tmr; -#pragma pack(1) -union itag { - uint8_t b[2]; - uint16_t i; -}it; -union ltag { - uint8_t b[4]; - long l; -}lt; // used to force byte order in case we end up using result in various endian targets... main() { memset(msgBuf,0,sizeof(msgBuf)); @@ -54,7 +62,7 @@ radio.initialize(FREQUENCY, GATEWAY_ID, NETWORKID); radio.encrypt(0); radio.promiscuous(promiscuousMode); - radio.setPowerLevel(5); +// radio.setPowerLevel(5); #ifdef IS_RFM69HW radio.setHighPower(); //uncomment #define ONLY if radio is of type: RFM69HW or RFM69HCW #endif