mirror of
https://github.com/thelsing/knx.git
synced 2026-03-13 02:22:13 +01:00
move more code from demo to knx-esp
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
#include "knx_facade.h"
|
||||
#include "state.h"
|
||||
#include "button.h"
|
||||
#include "led.h"
|
||||
#include "nowifistate.h"
|
||||
|
||||
KnxFacade knx;
|
||||
|
||||
@@ -32,12 +36,38 @@ bool KnxFacade::configured()
|
||||
return _bau.configured();
|
||||
}
|
||||
|
||||
uint32_t KnxFacade::ledPin()
|
||||
{
|
||||
return _ledPin;
|
||||
}
|
||||
|
||||
void KnxFacade::ledPin(uint32_t value)
|
||||
{
|
||||
_ledPin = value;
|
||||
}
|
||||
|
||||
uint32_t KnxFacade::buttonPin()
|
||||
{
|
||||
return _buttonPin;
|
||||
}
|
||||
|
||||
void KnxFacade::buttonPin(uint32_t value)
|
||||
{
|
||||
_buttonPin = value;
|
||||
}
|
||||
|
||||
void KnxFacade::readMemory()
|
||||
{
|
||||
_bau.readMemory();
|
||||
}
|
||||
|
||||
void KnxFacade::loop()
|
||||
{
|
||||
if (currentState)
|
||||
currentState->loop();
|
||||
}
|
||||
|
||||
void KnxFacade::knxLoop()
|
||||
{
|
||||
_bau.loop();
|
||||
}
|
||||
@@ -72,6 +102,18 @@ void KnxFacade::version(uint16_t value)
|
||||
_bau.deviceObject().version(value);
|
||||
}
|
||||
|
||||
void KnxFacade::start()
|
||||
{
|
||||
pinMode(_ledPin, OUTPUT);
|
||||
|
||||
pinMode(_buttonPin, INPUT);
|
||||
attachInterrupt(_buttonPin, buttonDown, FALLING);
|
||||
|
||||
switchToSate(noWifiState);
|
||||
checkStates();
|
||||
_ticker.attach_ms(100, doLed);
|
||||
}
|
||||
|
||||
uint8_t* KnxFacade::paramData(uint32_t addr)
|
||||
{
|
||||
if (!_bau.configured())
|
||||
|
||||
Reference in New Issue
Block a user