<commit_before>#include "gps.h"
#include <stdio.h>
#include <stdlib.h>

#include <math.h>

#include "nmea.h"
#include "serial.h"

extern void gps_init(void) {
	serial_init();
	serial_config();

	//Write commands
}

extern void gps_on(void) {
	//Write on
}

// Compute the GPS location using decimal scale
extern void gps_location(loc_t *coord) {
	uint8_t status = _EMPTY;
	while(status != _COMPLETED) {
		gpgga_t gpgga;
		gprmc_t gprmc;
		char buffer[256];

		if(serial_readln(buffer, 256)==-1)
		{
			coord->latitude = 0;
			coord->longitude = 0;
			coord->altitude = 0;
			coord->speed = 0;
			coord->course = 0;
			break;
		}else{
			switch (nmea_get_message_type(buffer)) {
			case NMEA_GPGGA:
				nmea_parse_gpgga(buffer, &gpgga);

				gps_convert_deg_to_dec(&(gpgga.latitude), gpgga.lat, &(gpgga.longitude), gpgga.lon);

				coord->latitude = gpgga.latitude;
				coord->longitude = gpgga.longitude;
				coord->altitude = gpgga.altitude;

				status |= NMEA_GPGGA;
				break;
			case NMEA_GPRMC:
				nmea_parse_gprmc(buffer, &gprmc);

				coord->speed = gprmc.speed;
				coord->course = gprmc.course;

				status |= NMEA_GPRMC;
				break;
			}
		}
	}
}

extern void gps_flush(void)
{
	serial_flush();
}

extern void gps_avail(void)
{
	int i = serial_dataavail();
	printf("the number of bytes of data avalable is %d\n",i);
}

extern void gps_off(void) {
	//Write off
	serial_close();<commit_msg>Update gps.c<commit_after>#include "gps.h"
#include <stdio.h>
#include <stdlib.h>

#include <math.h>

#include "nmea.h"
#include "serial.h"

extern void gps_init(void) {
	serial_init();
	serial_config();

	//Write commands
}

extern void gps_on(void) {
	//Write on
}

// Compute the GPS location using decimal scale
extern void gps_location(loc_t *coord) {
	uint8_t status = _EMPTY;
	while(status != _COMPLETED) {
		gpgga_t gpgga;
		gprmc_t gprmc;
		char buffer[256];

		if(serial_readln(buffer, 256)==-1)
		{
			coord->latitude = 0;
			coord->longitude = 0;
			coord->altitude = 0;
			coord->speed = 0;
			coord->course = 0;
			break;
		}else{
			switch (nmea_get_message_type(buffer)) {
			case NMEA_GPGGA:
				nmea_parse_gpgga(buffer, &gpgga);

				gps_convert_deg_to_dec(&(gpgga.latitude), gpgga.lat, &(gpgga.longitude), gpgga.lon);

				coord->latitude = gpgga.latitude;
				coord->longitude = gpgga.longitude;
				coord->altitude = gpgga.altitude;

				status |= NMEA_GPGGA;
				break;
			case NMEA_GPRMC:
				nmea_parse_gprmc(buffer, &gprmc);

				coord->speed = gprmc.speed;
				coord->course = gprmc.course;

				status |= NMEA_GPRMC;
				break;
			}
		}
	}
}

extern void gps_flush(void)
{
	serial_flush();
}

extern void gps_avail(void)
{
	int i = serial_data_avail();
	printf("the number of bytes of data avalable is %d\n",i);
}

extern void gps_off(void) {
	//Write off
	serial_close();
{'fraction_non_alphanumeric': 0.14045746962115796, 'fraction_numerical': 0.009292351679771264, 'mean_word_length': 3.6264462809917357, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1247050', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1165, 'n_words': 230}