Пример #1
0
eventLoop::eventLoop(QObject *parent) : QObject(parent)
{
  int i;
  
  navRoute = new route;
  navRoute->setDataStore(&vesselData);
  navRoute->loadRouteFromKML("ComparisonRoute.kml", QString());
  loadGPSData();

  nmeaParser = new NMEA(0, &vesselData);

  GPStimer = new QTimer;
  GPStimer->setInterval(50);
  GPStimer->start();
  connect(GPStimer, SIGNAL(timeout()), this, SLOT(sendGPSData()));
  connect(nmeaParser, SIGNAL(location(QPointF)), navRoute, SLOT(update()));
//  routeTimer = new QTimer;
//  routeTimer->setInterval(1000);
//  routeTimer->start();
//  connect(routeTimer, SIGNAL(timeout()), this, SLOT(processRoute()));
}
Пример #2
0
/**
 * UART 3 - for wifi
 */
void uart3InturruptHandle(void) {
	unsigned long ulStatus;
	unsigned char ble[15];
	ble[14] = '\0';
	unsigned long val;
	bool msg = false;

//
// Get the interrrupt status.
//
	ulStatus = ROM_UARTIntStatus(UART3_BASE, true);

//
// Clear the asserted interrupts.
//
	ROM_UARTIntClear(UART3_BASE, ulStatus);

//
// Loop while there are characters in the receive FIFO.
//
	while (UARTCharsAvail(UART3_BASE)) {
		//
		// Read the next character from the UART and write it back to the UART.
		//
		val = UARTCharGetNonBlocking(UART3_BASE);
		ble[i] = val;
		if (val == '\n' || val == '\r' || i == 13) {
			i = -1;
			msg = true;
		}

//		UARTCharPutNonBlocking(UART3_BASE, val);
		i++;
	}
	if (msg) {
		if (strncmp((char*) ble, "gps", 3) == 0) {// && (strncmp((char*) ble, "accl", 4) == 0)
//					UARTCharPutNonBlocking(UART3_BASE, 'p');
			sendGPSData();
			msg = false;
//
		} else if (strncmp((char*) ble, "accl", 4) == 0) {
			sendAcclData();
			msg = false;
		} else if (strncmp((char*) ble, "mag", 3) == 0) {
			//sendMagnetoData();
			sendHeading();
			msg = false;
		} else if (strncmp((char*) ble, "ser", 3) == 0) {
			if (ble[3] == '+') {
				servoSet(servo, 1800);
			} else if (ble[3] == '-') {
				servoSet(servo, 1388);
			} else {
				GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);

				//Delay for 1 millisecond.  Each SysCtlDelay is about 3 clocks.

				SysCtlDelay(SysCtlClockGet() / (1000 * 3));

				//Turn off the LED

				GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);

				servoSet(servo, 1500);
			}

		}
		msg = false;
	}

}
Пример #3
0
void portAIntHandler(void) {
	GPIOPinIntClear(GPIO_PORTA_BASE, GPIO_PIN_5);

	unsigned char irq = 0;
	nRF24L01_IRQ(&irq, recDataBuffer);
	if (irq & (1 << RX_DR)) {

		delay_ms(1); //IMPORTANT, delay > max retransmission delay

		if (strncmp((char*) recDataBuffer, "gps", 3) == 0) { // && (strncmp((char*) ble, "accl", 4) == 0)

			//nrf24l01p_send((unsigned char*) "lablala");
			//					UARTCharPutNonBlocking(UART3_BASE, 'p');
			sendGPSData();

			//
		} else if (strncmp((char*) recDataBuffer, "accl", 4) == 0) {
			sendAcclData();

		} else if (strncmp((char*) recDataBuffer, "mag", 3) == 0) {
			//sendMagnetoData();
			sendHeading();

		} else if (strncmp((char*) recDataBuffer, "ser", 3) == 0) {
			if (recDataBuffer[3] == '+') {
				servoSet(servo, 1800);
			} else if (recDataBuffer[3] == '-') {
				servoSet(servo, 1388);
			} else {
				GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);

				//Delay for 1 millisecond.  Each SysCtlDelay is about 3 clocks.

				SysCtlDelay(SysCtlClockGet() / (1000 * 3));

				//Turn off the LED

				GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);

				servoSet(servo, 1500);
			}

		}

	}

	//UARTprintf("irq %x", irq);
	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_PIN_3);
	SysCtlDelay(SysCtlClockGet() / (1000 * 2));
	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0);

#ifdef DEBUG
	if (irq & (1 << MAX_RT)) {
		UARTprintf("Max_RT.\n");
	}
	if (irq & (1 << TX_DS)) {
		//UARTprintf("TX_DS.\n");
	}
	if (irq & (1 << RX_DR)) {
		UARTprintf("RX_DR\n");
	}
#endif

}