Initial WIP
This commit is contained in:
commit
5a7ace4af4
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/.pio/
|
||||||
|
/.idea/
|
||||||
5
platformio.ini
Normal file
5
platformio.ini
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[env:KnxEsp]
|
||||||
|
platform = espressif32
|
||||||
|
board = esp32dev
|
||||||
|
framework = arduino
|
||||||
|
lib_deps = https://github.com/thorsten-gehrig/arduino-tpuart-knx-user-forum
|
||||||
28
src/Group.h
Normal file
28
src/Group.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#ifndef GROUP_H
|
||||||
|
#define GROUP_H
|
||||||
|
|
||||||
|
class Group {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
uint8_t main = 0;
|
||||||
|
|
||||||
|
uint8_t mid = 0;
|
||||||
|
|
||||||
|
uint8_t sub = 0;
|
||||||
|
|
||||||
|
uint8_t dpt = 0;
|
||||||
|
|
||||||
|
static Group groups[500];
|
||||||
|
|
||||||
|
static void write(uint8_t main, uint8_t mid, uint8_t sub) {
|
||||||
|
for (auto group: groups) {
|
||||||
|
if (group.main == main && group.mid == mid && group.sub == sub) {
|
||||||
|
group.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
38
src/main.cpp
Normal file
38
src/main.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#include <KnxTpUart.h>
|
||||||
|
|
||||||
|
#include "Group.h"
|
||||||
|
|
||||||
|
KnxTpUart knx(&Serial1, "15.15.20");
|
||||||
|
|
||||||
|
void knxSetup();
|
||||||
|
|
||||||
|
void knxLoop();
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(112500);
|
||||||
|
delay(500);
|
||||||
|
Serial.print("\n\n\nStartup\n");
|
||||||
|
knxSetup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
knxLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void knxSetup() {
|
||||||
|
Serial1.begin(19200, SERIAL_8E1);
|
||||||
|
knx.uartReset();
|
||||||
|
knx.setListenToBroadcasts(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void knxLoop() {
|
||||||
|
auto type = knx.serialEvent();
|
||||||
|
if (type != KNX_TELEGRAM) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
KnxTelegram *telegram = knx.getReceivedTelegram();
|
||||||
|
Group::write(telegram->getTargetMainGroup(), telegram->getTargetMiddleGroup(), telegram->getTargetSubGroup(),telegram->getPayloadLength());
|
||||||
|
Serial.printf("%d/%d/%d\n", telegram->getTargetMainGroup(), telegram->getTargetMiddleGroup(), telegram->getTargetSubGroup());
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user