small bugfixes in debug, test-code

master
Paul Goeser 15 years ago committed by Dario Ernst
parent d3fcd7304d
commit 203cf52b1c

@ -147,24 +147,26 @@ int cnt, vid, pid;
rxIndex = ((int)buffer[1] & 0xff) | (((int)buffer[0] & 0xff) << 8); rxIndex = ((int)buffer[1] & 0xff) | (((int)buffer[0] & 0xff) << 8);
if(rxIndex) { // if we have new data? if(rxIndex) { // if we have new data?
// get the new char and print it // advance the new char pointer...
rq = rqGetNew; rq = rqAdvance;
cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, rq[0], rq[1], rq[2], buffer, sizeof(buffer), 5000); cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, rq[0], rq[1], rq[2], buffer, sizeof(buffer), 5000);
if(cnt < 0){ if(cnt < 0){
fprintf(stderr, "\nUSB error in iteration ?!?: %s\n", usb_strerror()); fprintf(stderr, "\nUSB error in iteration ?!?: %s\n", usb_strerror());
} }
rxIndex = ((int)buffer[1] & 0xff) | (((int)buffer[0] & 0xff) << 8); rxIndex = ((int)buffer[1] & 0xff) | (((int)buffer[0] & 0xff) << 8);
fprintf(stderr, "%c", rxIndex);
// advance the new char pointer... // get the new char and print it
rq = rqAdvance; rq = rqGetNew;
cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, rq[0], rq[1], rq[2], buffer, sizeof(buffer), 5000); cnt = usb_control_msg(handle, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, rq[0], rq[1], rq[2], buffer, sizeof(buffer), 5000);
if(cnt < 0){ if(cnt < 0){
fprintf(stderr, "\nUSB error in iteration ?!?: %s\n", usb_strerror()); fprintf(stderr, "\nUSB error in iteration ?!?: %s\n", usb_strerror());
} }
rxIndex = ((int)buffer[1] & 0xff) | (((int)buffer[0] & 0xff) << 8); rxIndex = ((int)buffer[1] & 0xff) | (((int)buffer[0] & 0xff) << 8);
if(rxIndex != 0 && (rxIndex & 0xff) != 0xff){
fprintf(stderr, "%c", rxIndex);
}
} }
usleep(10000); usleep(1000);
} }
} else { } else {
usage(); usage();

@ -26,6 +26,7 @@ char dbgReadChar() {
for(int i=0; i<dbgStrFill-1; i++) { for(int i=0; i<dbgStrFill-1; i++) {
debugStr[i] = debugStr[i+1]; debugStr[i] = debugStr[i+1];
} }
dbgStrFill--;
return ret; return ret;
} else { } else {
return 0xFF; return 0xFF;

@ -4,6 +4,8 @@
#include "i2c_simple.h" #include "i2c_simple.h"
#include "mcp_adc.h" #include "mcp_adc.h"
#include "debug.h"
uint8_t foo; uint8_t foo;
uint16_t bar; uint16_t bar;
uint16_t timertmp; uint16_t timertmp;
@ -71,6 +73,7 @@ int __attribute__((noreturn)) main(void) {
softinit(); softinit();
muxer_set(MUXER_CHANNEL_0); muxer_set(MUXER_CHANNEL_0);
dbgLog("Hallo, Welt!\n");
temperatures[2]=33; temperatures[2]=33;
for(;;){ for(;;){

Loading…
Cancel
Save