Phase sync experiments

This commit is contained in:
Mark Qvist 2014-04-07 22:06:33 +02:00
parent 13873775e8
commit f42f6d8bae
4 changed files with 24 additions and 3 deletions

View file

@ -1,7 +1,11 @@
#include "mp1.h"
#include "hardware.h"
#include <string.h>
#include <drv/ser.h>
static int okC; // FIXME: remove
static int erC;
static void mp1Decode(MP1 *mp1) {
// This decode function is basic and bare minimum.
// It does nothing more than extract the data
@ -41,9 +45,11 @@ void mp1Poll(MP1 *mp1) {
// kprintf("Got checksum: %d.\n", mp1->buffer[mp1->packetLength-1]);
if ((mp1->checksum_in & 0xff) == 0x00) {
//kprintf("Correct checksum. Found %d.\n", mp1->buffer[mp1->packetLength-1]);
kprintf("[OK%d] ", okC++);
mp1Decode(mp1);
} else {
// Checksum was incorrect
kprintf("[ER%d] ", erC++);
mp1Decode(mp1);
//kprintf("Incorrect checksum. Found %d, ", mp1->buffer[mp1->packetLength]);
//kprintf("should be %d\n", mp1->checksum_in);