This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ThroughHardwareSerialRs485AutoTx enables PJON multi-master communication through the Serial port with auto-tx RS485 PHY. | |
Work based on ThroughHardwareSerial by Giovanni Blu Mitolo and Fred Larsen | |
Copyright (c) 2016 by Zbigniew Zasieczny All rights reserved. | |
With rs485 "auto-tx" PHY the hardware serial port reads everything sent to the bus | |
The "self-reading" property could be used in this strategy to detect colisions at a byte-level in a similar way the CAN network works on a bit-level to silelntly drop-off lower priority nodes; feature not implemented yet | |
A naive timeout-based collision avoidance is used: bus is assumed clear for tx within specified time window after empty rx buffer was detected. The receive(<timeout_us>) function must be called often - transimission would occur only within 1ms after last receive call on empty rx buffer; within this time window the update() function must be called to transmit packets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <PJON.h> | |
// <Strategy name> bus(selected device id) | |
//PJON<SoftwareBitBang> bus(44); | |
PJON<OverSampling> bus(44); | |
void setup() { | |
pinModeFast(13, OUTPUT); | |
digitalWriteFast(13, LOW); // Initialize LED 13 to be off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <PJON.h> | |
// <Strategy name> bus(selected device id) | |
//PJON<SoftwareBitBang> bus(45); | |
PJON<OverSampling> bus(45); | |
long start_ts; | |
void setup() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import socket | |
import optparse | |
import sys | |
import textwrap | |
import paramiko | |
from sftpserver.stub_sftp import StubServer, StubSFTPServer |
NewerOlder