Beispiel #1
0
int main(void)
{
    WDTCTL = WDTPW + WDTHOLD; 			//Stop WDT
    BCSCTL1 = CALBC1_8MHZ; 				//Set DCO to 8Mhz
    DCOCTL = CALDCO_8MHZ; 				//Set DCO to 8Mhz

    uart_init();						//Initialize the UART connection

    __enable_interrupt();				//Interrupts Enabled

    uart_puts((char *)"\n\rExpect GPS data here.. \n\r");

	int idx = 0;
	char c;

	while(c = uart_getc()){	
	    if ( idx == 0 && c != '$' ){ continue; }
		if ( c == '\r'){//its the end of the line! 
			gps_string[idx+1] = '\0';
			idx = 0;
			uart_putline(gps_string);
			continue;
		}else{
			gps_string[idx] = c;
		}
		idx++;
	}
}
Beispiel #2
0
int main(void) {
  // We'll use UART0, so set it up
  PIN0_PORT_PCR = PORT_PCR_MUX(3);
  PIN1_PORT_PCR = PORT_PCR_MUX(3);
  uart_setup(UART0_BASE_PTR, 115200);

  uart_putline(UART0_BASE_PTR, "\r\nHello there!");

  // Set direction to output
  PIN_GPIO_PDDR( BLINK_PIN ) = (1 << PIN_PIN( BLINK_PIN ));

  // Select the GPIO function on the port
  PIN_PORT_PCR( BLINK_PIN ) = PORT_PCR_MUX(1) | PORT_PCR_SRE_MASK | PORT_PCR_DSE_MASK;

  // Let's also systick!
  interrupt_enable();
  SYST_RVR = 7200000;//(SYST_CALIB & SysTick_CALIB_TENMS_MASK) * 10;
  SYST_CSR = SysTick_CSR_ENABLE_MASK | SysTick_CSR_TICKINT_MASK | SysTick_CSR_CLKSOURCE_MASK;

  while (1) {
    pin_gpio_set_high(BLINK_PIN);
    uart_putchar(UART0_BASE_PTR, 'H');
    delay(500);
    pin_gpio_set_low(BLINK_PIN);
    uart_putchar(UART0_BASE_PTR, 'L');
    delay(500);
  }
}