all the prepared mini meterbus client stuff

This commit is contained in:
hg
2014-06-05 21:17:41 +02:00
parent 7802282906
commit a27d27a827
9 changed files with 693 additions and 43 deletions

36
src/debug.cpp Normal file
View File

@ -0,0 +1,36 @@
/*
* debug.cpp
*
* Created on: 24.05.2014
* Author: wn
*/
#include "debug.h"
#include <msp430g2553.h>
void debugInit() {
#ifdef DEBUG
DEBUG_DIR_REG |= DEBUG_CS | DEBUG_CLK | DEBUG_OUT;
DEBUG_OUT_REG |= DEBUG_CS;
DEBUG_OUT_REG &= ~DEBUG_CLK;
#endif
}
void debugWrite(uint8_t o) {
#ifdef DEBUG
DEBUG_OUT_REG &= ~DEBUG_CS;
for (uint8_t i = 0; i < 8; i++) {
if (((o << i) & 0x80) == 0x80) {
DEBUG_OUT_REG |= DEBUG_OUT;
} else {
DEBUG_OUT_REG &= ~DEBUG_OUT;
}
DEBUG_OUT_REG |= DEBUG_CLK;
DEBUG_OUT_REG &= ~DEBUG_CLK;
}
DEBUG_OUT_REG |= DEBUG_CS;
#endif
}