get the newlines straight in packet_print

This commit is contained in:
Mariano Alvira 2010-03-07 17:14:00 -05:00
parent a04a69480b
commit fece5269c7
2 changed files with 4 additions and 3 deletions

View file

@ -7,7 +7,7 @@
#define LED LED_RED
#define PAYLOAD_LEN 16
#define PAYLOAD_LEN 120
#define DELAY 400000
void fill_packet(volatile packet_t *p) {

View file

@ -31,16 +31,17 @@ void print_packet(volatile packet_t *p) {
volatile uint8_t i,j,k;
#define PER_ROW 16
if(p) {
printf("len 0x%02x\n\r",p->length);
printf("len 0x%02x",p->length);
for(j=0, k=0; j <= ((p->length)%PER_ROW); j++) {
printf("\n\r");
for(i=0; i < PER_ROW; i++, k++) {
if(k >= (p->length + 1) ) { goto out; } /* + 1 since first byte is len+2 */
printf("%02x ",p->data[j*PER_ROW + i + p->offset]);
}
printf("\n\r");
}
}
out:
printf("\n\r");
return;
}