Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

nimaltd/NMEA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NMEA library for STM32 LL



  • Enable USART (LL Library) and RX interrupt.
  • Set baudrate, stop bits and parity.
  • create a structure of nmea_t.
  • Add nmea_callback() in usart interrupt.
  • Configure nmea_config.h.
  • Call nmea_init().
  • Call nmea_loop() in infinit loop.
  • If using FREERTOS, please create a task for nmea with at least 256 word heap size.

RTOS example:

#include "nmea.h"
nmea_t gps;

int main()
{
  ...  
}

void task_nmea(void const * argument)
{
  nmea_init(&gps, USART1, 1024);
  while (1)
  {
    nmea_loop(&gps);
    osDelay(1);
  }
}

void task_other(void const * argument)
{
  uint8_t time_h; 
  for(;;)
  {
    if (nmea_available(&gps))
    {
      nmea_gnss_time_h(&gps, &time_h);
      nmea_available_reset(&gps);
    }
    osDelay(1);
  }
}

in interrupt file

#include "nmea.h"
extern nmea_t gps;

void USART1_IRQHandler(void)
{
  /* USER CODE BEGIN USART1_IRQn 0 */
	nmea_callback(&gps);
  /* USER CODE END USART1_IRQn 0 */
  /* USER CODE BEGIN USART1_IRQn 1 */

  /* USER CODE END USART1_IRQn 1 */
}