Interleaver implemented

This commit is contained in:
Mark Qvist 2014-04-16 14:06:03 +02:00
parent 0b2683e486
commit 85286ad467
5 changed files with 173 additions and 49 deletions

View file

@ -35,7 +35,7 @@ static Serial ser; // Declare a serial interface struct
static uint8_t serialBuffer[MP1_MAX_FRAME_LENGTH]; // This is a buffer for incoming serial data
static int sbyte; // For holding byte read from serial port
static int serialLen = 0; // Counter for counting length of data from serial
static size_t serialLen = 0; // Counter for counting length of data from serial
static bool sertx = false; // Flag signifying whether it's time to send data
// Received on the serial port.
@ -50,12 +50,10 @@ static bool sertx = false; // Flag signifying whether it's time to send da
static void mp1Callback(struct MP1Packet *packet) {
kfile_printf(&ser.fd, "%.*s\n", packet->dataLength, packet->data);
if (packet->data[0]-128 == 'R' && packet->data[1]-128 == 'Q') {
if (AUTOREPLY && packet->data[0]-128 == 'R' && packet->data[1]-128 == 'Q') {
timer_delay(1000);
mp1Send(&mp1, TEST_PACKET, sizeof(TEST_PACKET));
}
//kprintf("%.*s\n", packet->dataLength, packet->data);
}
// Simple initialization function.
@ -63,8 +61,6 @@ static void init(void)
{
// Enable interrupts
IRQ_ENABLE;
// Initialize BertOS debug bridge
// kdbg_init();
// Initialize hardware timers
timer_init();
@ -117,8 +113,6 @@ int main(void)
// If one of the above conditions were actually the
// case, it means we have to transmit, se we set
// transmission flag to true.
serialBuffer[serialLen] = sbyte;
serialLen++;
sertx = true;
}
}