move more code from demo to knx-esp

This commit is contained in:
Thomas Kunze
2018-04-09 23:58:35 +02:00
parent e99a001ac7
commit 809de53cc8
20 changed files with 865 additions and 192 deletions

View File

@@ -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())