all the prepared mini meterbus client stuff
This commit is contained in:
36
src/debug.cpp
Normal file
36
src/debug.cpp
Normal 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
|
||||
}
|
Reference in New Issue
Block a user