mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Merge branch 'master' of https://github.com/thelsing/knx
This commit is contained in:
commit
b4c8671dbb
@ -35,6 +35,4 @@ Platform::Platform()
|
|||||||
_memoryReference = (uint8_t*)malloc(1);
|
_memoryReference = (uint8_t*)malloc(1);
|
||||||
free(_memoryReference);
|
free(_memoryReference);
|
||||||
_memoryReference -= 1024;
|
_memoryReference -= 1024;
|
||||||
print("MemRef: ");
|
|
||||||
println((long unsigned int)_memoryReference, HEX);
|
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@
|
|||||||
|
|
||||||
#define BYTE_TIMEOUT 3 //milli seconds
|
#define BYTE_TIMEOUT 3 //milli seconds
|
||||||
#define CONFIRM_TIMEOUT 500 //milli seconds
|
#define CONFIRM_TIMEOUT 500 //milli seconds
|
||||||
|
#define RESET_TIMEOUT 100 //milli seconds
|
||||||
|
|
||||||
void TpUartDataLinkLayer::loop()
|
void TpUartDataLinkLayer::loop()
|
||||||
{
|
{
|
||||||
@ -369,15 +370,18 @@ bool TpUartDataLinkLayer::sendFrame(CemiFrame& frame)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TpUartDataLinkLayer::resetChip()
|
bool TpUartDataLinkLayer::resetChip()
|
||||||
{
|
{
|
||||||
uint8_t cmd = U_RESET_REQ;
|
uint8_t cmd = U_RESET_REQ;
|
||||||
_platform.writeUart(cmd);
|
_platform.writeUart(cmd);
|
||||||
|
_waitConfirmStartTime = _platform.millis();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int resp = _platform.readUart();
|
int resp = _platform.readUart();
|
||||||
if (resp == U_RESET_IND)
|
if (resp == U_RESET_IND)
|
||||||
break;
|
return true;
|
||||||
|
else if (_platform.millis() - _waitConfirmStartTime > RESET_TIMEOUT)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,10 +425,16 @@ void TpUartDataLinkLayer::enabled(bool value)
|
|||||||
if (value && !_enabled)
|
if (value && !_enabled)
|
||||||
{
|
{
|
||||||
_platform.setupUart();
|
_platform.setupUart();
|
||||||
print("ownaddr ");
|
|
||||||
println(_deviceObject.induvidualAddress(), HEX);
|
if (resetChip()){
|
||||||
resetChip();
|
_enabled = true;
|
||||||
_enabled = true;
|
print("ownaddr ");
|
||||||
|
println(_deviceObject.induvidualAddress(), HEX);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
_enabled = false;
|
||||||
|
println("ERROR, TPUART not responding");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,6 @@ class TpUartDataLinkLayer : public DataLinkLayer
|
|||||||
bool sendFrame(CemiFrame& frame);
|
bool sendFrame(CemiFrame& frame);
|
||||||
void frameBytesReceived(uint8_t* buffer, uint16_t length);
|
void frameBytesReceived(uint8_t* buffer, uint16_t length);
|
||||||
void dataConBytesReceived(uint8_t* buffer, uint16_t length, bool success);
|
void dataConBytesReceived(uint8_t* buffer, uint16_t length, bool success);
|
||||||
void resetChip();
|
bool resetChip();
|
||||||
void stopChip();
|
void stopChip();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user