contain lorawan with serial_rx enabled
Dependencies: pulga-lorawan-drv SPI_MX25R Si1133 BME280
Diff: gps.h
- Revision:
- 63:4ec1808fb547
- Child:
- 65:4090220e19d2
diff -r 89df9529dbb0 -r 4ec1808fb547 gps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gps.h Fri Feb 26 18:11:06 2021 +0000 @@ -0,0 +1,102 @@ +#ifndef __GPS_H + +#define __GPS_H + +#include "mbed.h" + +#define SYNC1 0xB5 +#define SYNC2 0x62 + + +#define MAXIMUM_PACKET_SIZE 60 + +//GPS DEclaration +extern SPI spi_2; // mosi, miso, sclk +extern DigitalOut cs; +extern DigitalOut gps_reset; +extern DigitalOut gps_int; +extern DigitalOut gps_DSEL; + +static int lat; +static int lon; + + +typedef struct +{ + uint8_t cls; + uint8_t id; + uint16_t len; //Length of the payload. Does not include cls, id, or checksum bytes + uint8_t *payload; + uint8_t checksumA; //Given to us from module. Checked against the rolling calculated A/B checksums. + uint8_t checksumB; +} gps_ubxPacket; + +typedef struct +{ + uint32_t iTOW=0; + uint16_t year=0; + uint8_t month=0; + uint8_t day=0; + uint8_t hour=0; + uint8_t min=0; + uint8_t sec=0; + int8_t valid=0; + uint32_t tAcc=0; + int32_t nano=0; + uint8_t fixtype=0; + int8_t flags=0; + int8_t flags2=0; + uint8_t numSV=0; + int32_t lon=0; + int32_t lat=0; + int32_t height=0; + int32_t hMSL=0; + uint32_t hAcc=0; + uint32_t vAcc=0; + int32_t velN=0; + int32_t velE=0; + int32_t velD=0; + int32_t gSpeed=0; + int32_t headMot=0; + uint32_t sAcc=0; + uint32_t headAcc=0; + uint16_t pDOP=0; + int32_t headVeh; + int16_t magDec; + uint16_t magAcc; + + +} gps_navPVT; + + +extern void gps_leBootMsg(); + +extern void gps_le_envia_linha(); + +extern gps_ubxPacket gps_calcula_check(gps_ubxPacket Packet); + +extern void send_gps_packet(gps_ubxPacket packet); + +extern gps_navPVT le_nav_pvt (); + +extern void send_nav_pvt(); + +extern void send_gps_data(uint8_t *packet, uint8_t size); + +extern void wait_packet_byte (uint8_t *header, uint8_t byte); + +extern void gps_wait_same_packet(); + +extern void gps_config_gnss(); + +extern void gps_print_local (); + +extern void gps_get_lat_lon(int *latitude, int *logitude); + +extern void gps_config(); + +extern int get_latitude(); + +extern int get_longitude(); + +#endif \ No newline at end of file