Files
MBusLightSensor/src/debug.cpp

37 lines
613 B
C++

/*
* 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
}