comparison Small_CPU/Src/baseCPU2.c @ 890:651d21777b61 Evo_2_23

cleanup and disable function for GNSS uart and DMA
author heinrichsweikamp
date Fri, 06 Sep 2024 18:43:30 +0200
parents cf3967fe6924
children 2225c467f1e9
comparison
equal deleted inserted replaced
889:cf3967fe6924 890:651d21777b61
434 GNSS_IO_init(); 434 GNSS_IO_init();
435 MX_USART6_UART_Init(); 435 MX_USART6_UART_Init();
436 GNSS_Init(&GNSS_Handle, &huart6); 436 GNSS_Init(&GNSS_Handle, &huart6);
437 HAL_Delay(1000); 437 HAL_Delay(1000);
438 GNSS_LoadConfig(&GNSS_Handle); 438 GNSS_LoadConfig(&GNSS_Handle);
439 HAL_Delay(10); 439 HAL_Delay(250);
440 GNSS_GetUniqID(&GNSS_Handle); 440 GNSS_GetUniqID(&GNSS_Handle);
441 GNSS_ParseBuffer(&GNSS_Handle); 441 GNSS_ParseBuffer(&GNSS_Handle);
442 HAL_Delay(10); 442 HAL_Delay(250);
443 GNSS_GetPVTData(&GNSS_Handle); 443 GNSS_GetPVTData(&GNSS_Handle);
444 GNSS_ParseBuffer(&GNSS_Handle); 444 GNSS_ParseBuffer(&GNSS_Handle);
445 445
446 /*
447 * Demo code from SimpleMethod
448 * called 1/second
449 while (1) {
450
451 if ((HAL_GetTick() - Timer) > 1000) {
452 GNSS_GetUniqID(&GNSS_Handle);
453 GNSS_ParseBuffer(&GNSS_Handle);
454 HAL_Delay(250);
455 GNSS_GetPVTData(&GNSS_Handle);
456 GNSS_ParseBuffer(&GNSS_Handle);
457 printf("Day: %d-%d-%d \r\n", GNSS_Handle.day, GNSS_Handle.month,GNSS_Handle.year);
458 printf("Time: %d:%d:%d \r\n", GNSS_Handle.hour, GNSS_Handle.min,GNSS_Handle.sec);
459 printf("Status of fix: %d \r\n", GNSS_Handle.fixType);
460 printf("Latitude: %f \r\n", GNSS_Handle.fLat);
461 printf("Longitude: %f \r\n",(float) GNSS_Handle.lon / 10000000.0);
462 printf("Height above ellipsoid: %d \r\n", GNSS_Handle.height);
463 printf("Height above mean sea level: %d \r\n", GNSS_Handle.hMSL);
464 printf("Ground Speed (2-D): %d \r\n", GNSS_Handle.gSpeed);
465 printf("Unique ID: %04X %04X %04X %04X %04X \n\r",
466 GNSS_Handle.uniqueID[0], GNSS_Handle.uniqueID[1],
467 GNSS_Handle.uniqueID[2], GNSS_Handle.uniqueID[3],
468 GNSS_Handle.uniqueID[4], GNSS_Handle.uniqueID[5]);
469 Timer = HAL_GetTick();
470 }
471 */
446 472
447 global.mode = MODE_SURFACE; 473 global.mode = MODE_SURFACE;
448 break; 474 break;
449 475
450 case MODE_CALIB: 476 case MODE_CALIB:
1001 GPIO_LED_RED_OFF(); 1027 GPIO_LED_RED_OFF();
1002 GPIO_VIBRATION_OFF(); 1028 GPIO_VIBRATION_OFF();
1003 GPIO_GPS_BCKP_ON(); // mH : costs 100µA in sleep - beware 1029 GPIO_GPS_BCKP_ON(); // mH : costs 100µA in sleep - beware
1004 GPIO_GPS_OFF(); 1030 GPIO_GPS_OFF();
1005 1031
1032 MX_USART6_UART_DeInit();
1006 1033
1007 #ifndef DEBUGMODE 1034 #ifndef DEBUGMODE
1008 __HAL_RCC_GPIOB_CLK_DISABLE(); 1035 __HAL_RCC_GPIOB_CLK_DISABLE();
1009 #endif 1036 #endif
1010 __HAL_RCC_GPIOH_CLK_DISABLE(); 1037 __HAL_RCC_GPIOH_CLK_DISABLE();