Skip to content

Latest commit

 

History

History
43 lines (38 loc) · 4.08 KB

io-setup.md

File metadata and controls

43 lines (38 loc) · 4.08 KB

Documentation index


IO setup

The physical layer configuration is handled by the strategy entity, if you want to communicate bi-directionally on a single pin with SoftwareBitBang or AnalogSampling use:

 PJONSoftwareBitBang bus;
 bus.strategy.set_pin(12);

With this setup it is possible to communicate in PJON_HALF_DUPLEX mode with up to 254 different devices on the same physical pin. If for some reason you need to keep separate the two lines, for example if using OverSampling with separate radio transmitter and receiver modules, you can pass 2 separate pins:

 PJONOverSampling bus;
 bus.strategy.set_pins(11, 12);

If you don't need bidirectional communication and you have only the transmitter on one side and the receiver on the other side you can use the PJON_NOT_ASSIGNED constant:

 PJONOverSampling bus;
 // Operate in simplex mode
 bus.set_communication_mode(PJON_SIMPLEX);
  // Use only receiver pin
 bus.strategy.set_pins(11, PJON_NOT_ASSIGNED);

See the readme of the strategy you are using to have additional information on its dedicated physical layer configuration.