sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.61k stars 619 forks source link

Add function to invert IQ signal register. #177

Closed ricaun closed 5 years ago

ricaun commented 5 years ago

InvertIQ allows differentiating sender and receiver message.

Usually, Gateways read messages with InvertIQ off and send messages with InvertIQ on, Nodes read messages with InvertIQ on and send messages with InvertIQ off.

This way a Gateway only reads messages from Nodes and never reads messages from other Gateway, and Node never reads messages from other Node.

I already test in my fork. Only need to add this code.

#define REG_INVERTIQ             0x33

void LoRaClass::invertIQ(boolean invert)
{
  writeRegister(REG_INVERTIQ , invert == false ? 0x27 : 0x66);
}

Thanks

morganrallen commented 5 years ago

It would be great to see this as a full PR. Should be able to just add it to LoRa.h and API.md

halukmy commented 5 years ago

@morganrallen did he added?

halukmy commented 5 years ago

@ricaun hey Luiz, how nodes understand other one is not node? or gateway?

for example , i am using this lib as gateway too,

is 0x27 gateway or 0x66 node?

ricaun commented 5 years ago

@halukmy I create two examples, https://github.com/ricaun/arduino-LoRa/tree/master/examples

Basically Gateway send message with invertIQ enable and receive with invertIQ disabled. Nodes sends message with invertIQ disabled and receive message with invertIQ enable.

LoRaWan use this arrangement, with invertIQ enable is possible to sniff downlink packages.

sandeepmistry commented 5 years ago

Closed via https://github.com/sandeepmistry/arduino-LoRa/pull/179.