You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
669 B
35 lines
669 B
/* |
|
Library for Software Serial over RS485 connection |
|
Created by Stepan Richter, November 2023 |
|
*/ |
|
|
|
#include "Arduino.h" |
|
#include "SoftRS485.h" |
|
|
|
SoftRS485 SoftRS485::instance; |
|
|
|
SoftRS485 SoftRS485::singleton(){ |
|
return instance; |
|
} |
|
|
|
void SoftRS485::isr(){ |
|
instance.bam(); |
|
} |
|
|
|
void SoftRS485::begin(int RO, int nRE, int DE, int DI){ |
|
_RO = RO; |
|
_RE = nRE; |
|
_DE = DE; |
|
_DI = DI; |
|
Serial.begin(115200); |
|
pinMode(_RE, OUTPUT); |
|
pinMode(_DE, OUTPUT); |
|
pinMode(_DI, OUTPUT); |
|
pinMode(_RO, INPUT); |
|
attachInterrupt(digitalPinToInterrupt(_RO),isr,CHANGE); |
|
Serial.println("attached to interrupt!"); |
|
} |
|
|
|
void SoftRS485::bam(){ |
|
Serial.println("bam!"); |
|
}
|
|
|