This commit is contained in:
hg
2014-04-02 22:50:17 +02:00
parent 26b47b1159
commit db5cb1829a
8 changed files with 90 additions and 16 deletions

View File

@ -7,13 +7,34 @@
#include "meterBusClient.h"
inline void MeterBusClient::aSB(unsigned char c) {
sendBuffer[sendBufferLen++] = c;
}
unsigned char MeterBusClient::calcSendChecksum() {
unsigned char checksum = 0;
for (unsigned int i = 4; i < sendBufferLen; i++) {
checksum += sendBuffer[i];
}
return checksum;
}
void MeterBusClient::SND_NKE() {
Serial3.write(0xE5);
sendBufferLen = 0;
aSB(0xE5);
}
void MeterBusClient::REQ_UD2() {
sendBufferLen = 0;
aSB(0x68);
aSB(0x03);
aSB(0x03);
aSB(0x68);
aSB(0x01);
aSB(getAddress());
aSB(0x03);
aSB(calcSendChecksum());
aSB(0x16);
}