void GPSline(void) { char buffer[128]; int lenght; int k; int i; lenght = sprintf (buffer, "$PSRF103,00,01,00,01*25"); for(k=0;k<lenght;k++) { uart0_putchar(buffer[k]); Delay(1); } uart0_putchar(0x0D); //CR uart0_putchar(0x0a); //LF count += 1; while(!uart0_getchar_present()); while(uart0_getchar() != '$');// wait for the start of a line for(i=0;i<256;i++) { while(!uart0_getchar_present()); gpsbuffer[i] = uart0_getchar(); // uart0_putchar(gpsbuffer[i]); if(gpsbuffer[i] == '\r') { gpsbuffer[i] = 0; while(uart0_getchar_present()) uart0_getchar(); return; } } }
void get_serial(void) { int i; int j; char buffer[9]; for(i=0;i<3;i++) { while(!uart0_getchar_present()); buffer[i] = uart0_getchar(); uart0_putchar('G'); } }
int main (void) { char ch,aux1 ,aux2; int UsbDetected = FALSE; #ifdef CMSIS // If we are conforming to CMSIS, we need to call start here start(); #endif vfnMcuConfig(); printf("\n\rRunning the FRDMKL46_Demo project.\n\r"); vfnLCD_Init(); gpio_init(); Pit_init(); TSI_Init(); usb_init(); next_task(vfn_led_test); accel_init(); mag_init(); eCompassInit(); adc_init(); tpm_init(); //Green LED 50%SIM_SCGC5_PORTC_MASK // character test vfnLCD_Write_Msg("8888"); _LCD_DP1_ON(); _LCD_DP2_ON(); _LCD_DP3_ON(); _LCD_COL_ON(); while(1) { #ifdef FRDM_REVA if (uart_getchar_present(UART1_BASE_PTR)) #else if (uart0_getchar_present(UART0_BASE_PTR)) #endif { ch = in_char(); printf("\n\r Received char = %c \n\r",ch); if (ch==' ') { printf("\n\r light_sensor = %i",adc_light_sensor); // printf("\n\r Yaw =%4d Pitch =%4d Roll =%4d \r", APhi6DOF, AThe6DOF, APsi6DOF); printf("\n\r Yaw =%4d Pitch =%4d Roll =%4d \r", APsi6DOF, APhi6DOF, AThe6DOF); printf("\n\r tsi %%= %03i ", AbsolutePercentegePosition); } } if (input_rise(SW1_ON, &aux1)) { printf("\n\r SW1 \n\r"); } if (input_rise(SW2_ON, &aux2)) { printf("\n\r SW2 \n\r "); } ptr_next_task(); // do the actual function TSI_SliderRead(); usb_service(); if (gu8USB_State == uENUMERATED && !UsbDetected) { // next_task(vfn_rgb_test); UsbDetected = TRUE; } adc_light_sensor = adc_read(3); } }
int char_present (void) { return uart0_getchar_present(LPUART0_BASE_PTR); }